From 8f7394a7b73739f166978a3c95f8de40d2f104e4 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 4 Jul 2016 13:48:28 +0900 Subject: [PATCH 1/8] Upgrade to Chrome 52 --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index 31144d583c..1dd3cbf7c4 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 31144d583c19b70d8d9de7d4ef15f0f720779860 +Subproject commit 1dd3cbf7c4d3cc6511fa1a2a145b0e9cd86752b6 From 4e9782897c893aa2f36a29a6e5963491d18ef35a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 4 Jul 2016 15:06:05 +0900 Subject: [PATCH 2/8] Update to API changes of Chrome 52 --- brightray/browser/browser_context.cc | 33 +++++++------------ brightray/browser/browser_context.h | 10 +++--- brightray/browser/browser_main_parts.cc | 6 ++-- .../browser/inspectable_web_contents_impl.cc | 24 +++++++------- .../media/media_capture_devices_dispatcher.cc | 8 +++++ .../media/media_capture_devices_dispatcher.h | 5 +++ .../browser/platform_notification_service.cc | 8 ++--- .../browser/platform_notification_service.h | 4 +-- .../browser/url_request_context_getter.cc | 2 +- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 236a8f5c1f..4138b8e0f8 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -174,27 +174,6 @@ bool BrowserContext::IsOffTheRecord() const { return in_memory_; } -net::URLRequestContextGetter* BrowserContext::GetRequestContext() { - return GetDefaultStoragePartition(this)->GetURLRequestContext(); -} - -net::URLRequestContextGetter* BrowserContext::GetMediaRequestContext() { - return GetRequestContext(); -} - -net::URLRequestContextGetter* - BrowserContext::GetMediaRequestContextForRenderProcess( - int renderer_child_id) { - return GetRequestContext(); -} - -net::URLRequestContextGetter* - BrowserContext::GetMediaRequestContextForStoragePartition( - const base::FilePath& partition_path, - bool in_memory) { - return GetRequestContext(); -} - content::ResourceContext* BrowserContext::GetResourceContext() { return resource_context_.get(); } @@ -238,4 +217,16 @@ BrowserContext::CreateRequestContextForStoragePartition( return nullptr; } +net::URLRequestContextGetter* +BrowserContext::CreateMediaRequestContext() { + return url_request_getter_.get(); +} + +net::URLRequestContextGetter* +BrowserContext::CreateMediaRequestContextForStoragePartition( + const base::FilePath& partition_path, + bool in_memory) { + return nullptr; +} + } // namespace brightray diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index 421ef51f43..fb816b79b5 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -42,12 +42,6 @@ class BrowserContext : public base::RefCounted, std::unique_ptr CreateZoomLevelDelegate( const base::FilePath& partition_path) override; bool IsOffTheRecord() const override; - net::URLRequestContextGetter* GetRequestContext() override; - net::URLRequestContextGetter* GetMediaRequestContext() override; - net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( - int renderer_child_id) override; - net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( - const base::FilePath& partition_path, bool in_memory) override; content::ResourceContext* GetResourceContext() override; content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; content::BrowserPluginGuestManager* GetGuestManager() override; @@ -64,6 +58,10 @@ class BrowserContext : public base::RefCounted, bool in_memory, content::ProtocolHandlerMap* protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors) override; + net::URLRequestContextGetter* CreateMediaRequestContext() override; + net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition( + const base::FilePath& partition_path, + bool in_memory) override; URLRequestContextGetter* url_request_context_getter() const { return url_request_getter_.get(); diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index 8b1ade8e50..9f0ef0245d 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -21,7 +21,7 @@ #include "ui/base/l10n/l10n_util.h" #if defined(USE_AURA) -#include "ui/gfx/screen.h" +#include "ui/display/screen.h" #include "ui/views/widget/desktop_aura/desktop_screen.h" #endif @@ -238,8 +238,8 @@ void BrowserMainParts::PostMainMessageLoopRun() { int BrowserMainParts::PreCreateThreads() { #if defined(USE_AURA) - gfx::Screen* screen = views::CreateDesktopScreen(); - gfx::Screen::SetScreenInstance(screen); + display::Screen* screen = views::CreateDesktopScreen(); + display::Screen::SetScreenInstance(screen); #if defined(USE_X11) views::LinuxUI::instance()->UpdateDeviceScaleFactor( screen->GetPrimaryDisplay().device_scale_factor()); diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 70119c1558..ab610748f2 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -5,25 +5,22 @@ #include "browser/inspectable_web_contents_impl.h" +#include "base/json/json_reader.h" +#include "base/json/json_writer.h" +#include "base/metrics/histogram.h" +#include "base/strings/pattern.h" +#include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" +#include "base/values.h" #include "browser/browser_client.h" #include "browser/browser_context.h" #include "browser/browser_main_parts.h" #include "browser/inspectable_web_contents_delegate.h" #include "browser/inspectable_web_contents_view.h" #include "browser/inspectable_web_contents_view_delegate.h" - -#include "base/json/json_reader.h" -#include "base/json/json_writer.h" -#include "base/metrics/histogram.h" - #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/pref_registry_simple.h" - -#include "base/strings/pattern.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/render_frame_host.h" @@ -33,7 +30,8 @@ #include "net/http/http_response_headers.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_fetcher_response_writer.h" -#include "ui/gfx/screen.h" +#include "ui/display/display.h" +#include "ui/display/screen.h" namespace brightray { @@ -214,7 +212,7 @@ InspectableWebContentsImpl::InspectableWebContentsImpl( devtools_bounds_.set_height(600); devtools_bounds_.set_width(800); } - gfx::Rect display = gfx::Screen::GetScreen() + gfx::Rect display = display::Screen::GetScreen() ->GetDisplayNearestWindow(web_contents->GetNativeView()).bounds(); if (!IsPointInRect(devtools_bounds_.origin(), display)) { devtools_bounds_.set_x(display.x() + (display.width() - devtools_bounds_.width()) / 2); @@ -361,7 +359,7 @@ void InspectableWebContentsImpl::ActivateWindow() { } void InspectableWebContentsImpl::CloseWindow() { - GetDevToolsWebContents()->DispatchBeforeUnload(false); + GetDevToolsWebContents()->DispatchBeforeUnload(); } void InspectableWebContentsImpl::LoadCompleted() { diff --git a/brightray/browser/media/media_capture_devices_dispatcher.cc b/brightray/browser/media/media_capture_devices_dispatcher.cc index 09c71b82a4..9ebe5e1a31 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.cc +++ b/brightray/browser/media/media_capture_devices_dispatcher.cc @@ -147,4 +147,12 @@ void MediaCaptureDevicesDispatcher::OnCreatingAudioStream( int render_view_id) { } +void MediaCaptureDevicesDispatcher::OnSetCapturingLinkSecured( + int render_process_id, + int render_frame_id, + int page_request_id, + content::MediaStreamType stream_type, + bool is_secure) { +} + } // namespace brightray diff --git a/brightray/browser/media/media_capture_devices_dispatcher.h b/brightray/browser/media/media_capture_devices_dispatcher.h index 27fe676646..dbbd66d258 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.h +++ b/brightray/browser/media/media_capture_devices_dispatcher.h @@ -61,6 +61,11 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver { content::MediaRequestState state) override; void OnCreatingAudioStream(int render_process_id, int render_view_id) override; + void OnSetCapturingLinkSecured(int render_process_id, + int render_frame_id, + int page_request_id, + content::MediaStreamType stream_type, + bool is_secure) override; private: friend struct base::DefaultSingletonTraits; diff --git a/brightray/browser/platform_notification_service.cc b/brightray/browser/platform_notification_service.cc index 7821de440a..77ca31a5bb 100644 --- a/brightray/browser/platform_notification_service.cc +++ b/brightray/browser/platform_notification_service.cc @@ -55,19 +55,19 @@ PlatformNotificationService::PlatformNotificationService( PlatformNotificationService::~PlatformNotificationService() {} -blink::WebNotificationPermission PlatformNotificationService::CheckPermissionOnUIThread( +blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnUIThread( content::BrowserContext* browser_context, const GURL& origin, int render_process_id) { render_process_id_ = render_process_id; - return blink::WebNotificationPermissionAllowed; + return blink::mojom::PermissionStatus::GRANTED; } -blink::WebNotificationPermission PlatformNotificationService::CheckPermissionOnIOThread( +blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnIOThread( content::ResourceContext* resource_context, const GURL& origin, int render_process_id) { - return blink::WebNotificationPermissionAllowed; + return blink::mojom::PermissionStatus::GRANTED; } void PlatformNotificationService::DisplayNotification( diff --git a/brightray/browser/platform_notification_service.h b/brightray/browser/platform_notification_service.h index 1c4b53da94..9c47892937 100644 --- a/brightray/browser/platform_notification_service.h +++ b/brightray/browser/platform_notification_service.h @@ -20,11 +20,11 @@ class PlatformNotificationService protected: // content::PlatformNotificationService: - blink::WebNotificationPermission CheckPermissionOnUIThread( + blink::mojom::PermissionStatus CheckPermissionOnUIThread( content::BrowserContext* browser_context, const GURL& origin, int render_process_id) override; - blink::WebNotificationPermission CheckPermissionOnIOThread( + blink::mojom::PermissionStatus CheckPermissionOnIOThread( content::ResourceContext* resource_context, const GURL& origin, int render_process_id) override; diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index feec4ce6f8..2bbb3f5948 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -381,7 +381,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { it != protocol_interceptors_.rend(); ++it) { top_job_factory.reset(new net::URLRequestInterceptingJobFactory( - std::move(top_job_factory), make_scoped_ptr(*it))); + std::move(top_job_factory), base::WrapUnique(*it))); } protocol_interceptors_.weak_clear(); From d166ba9ed2f7d1f66f94b787513505049b3edbc3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 4 Jul 2016 15:06:15 +0900 Subject: [PATCH 3/8] Disable compiler warning caused by blink --- brightray/brightray.gypi | 1 + 1 file changed, 1 insertion(+) diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index d22c458ce1..2800409124 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -42,6 +42,7 @@ '-Wno-missing-field-initializers', '-Wno-deprecated-declarations', '-Wno-unneeded-internal-declaration', + '-Wno-inconsistent-missing-override', ], }, 'msvs_configuration_attributes': { From c1b07b3da98f26d154f0d0385dc8d3d51ee95064 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 4 Jul 2016 15:06:58 +0900 Subject: [PATCH 4/8] Make it possible to include SkUserConfig.h --- brightray/brightray.gyp | 1 + 1 file changed, 1 insertion(+) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index b5fcbbd05c..4de2f5259a 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -26,6 +26,7 @@ '<(libchromiumcontent_src_dir)', '<(libchromiumcontent_src_dir)/skia/config', '<(libchromiumcontent_src_dir)/third_party/skia/include/core', + '<(libchromiumcontent_src_dir)/third_party/skia/include/config', '<(libchromiumcontent_src_dir)/third_party/icu/source/common', '<(libchromiumcontent_src_dir)/third_party/mojo/src', '<(libchromiumcontent_src_dir)/third_party/WebKit', From 4afa3f7206e64f4d4984e9c30da35a20cb355393 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 4 Jul 2016 15:29:43 +0900 Subject: [PATCH 5/8] Add BrowserContext::GetRequestContext --- brightray/browser/browser_context.cc | 17 +++++++++++------ brightray/browser/browser_context.h | 3 +++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 4138b8e0f8..15b45ae2db 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -115,6 +115,12 @@ BrowserContext::BrowserContext(const std::string& partition, bool in_memory) content::BrowserContext::Initialize(this, path_); } +BrowserContext::~BrowserContext() { + BrowserThread::DeleteSoon(BrowserThread::IO, + FROM_HERE, + resource_context_.release()); +} + void BrowserContext::InitPrefs() { auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences")); PrefServiceFactory prefs_factory; @@ -129,16 +135,15 @@ void BrowserContext::InitPrefs() { prefs_ = prefs_factory.Create(registry.get()); } -BrowserContext::~BrowserContext() { - BrowserThread::DeleteSoon(BrowserThread::IO, - FROM_HERE, - resource_context_.release()); -} - void BrowserContext::RegisterInternalPrefs(PrefRegistrySimple* registry) { InspectableWebContentsImpl::RegisterPrefs(registry); } +URLRequestContextGetter* BrowserContext::GetRequestContext() { + return static_cast( + GetDefaultStoragePartition(this)->GetURLRequestContext()); +} + net::URLRequestContextGetter* BrowserContext::CreateRequestContext( content::ProtocolHandlerMap* protocol_handlers, content::URLRequestInterceptorScopedVector protocol_interceptors) { diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index fb816b79b5..bda4f3a9e4 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -38,6 +38,9 @@ class BrowserContext : public base::RefCounted, static scoped_refptr Create( const std::string& partition, bool in_memory); + // Get the request context, if there is no one, create it. + URLRequestContextGetter* GetRequestContext(); + // content::BrowserContext: std::unique_ptr CreateZoomLevelDelegate( const base::FilePath& partition_path) override; From 0ae344e5cd7e8d4fc66524ec6b0ca9199440d4ca Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 4 Jul 2016 16:40:46 +0900 Subject: [PATCH 6/8] Fix building on Linux --- brightray/brightray.gypi | 68 +++++++++++++++---------- brightray/browser/browser_main_parts.cc | 3 +- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index 2800409124..038348fe6c 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -35,15 +35,6 @@ 'MACOSX_DEPLOYMENT_TARGET': '10.8', 'RUN_CLANG_STATIC_ANALYZER': 'YES', 'USE_HEADER_MAP': 'NO', - 'WARNING_CFLAGS': [ - '-Wall', - '-Wextra', - '-Wno-unused-parameter', - '-Wno-missing-field-initializers', - '-Wno-deprecated-declarations', - '-Wno-unneeded-internal-declaration', - '-Wno-inconsistent-missing-override', - ], }, 'msvs_configuration_attributes': { 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)', @@ -92,24 +83,6 @@ ], }, }, - 'msvs_disabled_warnings': [ - 4100, # unreferenced formal parameter - 4121, # alignment of a member was sensitive to packing - 4127, # conditional expression is constant - 4189, # local variable is initialized but not referenced - 4244, # 'initializing' : conversion from 'double' to 'size_t', possible loss of data - 4245, # 'initializing' : conversion from 'int' to 'const net::QuicVersionTag', signed/unsigned mismatch - 4251, # class 'std::xx' needs to have dll-interface. - 4310, # cast truncates constant value - 4355, # 'this' : used in base member initializer list - 4480, # nonstandard extension used: specifying underlying type for enum - 4481, # nonstandard extension used: override specifier 'override' - 4510, # default constructor could not be generated - 4512, # assignment operator could not be generated - 4610, # user defined constructor required - 4702, # unreachable code - 4819, # The file contains a character that cannot be represented in the current code page - ], 'configurations': { # The "Debug" and "Release" configurations are not actually used. 'Debug': {}, @@ -342,5 +315,46 @@ ], }], ], # target_conditions + # Ignored compiler warnings of Chromium. + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-Wall', + '-Wextra', + '-Wno-unused-parameter', + '-Wno-missing-field-initializers', + '-Wno-deprecated-declarations', + '-Wno-unneeded-internal-declaration', + '-Wno-inconsistent-missing-override', + ], + }, + }], + ['OS=="linux"', { + 'cflags': [ + '-Wno-inconsistent-missing-override', + ], + }], + ['OS=="win"', { + 'msvs_disabled_warnings': [ + 4100, # unreferenced formal parameter + 4121, # alignment of a member was sensitive to packing + 4127, # conditional expression is constant + 4189, # local variable is initialized but not referenced + 4244, # 'initializing' : conversion from 'double' to 'size_t', possible loss of data + 4245, # 'initializing' : conversion from 'int' to 'const net::QuicVersionTag', signed/unsigned mismatch + 4251, # class 'std::xx' needs to have dll-interface. + 4310, # cast truncates constant value + 4355, # 'this' : used in base member initializer list + 4480, # nonstandard extension used: specifying underlying type for enum + 4481, # nonstandard extension used: override specifier 'override' + 4510, # default constructor could not be generated + 4512, # assignment operator could not be generated + 4610, # user defined constructor required + 4702, # unreachable code + 4819, # The file contains a character that cannot be represented in the current code page + ], + }], + ], # conditions }, # target_defaults } diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index 9f0ef0245d..c2127b3b5a 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -21,6 +21,7 @@ #include "ui/base/l10n/l10n_util.h" #if defined(USE_AURA) +#include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/views/widget/desktop_aura/desktop_screen.h" #endif @@ -33,7 +34,7 @@ #include "base/environment.h" #include "base/path_service.h" #include "base/nix/xdg_util.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "browser/brightray_paths.h" #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" #include "ui/base/x/x11_util.h" From fd1448dd8b84c9caa377055b8f88efa20aaa2f0b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 5 Jul 2016 09:41:05 +0900 Subject: [PATCH 7/8] Initialize MaterialDesignController --- brightray/browser/browser_main_parts.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index c2127b3b5a..0aae4bcc5b 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -19,6 +19,7 @@ #include "media/base/media_resources.h" #include "net/proxy/proxy_resolver_v8.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/material_design/material_design_controller.h" #if defined(USE_AURA) #include "ui/display/display.h" @@ -176,6 +177,8 @@ void BrowserMainParts::PreEarlyInitialization() { } void BrowserMainParts::ToolkitInitialized() { + ui::MaterialDesignController::Initialize(); + #if defined(USE_AURA) && defined(USE_X11) views::LinuxUI::instance()->Initialize(); wm_state_.reset(new wm::WMState); From b2546a2b34a7c99f0f43c76d1176bb1cab6eda9b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 06:03:11 -0600 Subject: [PATCH 8/8] Fix compilation error after merge --- brightray/browser/inspectable_web_contents_impl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 17463b10ed..dc3110be4e 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -90,7 +90,7 @@ bool IsPointInRect(const gfx::Point& point, const gfx::Rect& rect) { } bool IsPointInScreen(const gfx::Point& point) { - for (const auto& display : gfx::Screen::GetScreen()->GetAllDisplays()) { + for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { if (IsPointInRect(point, display.bounds())) return true; } @@ -221,7 +221,7 @@ InspectableWebContentsImpl::InspectableWebContentsImpl( devtools_bounds_.set_width(800); } if (!IsPointInScreen(devtools_bounds_.origin())) { - gfx::Rect display = gfx::Screen::GetScreen()-> + gfx::Rect display = display::Screen::GetScreen()-> GetDisplayNearestWindow(web_contents->GetNativeView()).bounds(); devtools_bounds_.set_x(display.x() + (display.width() - devtools_bounds_.width()) / 2); devtools_bounds_.set_y(display.y() + (display.height() - devtools_bounds_.height()) / 2);