From 55cfef4432bef7ad14854afbf427caa715c19726 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 27 Jun 2014 11:54:15 -0400 Subject: [PATCH 01/29] Update libchromiumcontent to Chrome 35 * vendor/libchromiumcontent 656be94...ded3c0a (1): > Merge pull request #47 from brightray/chrome35 --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index 656be9408484..ded3c0ad1d36 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 656be9408484de40ba4938ef47acdebeec8a1784 +Subproject commit ded3c0ad1d36cc900d94c7587a88d1b959ebc1c7 From ad0a5bdf80d74b74e2817c437ea9c1c2419e5944 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:10:35 -0400 Subject: [PATCH 02/29] Include Chrome's Skia config, not the default one This ensures we get Chrome's Skia settings. --- brightray/brightray.gyp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 8dd2a64ce089..3a5079c05736 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -12,15 +12,14 @@ 'include_dirs': [ '.', '<(libchromiumcontent_include_dir)', - '<(libchromiumcontent_include_dir)/third_party/skia/include/config', + '<(libchromiumcontent_include_dir)/skia/config', '<(libchromiumcontent_include_dir)/third_party/skia/include/core', ], 'direct_dependent_settings': { 'include_dirs': [ '..', '<(libchromiumcontent_include_dir)', - '<(libchromiumcontent_include_dir)/third_party/skia/include/config', - # For SkMatrix.h. + '<(libchromiumcontent_include_dir)/skia/config', '<(libchromiumcontent_include_dir)/third_party/skia/include/core', '<(libchromiumcontent_include_dir)/third_party/icu/source/common', ], From 202f7bcd4175339801d53cb19ff645d5dea31949 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:11:02 -0400 Subject: [PATCH 03/29] Fix include paths for WebIconURL.h It contains #include "public/platform/WebSize.h", so we have to set up the include path to make that work. --- brightray/brightray.gyp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 3a5079c05736..5925fc0f7c16 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -14,6 +14,7 @@ '<(libchromiumcontent_include_dir)', '<(libchromiumcontent_include_dir)/skia/config', '<(libchromiumcontent_include_dir)/third_party/skia/include/core', + '<(libchromiumcontent_include_dir)/third_party/WebKit', ], 'direct_dependent_settings': { 'include_dirs': [ @@ -22,6 +23,7 @@ '<(libchromiumcontent_include_dir)/skia/config', '<(libchromiumcontent_include_dir)/third_party/skia/include/core', '<(libchromiumcontent_include_dir)/third_party/icu/source/common', + '<(libchromiumcontent_include_dir)/third_party/WebKit', ], }, 'sources': [ From 500861d63d40323be0559a1d1aa8440f823d51ce Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:25:30 -0400 Subject: [PATCH 04/29] Update prefs code for Chrome 35 See https://codereview.chromium.org/64193003 --- brightray/browser/browser_context.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 4970530d7bff..cef50925de3f 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -16,7 +16,7 @@ #include "base/prefs/json_pref_store.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" -#include "base/prefs/pref_service_builder.h" +#include "base/prefs/pref_service_factory.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/resource_context.h" #include "content/public/browser/storage_partition.h" @@ -76,8 +76,8 @@ void BrowserContext::Initialize() { path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName())); auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences")); - PrefServiceBuilder builder; - builder.WithUserFilePrefs(prefs_path, + base::PrefServiceFactory prefs_factory; + prefs_factory.SetUserPrefsFile(prefs_path, JsonPrefStore::GetTaskRunnerForFile( prefs_path, content::BrowserThread::GetBlockingPool())); @@ -85,7 +85,7 @@ void BrowserContext::Initialize() { RegisterInternalPrefs(registry); RegisterPrefs(registry); - prefs_.reset(builder.Create(registry)); + prefs_ = prefs_factory.Create(registry); } BrowserContext::~BrowserContext() { From 42b86242ea52cb42b2dc363bcb510a947d4918aa Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:27:22 -0400 Subject: [PATCH 05/29] Add support for Chrome 35's "protocol interceptors" See https://codereview.chromium.org/187223003 --- brightray/browser/browser_client.cc | 5 +++-- brightray/browser/browser_client.h | 4 +++- brightray/browser/browser_context.cc | 6 +++-- brightray/browser/browser_context.h | 3 ++- .../browser/url_request_context_getter.cc | 22 ++++++++++++++++--- .../browser/url_request_context_getter.h | 4 +++- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index 82c0d7acb5f0..fabd51cc74cd 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -56,9 +56,10 @@ content::BrowserMainParts* BrowserClient::CreateBrowserMainParts( net::URLRequestContextGetter* BrowserClient::CreateRequestContext( content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers) { + content::ProtocolHandlerMap* protocol_handlers, + content::ProtocolHandlerScopedVector protocol_interceptors) { auto context = static_cast(browser_context); - return context->CreateRequestContext(protocol_handlers); + return context->CreateRequestContext(protocol_handlers, protocol_interceptors.Pass()); } void BrowserClient::ShowDesktopNotification( diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index 41a3861f61f2..42a7380a63c3 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -34,7 +34,9 @@ class BrowserClient : public content::ContentBrowserClient { // Subclasses that override this (e.g., to provide their own protocol // handlers) should call this implementation after doing their own work. virtual net::URLRequestContextGetter* CreateRequestContext( - content::BrowserContext*, content::ProtocolHandlerMap*) OVERRIDE; + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE; private: virtual content::BrowserMainParts* CreateBrowserMainParts( diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index cef50925de3f..f2bd0e829234 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -99,7 +99,8 @@ void BrowserContext::RegisterInternalPrefs(PrefRegistrySimple* registry) { } net::URLRequestContextGetter* BrowserContext::CreateRequestContext( - content::ProtocolHandlerMap* protocol_handlers) { + content::ProtocolHandlerMap* protocol_handlers, + content::ProtocolHandlerScopedVector protocol_interceptors) { DCHECK(!url_request_getter_); auto io_loop = content::BrowserThread::UnsafeGetMessageLoopForThread( content::BrowserThread::IO); @@ -110,7 +111,8 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext( io_loop, file_loop, base::Bind(&BrowserContext::CreateNetworkDelegate, base::Unretained(this)), - protocol_handlers); + protocol_handlers, + protocol_interceptors.Pass()); resource_context_->set_url_request_context_getter(url_request_getter_.get()); return url_request_getter_.get(); } diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index b92deb75c574..667d6a4802f1 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -25,7 +25,8 @@ class BrowserContext : public content::BrowserContext { virtual void Initialize(); net::URLRequestContextGetter* CreateRequestContext( - content::ProtocolHandlerMap*); + content::ProtocolHandlerMap* protocol_handlers, + content::ProtocolHandlerScopedVector protocol_interceptors); PrefService* prefs() { return prefs_.get(); } diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 4b26d7a93645..0e590aa5429b 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -29,6 +29,7 @@ #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/protocol_intercept_job_factory.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" @@ -41,11 +42,13 @@ URLRequestContextGetter::URLRequestContextGetter( base::MessageLoop* io_loop, base::MessageLoop* file_loop, base::Callback(void)> network_delegate_factory, - content::ProtocolHandlerMap* protocol_handlers) + content::ProtocolHandlerMap* protocol_handlers, + content::ProtocolHandlerScopedVector protocol_interceptors) : base_path_(base_path), io_loop_(io_loop), file_loop_(file_loop), - network_delegate_factory_(network_delegate_factory) { + network_delegate_factory_(network_delegate_factory), + protocol_interceptors_(protocol_interceptors.Pass()) { // Must first be created on the UI thread. DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); @@ -161,7 +164,20 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { content::BrowserThread::GetBlockingPool()-> GetTaskRunnerWithShutdownBehavior( base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); - storage_->set_job_factory(job_factory.release()); + + // Set up interceptors in the reverse order. + scoped_ptr top_job_factory = + job_factory.PassAs(); + for (content::ProtocolHandlerScopedVector::reverse_iterator i = + protocol_interceptors_.rbegin(); + i != protocol_interceptors_.rend(); + ++i) { + top_job_factory.reset(new net::ProtocolInterceptJobFactory( + top_job_factory.Pass(), make_scoped_ptr(*i))); + } + protocol_interceptors_.weak_clear(); + + storage_->set_job_factory(top_job_factory.release()); } return url_request_context_.get(); diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index 7d3e174cd405..ad09e2b409c6 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -32,7 +32,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { base::MessageLoop* io_loop, base::MessageLoop* file_loop, base::Callback(void)>, - content::ProtocolHandlerMap*); + content::ProtocolHandlerMap* protocol_handlers, + content::ProtocolHandlerScopedVector protocol_interceptors); virtual ~URLRequestContextGetter(); net::HostResolver* host_resolver(); @@ -53,6 +54,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { scoped_ptr storage_; scoped_ptr url_request_context_; content::ProtocolHandlerMap protocol_handlers_; + content::ProtocolHandlerScopedVector protocol_interceptors_; DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter); }; From 5b93dc74e6ce01ff4a5a6ae2b7e022976cebceb5 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:27:58 -0400 Subject: [PATCH 06/29] Update BrowserContext for Chrome 35 --- brightray/browser/browser_context.cc | 26 ++++++++++++++++++++++++-- brightray/browser/browser_context.h | 19 +++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index f2bd0e829234..d82f4bc256ed 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -155,14 +155,36 @@ net::URLRequestContextGetter* return GetRequestContext(); } -void BrowserContext::RequestMIDISysExPermission( +void BrowserContext::RequestMidiSysExPermission( int render_process_id, int render_view_id, + int bridge_id, const GURL& requesting_frame, - const MIDISysExPermissionCallback& callback) { + bool user_gesture, + const MidiSysExPermissionCallback& callback) { callback.Run(false); } +void BrowserContext::CancelMidiSysExPermissionRequest( + int render_process_id, + int render_view_id, + int bridge_id, + const GURL& requesting_frame) { +} + +void BrowserContext::RequestProtectedMediaIdentifierPermission( + int render_process_id, + int render_view_id, + int bridge_id, + int group_id, + const GURL& requesting_frame, + const ProtectedMediaIdentifierPermissionCallback& callback) { + callback.Run(false); +} + +void BrowserContext::CancelProtectedMediaIdentifierPermissionRequests(int group_id) { +} + content::ResourceContext* BrowserContext::GetResourceContext() { return resource_context_.get(); } diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index 667d6a4802f1..a43d2380da10 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -55,11 +55,26 @@ class BrowserContext : public content::BrowserContext { virtual net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory); - virtual void RequestMIDISysExPermission( + virtual void RequestMidiSysExPermission( int render_process_id, int render_view_id, + int bridge_id, const GURL& requesting_frame, - const MIDISysExPermissionCallback&) OVERRIDE; + bool user_gesture, + const MidiSysExPermissionCallback& callback) OVERRIDE; + virtual void CancelMidiSysExPermissionRequest( + int render_process_id, + int render_view_id, + int bridge_id, + const GURL& requesting_frame) OVERRIDE; + virtual void RequestProtectedMediaIdentifierPermission( + int render_process_id, + int render_view_id, + int bridge_id, + int group_id, + const GURL& requesting_frame, + const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE; + virtual void CancelProtectedMediaIdentifierPermissionRequests(int group_id) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; From 5b788476a569949348e07b82ad85fa7f7d033c8b Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:29:38 -0400 Subject: [PATCH 07/29] Update for move of string symbols into base:: --- brightray/browser/inspectable_web_contents_impl.cc | 2 +- brightray/browser/network_delegate.cc | 2 +- brightray/browser/network_delegate.h | 2 +- brightray/browser/url_request_context_getter.cc | 2 +- brightray/common/content_client.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 1ccb4e1054d4..739acf44ecb1 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -117,7 +117,7 @@ void InspectableWebContentsImpl::UpdateFrontendDockSide() { auto javascript = base::StringPrintf( "InspectorFrontendAPI.setDockSide(\"%s\")", dock_side_.c_str()); devtools_web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame( - string16(), ASCIIToUTF16(javascript)); + base::string16(), base::ASCIIToUTF16(javascript)); } void InspectableWebContentsImpl::ActivateWindow() { diff --git a/brightray/browser/network_delegate.cc b/brightray/browser/network_delegate.cc index 6467dc3e3d6f..a915752b382f 100644 --- a/brightray/browser/network_delegate.cc +++ b/brightray/browser/network_delegate.cc @@ -59,7 +59,7 @@ void NetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) { } void NetworkDelegate::OnPACScriptError(int line_number, - const string16& error) { + const base::string16& error) { } NetworkDelegate::AuthRequiredResponse NetworkDelegate::OnAuthRequired( diff --git a/brightray/browser/network_delegate.h b/brightray/browser/network_delegate.h index 0d4f2d3600c5..3e258ac14f1c 100644 --- a/brightray/browser/network_delegate.h +++ b/brightray/browser/network_delegate.h @@ -37,7 +37,7 @@ class NetworkDelegate : public net::NetworkDelegate { virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE; virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE; virtual void OnPACScriptError(int line_number, - const string16& error) OVERRIDE; + const base::string16& error) OVERRIDE; virtual AuthRequiredResponse OnAuthRequired( net::URLRequest* request, const net::AuthChallengeInfo& auth_info, diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 0e590aa5429b..47debda7ae98 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -85,7 +85,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { base::WorkerPool::GetTaskRunner(true))); storage_->set_http_user_agent_settings( new net::StaticHttpUserAgentSettings( - "en-us,en", EmptyString())); + "en-us,en", base::EmptyString())); scoped_ptr host_resolver( net::HostResolver::CreateDefaultResolver(NULL)); diff --git a/brightray/common/content_client.cc b/brightray/common/content_client.cc index dd6ce530690c..3fd5f930183f 100644 --- a/brightray/common/content_client.cc +++ b/brightray/common/content_client.cc @@ -21,7 +21,7 @@ ContentClient::~ContentClient() { std::string ContentClient::GetProduct() const { auto name = GetApplicationName(); - RemoveChars(name, kWhitespaceASCII, &name); + base::RemoveChars(name, base::kWhitespaceASCII, &name); return base::StringPrintf("%s/%s", name.c_str(), GetApplicationVersion().c_str()); } From e003cc9a0a20a17906cdae35fb9900ed0bab808d Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:31:32 -0400 Subject: [PATCH 08/29] Update MediaCaptureDevicesDispatcher for Chrome 35 See https://codereview.chromium.org/183743021 --- .../media/media_capture_devices_dispatcher.cc | 72 +++++++------------ .../media/media_capture_devices_dispatcher.h | 33 +++------ 2 files changed, 37 insertions(+), 68 deletions(-) diff --git a/brightray/browser/media/media_capture_devices_dispatcher.cc b/brightray/browser/media/media_capture_devices_dispatcher.cc index eb3e6731a27f..65ea4b94be9c 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.cc +++ b/brightray/browser/media/media_capture_devices_dispatcher.cc @@ -6,8 +6,7 @@ #include "base/logging.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/media_devices_monitor.h" -#include "content/public/common/desktop_media_id.h" +#include "content/public/browser/media_capture_devices.h" #include "content/public/common/media_stream_request.h" namespace brightray { @@ -30,6 +29,11 @@ const content::MediaStreamDevice* FindDeviceWithId( return NULL; } +const MediaStreamDevices& EmptyDevices() { + static MediaStreamDevices* devices = new MediaStreamDevices; + return *devices; +} + } // namespace MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() { @@ -37,8 +41,7 @@ MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() { } MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() - : devices_enumerated_(false), - is_device_enumeration_disabled_(false) { + : is_device_enumeration_disabled_(false) { // MediaCaptureDevicesDispatcher is a singleton. It should be created on // UI thread. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -49,21 +52,17 @@ MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} const MediaStreamDevices& MediaCaptureDevicesDispatcher::GetAudioCaptureDevices() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!is_device_enumeration_disabled_ && !devices_enumerated_) { - content::EnsureMonitorCaptureDevices(); - devices_enumerated_ = true; - } - return audio_devices_; + if (is_device_enumeration_disabled_) + return EmptyDevices(); + return content::MediaCaptureDevices::GetInstance()->GetAudioCaptureDevices(); } const MediaStreamDevices& MediaCaptureDevicesDispatcher::GetVideoCaptureDevices() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!is_device_enumeration_disabled_ && !devices_enumerated_) { - content::EnsureMonitorCaptureDevices(); - devices_enumerated_ = true; - } - return video_devices_; + if (is_device_enumeration_disabled_) + return EmptyDevices(); + return content::MediaCaptureDevices::GetInstance()->GetVideoCaptureDevices(); } void MediaCaptureDevicesDispatcher::GetDefaultDevices( @@ -128,36 +127,33 @@ void MediaCaptureDevicesDispatcher::DisableDeviceEnumerationForTesting() { is_device_enumeration_disabled_ = true; } -void MediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged( - const content::MediaStreamDevices& devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&MediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread, - base::Unretained(this), devices)); +void MediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged() { } -void MediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged( - const content::MediaStreamDevices& devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&MediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread, - base::Unretained(this), devices)); +void MediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged() { } void MediaCaptureDevicesDispatcher::OnMediaRequestStateChanged( int render_process_id, int render_view_id, int page_request_id, + const GURL& security_origin, const content::MediaStreamDevice& device, content::MediaRequestState state) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); } -void MediaCaptureDevicesDispatcher::OnAudioStreamPlayingChanged( - int render_process_id, int render_view_id, int stream_id, - bool is_playing, float power_dbfs, bool clipped) { +void MediaCaptureDevicesDispatcher::OnAudioStreamPlaying( + int render_process_id, + int render_frame_id, + int stream_id, + const ReadPowerAndClipCallback& power_read_callback) { +} + +void MediaCaptureDevicesDispatcher::OnAudioStreamStopped( + int render_process_id, + int render_frame_id, + int stream_id) { } void MediaCaptureDevicesDispatcher::OnCreatingAudioStream( @@ -166,18 +162,4 @@ void MediaCaptureDevicesDispatcher::OnCreatingAudioStream( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); } -void MediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread( - const content::MediaStreamDevices& devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - devices_enumerated_ = true; - audio_devices_ = devices; -} - -void MediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread( - const content::MediaStreamDevices& devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - devices_enumerated_ = true; - video_devices_ = devices; -} - } // namespace brightray diff --git a/brightray/browser/media/media_capture_devices_dispatcher.h b/brightray/browser/media/media_capture_devices_dispatcher.h index d10c27df1bc3..3b29fae4701a 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.h +++ b/brightray/browser/media/media_capture_devices_dispatcher.h @@ -51,23 +51,24 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver { void DisableDeviceEnumerationForTesting(); // Overridden from content::MediaObserver: - virtual void OnAudioCaptureDevicesChanged( - const content::MediaStreamDevices& devices) OVERRIDE; - virtual void OnVideoCaptureDevicesChanged( - const content::MediaStreamDevices& devices) OVERRIDE; + virtual void OnAudioCaptureDevicesChanged() OVERRIDE; + virtual void OnVideoCaptureDevicesChanged() OVERRIDE; virtual void OnMediaRequestStateChanged( int render_process_id, int render_view_id, int page_request_id, + const GURL& security_origin, const content::MediaStreamDevice& device, content::MediaRequestState state) OVERRIDE; - virtual void OnAudioStreamPlayingChanged( + virtual void OnAudioStreamPlaying( int render_process_id, - int render_view_id, + int render_frame_id, int stream_id, - bool is_playing, - float power_dBFS, - bool clipped) OVERRIDE; + const ReadPowerAndClipCallback& power_read_callback) OVERRIDE; + virtual void OnAudioStreamStopped( + int render_process_id, + int render_frame_id, + int stream_id) OVERRIDE; virtual void OnCreatingAudioStream(int render_process_id, int render_view_id) OVERRIDE; @@ -77,20 +78,6 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver { MediaCaptureDevicesDispatcher(); virtual ~MediaCaptureDevicesDispatcher(); - // Called by the MediaObserver() functions, executed on UI thread. - void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); - void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); - - // A list of cached audio capture devices. - content::MediaStreamDevices audio_devices_; - - // A list of cached video capture devices. - content::MediaStreamDevices video_devices_; - - // Flag to indicate if device enumeration has been done/doing. - // Only accessed on UI thread. - bool devices_enumerated_; - // Flag used by unittests to disable device enumeration. bool is_device_enumeration_disabled_; From 3a71958e16b16db9c648cea97f351be3aef0a96e Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:31:55 -0400 Subject: [PATCH 09/29] Update MediaStreamDevicesController for Chrome 35 See https://codereview.chromium.org/180633008 --- brightray/browser/media/media_stream_devices_controller.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/brightray/browser/media/media_stream_devices_controller.cc b/brightray/browser/media/media_stream_devices_controller.cc index a85c1c928d46..4fd9894eca37 100644 --- a/brightray/browser/media/media_stream_devices_controller.cc +++ b/brightray/browser/media/media_stream_devices_controller.cc @@ -41,6 +41,7 @@ MediaStreamDevicesController::MediaStreamDevicesController( MediaStreamDevicesController::~MediaStreamDevicesController() { if (!callback_.is_null()) { callback_.Run(content::MediaStreamDevices(), + content::MEDIA_DEVICE_INVALID_STATE, scoped_ptr()); } } @@ -150,13 +151,13 @@ void MediaStreamDevicesController::Accept() { content::MediaResponseCallback cb = callback_; callback_.Reset(); - cb.Run(devices, scoped_ptr()); + cb.Run(devices, content::MEDIA_DEVICE_OK, scoped_ptr()); } void MediaStreamDevicesController::Deny() { content::MediaResponseCallback cb = callback_; callback_.Reset(); - cb.Run(content::MediaStreamDevices(), scoped_ptr()); + cb.Run(content::MediaStreamDevices(), content::MEDIA_DEVICE_PERMISSION_DENIED, scoped_ptr()); } } // namespace brightray From afc889b88369dceca0d50285ba48d87f23481391 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:33:11 -0400 Subject: [PATCH 10/29] Update NetworkDelegate for Chrome 35 --- brightray/browser/network_delegate.cc | 8 ++------ brightray/browser/network_delegate.h | 6 ++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/brightray/browser/network_delegate.cc b/brightray/browser/network_delegate.cc index a915752b382f..ec019a5f2812 100644 --- a/brightray/browser/network_delegate.cc +++ b/brightray/browser/network_delegate.cc @@ -37,7 +37,8 @@ int NetworkDelegate::OnHeadersReceived( net::URLRequest* request, const net::CompletionCallback& callback, const net::HttpResponseHeaders* original_response_headers, - scoped_refptr* override_response_headers) { + scoped_refptr* override_response_headers, + GURL* allowed_unsafe_redirect_url) { return net::OK; } @@ -97,9 +98,4 @@ int NetworkDelegate::OnBeforeSocketStreamConnect( return net::OK; } -void NetworkDelegate::OnRequestWaitStateChange( - const net::URLRequest& request, - RequestWaitState waiting) { -} - } // namespace brightray diff --git a/brightray/browser/network_delegate.h b/brightray/browser/network_delegate.h index 3e258ac14f1c..94be71d98528 100644 --- a/brightray/browser/network_delegate.h +++ b/brightray/browser/network_delegate.h @@ -27,8 +27,8 @@ class NetworkDelegate : public net::NetworkDelegate { net::URLRequest* request, const net::CompletionCallback& callback, const net::HttpResponseHeaders* original_response_headers, - scoped_refptr* - override_response_headers) OVERRIDE; + scoped_refptr* 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; @@ -55,8 +55,6 @@ class NetworkDelegate : public net::NetworkDelegate { virtual int OnBeforeSocketStreamConnect( net::SocketStream* stream, const net::CompletionCallback& callback) OVERRIDE; - virtual void OnRequestWaitStateChange(const net::URLRequest& request, - RequestWaitState state) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(NetworkDelegate); From 51ac56e4c4a938556733598b250dc4be00e1ac64 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:33:39 -0400 Subject: [PATCH 11/29] Update cookie store code for Chrome 35 See https://codereview.chromium.org/110883017 --- brightray/browser/url_request_context_getter.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 47debda7ae98..07bbe9f88bb8 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -34,6 +34,7 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_job_factory_impl.h" +#include "webkit/browser/quota/special_storage_policy.h" namespace brightray { @@ -74,12 +75,12 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { url_request_context_->set_network_delegate(network_delegate_.get()); storage_.reset( new net::URLRequestContextStorage(url_request_context_.get())); - storage_->set_cookie_store(content::CreatePersistentCookieStore( + auto cookie_config = content::CookieStoreConfig( base_path_.Append(FILE_PATH_LITERAL("Cookies")), - false, + content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr, - nullptr, - nullptr)); + nullptr); + storage_->set_cookie_store(content::CreateCookieStore(cookie_config)); storage_->set_server_bound_cert_service(new net::ServerBoundCertService( new net::DefaultServerBoundCertStore(NULL), base::WorkerPool::GetTaskRunner(true))); @@ -157,9 +158,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { } protocol_handlers_.clear(); job_factory->SetProtocolHandler( - chrome::kDataScheme, new net::DataProtocolHandler); + content::kDataScheme, new net::DataProtocolHandler); job_factory->SetProtocolHandler( - chrome::kFileScheme, + content::kFileScheme, new net::FileProtocolHandler( content::BrowserThread::GetBlockingPool()-> GetTaskRunnerWithShutdownBehavior( From 8e7fbd604cb6b7f097d89c0d22d8af3c317d5cd0 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:34:53 -0400 Subject: [PATCH 12/29] Update for move of BuildUserAgentFromProduct in Chrome 35 See https://codereview.chromium.org/186883002 --- brightray/common/content_client.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brightray/common/content_client.cc b/brightray/common/content_client.cc index 3fd5f930183f..9d42e350191f 100644 --- a/brightray/common/content_client.cc +++ b/brightray/common/content_client.cc @@ -8,8 +8,8 @@ #include "base/strings/stringprintf.h" #include "base/strings/string_util.h" +#include "content/public/common/user_agent.h" #include "ui/base/resource/resource_bundle.h" -#include "webkit/common/user_agent/user_agent_util.h" namespace brightray { @@ -27,7 +27,7 @@ std::string ContentClient::GetProduct() const { } std::string ContentClient::GetUserAgent() const { - return webkit_glue::BuildUserAgentFromProduct(GetProduct()); + return content::BuildUserAgentFromProduct(GetProduct()); } base::StringPiece ContentClient::GetDataResource( From 9602a9aed9f6c4c10aad8f6689387fa30d00f4f5 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 26 Jun 2014 16:35:27 -0400 Subject: [PATCH 13/29] Fix assertion in InitializeICU on launch We have to tell Chromium about our framework bundle earlier in the launch sequence so it can find icudtl.dat. See https://codereview.chromium.org/12470006 --- brightray/common/main_delegate.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index f85c769bafc4..ea0cbdddb5a4 100644 --- a/brightray/common/main_delegate.cc +++ b/brightray/common/main_delegate.cc @@ -27,14 +27,14 @@ scoped_ptr MainDelegate::CreateContentClient() { bool MainDelegate::BasicStartupComplete(int* exit_code) { content_client_ = CreateContentClient().Pass(); SetContentClient(content_client_.get()); - return false; -} - -void MainDelegate::PreSandboxStartup() { #if defined(OS_MACOSX) OverrideChildProcessPath(); OverrideFrameworkBundlePath(); #endif + return false; +} + +void MainDelegate::PreSandboxStartup() { InitializeResourceBundle(); } From 918f38e13fe6d2b6b21646acf2ab614b26e99270 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 27 Jun 2014 11:59:01 -0400 Subject: [PATCH 14/29] Fix long line --- brightray/browser/media/media_stream_devices_controller.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/brightray/browser/media/media_stream_devices_controller.cc b/brightray/browser/media/media_stream_devices_controller.cc index 4fd9894eca37..22fb0d1310de 100644 --- a/brightray/browser/media/media_stream_devices_controller.cc +++ b/brightray/browser/media/media_stream_devices_controller.cc @@ -157,7 +157,9 @@ void MediaStreamDevicesController::Accept() { void MediaStreamDevicesController::Deny() { content::MediaResponseCallback cb = callback_; callback_.Reset(); - cb.Run(content::MediaStreamDevices(), content::MEDIA_DEVICE_PERMISSION_DENIED, scoped_ptr()); + cb.Run(content::MediaStreamDevices(), + content::MEDIA_DEVICE_PERMISSION_DENIED, + scoped_ptr()); } } // namespace brightray From f8b44a1785928d4691d44896d33706a940f9be15 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 27 Jun 2014 12:06:13 -0400 Subject: [PATCH 15/29] Use the MSBuild that comes with Visual Studio See http://msdn.microsoft.com/en-us/library/hh162058.aspx --- brightray/script/build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/brightray/script/build b/brightray/script/build index b13f892b64f0..f337c37615b3 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -25,7 +25,8 @@ def build(): return subprocess.call(['make']) assert sys.platform == 'win32', sys.platform - msbuild = os.path.join(os.environ['windir'], 'Microsoft.NET', 'Framework', 'v4.0.30319', 'MSBuild.exe') + program_files = os.environ.get('PROGRAMFILES(X86)', os.environ['PROGRAMFILES']) + msbuild = os.path.join(program_files, 'MSBuild', '12.0', 'Bin', 'MSBuild.exe') return subprocess.call([msbuild, 'brightray.sln']) From 78dd3390f5c548df20696ca059b1cb38078718e3 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 27 Jun 2014 13:40:06 -0400 Subject: [PATCH 16/29] Define USE_AURA for Windows This is true inside of libchromiumcontent, so we need to mirror that here. --- brightray/brightray.gypi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index daf5f2737cf5..7edb5f9dbdec 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -77,6 +77,11 @@ }, }, 'conditions': [ + ['OS=="win"', { + 'defines': [ + 'USE_AURA', + ], + }], ['OS not in ["mac", "win"]', { 'defines': [ 'USE_X11', From 307d936d759decce731427c2ad03b25c49fccf67 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 27 Jun 2014 13:40:33 -0400 Subject: [PATCH 17/29] Update to use CR_* Windows message macros See https://codereview.chromium.org/146833020. --- brightray/browser/win/devtools_window.cc | 6 +++--- brightray/browser/win/devtools_window.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/brightray/browser/win/devtools_window.cc b/brightray/browser/win/devtools_window.cc index 9fc4b5dba886..96d0a3048475 100644 --- a/brightray/browser/win/devtools_window.cc +++ b/brightray/browser/win/devtools_window.cc @@ -20,7 +20,7 @@ DevToolsWindow::DevToolsWindow(InspectableWebContentsViewWin* controller) DevToolsWindow::~DevToolsWindow() { } -LRESULT DevToolsWindow::OnCreate(UINT, WPARAM, LPARAM, BOOL&) { +LRESULT DevToolsWindow::OnCreate(UINT, WPARAM, LPARAM) { auto devtools_web_contents = controller_->inspectable_web_contents()->devtools_web_contents(); SetParent(devtools_web_contents->GetView()->GetNativeView(), hwnd()); @@ -28,7 +28,7 @@ LRESULT DevToolsWindow::OnCreate(UINT, WPARAM, LPARAM, BOOL&) { return 0; } -LRESULT DevToolsWindow::OnDestroy(UINT, WPARAM, LPARAM, BOOL&) { +LRESULT DevToolsWindow::OnDestroy(UINT, WPARAM, LPARAM) { auto devtools_web_contents = controller_->inspectable_web_contents()->devtools_web_contents(); SetParent( @@ -37,7 +37,7 @@ LRESULT DevToolsWindow::OnDestroy(UINT, WPARAM, LPARAM, BOOL&) { return 0; } -LRESULT DevToolsWindow::OnSize(UINT, WPARAM, LPARAM, BOOL&) { +LRESULT DevToolsWindow::OnSize(UINT, WPARAM, LPARAM) { RECT rect; GetClientRect(hwnd(), &rect); diff --git a/brightray/browser/win/devtools_window.h b/brightray/browser/win/devtools_window.h index a6b11bb11e0c..a7e34d2b738c 100644 --- a/brightray/browser/win/devtools_window.h +++ b/brightray/browser/win/devtools_window.h @@ -14,20 +14,20 @@ class DevToolsWindow : public gfx::WindowImpl, static DevToolsWindow* Create( InspectableWebContentsViewWin* inspectable_web_contents_view_win); - BEGIN_MSG_MAP_EX(DevToolsWindow) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - MESSAGE_HANDLER(WM_SIZE, OnSize) - END_MSG_MAP() + CR_BEGIN_MSG_MAP_EX(DevToolsWindow) + CR_MESSAGE_HANDLER_EX(WM_CREATE, OnCreate) + CR_MESSAGE_HANDLER_EX(WM_DESTROY, OnDestroy) + CR_MESSAGE_HANDLER_EX(WM_SIZE, OnSize) + CR_END_MSG_MAP() private: explicit DevToolsWindow( InspectableWebContentsViewWin* inspectable_web_contents_view_win); ~DevToolsWindow(); - LRESULT OnCreate(UINT message, WPARAM, LPARAM, BOOL& handled); - LRESULT OnDestroy(UINT message, WPARAM, LPARAM, BOOL& handled); - LRESULT OnSize(UINT message, WPARAM, LPARAM, BOOL& handled); + LRESULT OnCreate(UINT message, WPARAM, LPARAM); + LRESULT OnDestroy(UINT message, WPARAM, LPARAM); + LRESULT OnSize(UINT message, WPARAM, LPARAM); InspectableWebContentsViewWin* controller_; From 08c017bd7df962faa6599b63700859ff9a47a194 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 27 Jun 2014 13:45:04 -0400 Subject: [PATCH 18/29] Ignore a couple more files on Windows --- brightray/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brightray/.gitignore b/brightray/.gitignore index 3f04a5e2f1b3..859306a729e5 100644 --- a/brightray/.gitignore +++ b/brightray/.gitignore @@ -2,6 +2,8 @@ /brightray.sdf /brightray.sln /brightray.vcxproj* +/brightray.suo +/brightray.v12.suo /brightray.xcodeproj/ /build/ From 1269e59a352ab94ef44591d52c40fea4970cbf83 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 27 Jun 2014 14:02:44 -0400 Subject: [PATCH 19/29] Update for move of string conversion functions into base:: --- brightray/common/application_info_win.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brightray/common/application_info_win.cc b/brightray/common/application_info_win.cc index 696d8b36b5ee..fd18d54b0ca4 100644 --- a/brightray/common/application_info_win.cc +++ b/brightray/common/application_info_win.cc @@ -10,14 +10,14 @@ std::string GetApplicationName() { auto module = GetModuleHandle(nullptr); auto info = make_scoped_ptr( FileVersionInfo::CreateFileVersionInfoForModule(module)); - return UTF16ToUTF8(info->product_name()); + return base::UTF16ToUTF8(info->product_name()); } std::string GetApplicationVersion() { auto module = GetModuleHandle(nullptr); auto info = make_scoped_ptr( FileVersionInfo::CreateFileVersionInfoForModule(module)); - return UTF16ToUTF8(info->product_version()); + return base::UTF16ToUTF8(info->product_version()); } } // namespace brightray From ae1995f849aac92ec768361e73ad0ae56ee2bdbb Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 12:27:38 -0400 Subject: [PATCH 20/29] Update libchromiumcontent for better Chrome 35 support * vendor/libchromiumcontent ded3c0a...331dbed (2): > Merge pull request #48 from brightray/chrome35-brightray > Merge pull request #49 from brightray/linux-fix --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index ded3c0ad1d36..331dbed44676 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit ded3c0ad1d36cc900d94c7587a88d1b959ebc1c7 +Subproject commit 331dbed44676c534faf21f7db1985e796260649a From 8fd78b3593c9cb19d211bde76e248d9cf94fae39 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 12:28:10 -0400 Subject: [PATCH 21/29] Pull in generated headers from libchromiumcontent ui/views/view.h now includes ui/accessibility/ax_enums.h, which is a generated header. --- brightray/brightray.gyp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 5925fc0f7c16..3f52db663c94 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -15,15 +15,18 @@ '<(libchromiumcontent_include_dir)/skia/config', '<(libchromiumcontent_include_dir)/third_party/skia/include/core', '<(libchromiumcontent_include_dir)/third_party/WebKit', + '<(libchromiumcontent_library_dir)/gen', ], 'direct_dependent_settings': { 'include_dirs': [ + '.', '..', '<(libchromiumcontent_include_dir)', '<(libchromiumcontent_include_dir)/skia/config', '<(libchromiumcontent_include_dir)/third_party/skia/include/core', '<(libchromiumcontent_include_dir)/third_party/icu/source/common', '<(libchromiumcontent_include_dir)/third_party/WebKit', + '<(libchromiumcontent_library_dir)/gen', ], }, 'sources': [ From a1cf58f811a6068aebfa9e2df4b456f62514435b Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 13:53:02 -0400 Subject: [PATCH 22/29] Link against chromiumviews This is needed for InspectableWebContentsViewWin. --- brightray/brightray.gyp | 1 + brightray/brightray.gypi | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 3f52db663c94..d7ae15b9ffc2 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -117,6 +117,7 @@ 'link_settings': { 'libraries': [ '<(brightray_source_root)/<(libchromiumcontent_library_dir)/base_static.lib', + '<(brightray_source_root)/<(libchromiumcontent_library_dir)/chromiumviews.lib', '<(brightray_source_root)/<(libchromiumcontent_library_dir)/chromiumcontent.dll.lib', '<(brightray_source_root)/<(libchromiumcontent_library_dir)/sandbox_static.lib', ], diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index 7edb5f9dbdec..b73a7ea07651 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -72,6 +72,9 @@ 'VCLinkerTool': { 'AdditionalDependencies': [ 'advapi32.lib', + 'dwmapi.lib', + 'gdi32.lib', + 'oleacc.lib', 'user32.lib', ], }, @@ -80,6 +83,8 @@ ['OS=="win"', { 'defines': [ 'USE_AURA', + 'VIEWS_IMPLEMENTATION', + 'WEBVIEW_IMPLEMENTATION', ], }], ['OS not in ["mac", "win"]', { From 6bae1f4b44874299dd7a54abde25c5224479bb8b Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 13:53:24 -0400 Subject: [PATCH 23/29] Set up a native screen on Windows This is needed to prevent a crash inside aura::WindowTreeHost::InitCompositor. --- brightray/browser/browser_main_parts.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index 8601b0426cdb..ceee0d51e6a3 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -7,6 +7,8 @@ #include "browser/browser_context.h" #include "browser/web_ui_controller_factory.h" #include "net/proxy/proxy_resolver_v8.h" +#include "ui/gfx/screen.h" +#include "ui/views/widget/desktop_aura/desktop_screen.h" namespace brightray { @@ -24,6 +26,10 @@ void BrowserMainParts::PreMainMessageLoopRun() { new WebUIControllerFactory(browser_context_.get())); content::WebUIControllerFactory::RegisterFactory( web_ui_controller_factory_.get()); + +#if defined(OS_WIN) + gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); +#endif } void BrowserMainParts::PostMainMessageLoopRun() { From 5b2a62627e3dbe041bd86983b9853a933f1f364c Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 13:55:10 -0400 Subject: [PATCH 24/29] Silence unused variable warning on Windows --- brightray/browser/url_request_context_getter.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 07bbe9f88bb8..ceddfb14acfa 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -154,6 +154,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { end = protocol_handlers_.end(); it != end; ++it) { bool set_protocol = job_factory->SetProtocolHandler( it->first, it->second.release()); + ALLOW_UNUSED(set_protocol); DCHECK(set_protocol); } protocol_handlers_.clear(); From 8f2a2e19b50aaf04a5a443e8815a1af8a2650ed4 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 14:21:40 -0400 Subject: [PATCH 25/29] Really fix unused-variable warnings I misunderstood how ALLOW_UNUSED is meant to be used. Using a macro like MSV_WARNING_SUPPRESS() would be nice, but for some reason it isn't working for me. So now we just manually reference the variable in the code. --- brightray/browser/url_request_context_getter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index ceddfb14acfa..c5cb1061ca9c 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -154,8 +154,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { end = protocol_handlers_.end(); it != end; ++it) { bool set_protocol = job_factory->SetProtocolHandler( it->first, it->second.release()); - ALLOW_UNUSED(set_protocol); DCHECK(set_protocol); + (void)set_protocol; // silence unused-variable warning in Release builds on Windows } protocol_handlers_.clear(); job_factory->SetProtocolHandler( From f65246b3cd8fa2e4601139e921855c935893a807 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 14:27:02 -0400 Subject: [PATCH 26/29] Fix coding style --- brightray/browser/url_request_context_getter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index c5cb1061ca9c..578f5a3047ab 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -155,7 +155,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { bool set_protocol = job_factory->SetProtocolHandler( it->first, it->second.release()); DCHECK(set_protocol); - (void)set_protocol; // silence unused-variable warning in Release builds on Windows + (void)set_protocol; // silence unused-variable warning in Release builds on Windows } protocol_handlers_.clear(); job_factory->SetProtocolHandler( From e86c409e6bca7ac32490999955a1df128b93e5cb Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 14:27:23 -0400 Subject: [PATCH 27/29] Update DevToolsWindow to use views and aura This is required to make it work in Chrome 35. --- brightray/browser/win/devtools_window.cc | 69 +++++++++++-------- brightray/browser/win/devtools_window.h | 22 +++--- .../win/inspectable_web_contents_view_win.cc | 19 ++--- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/brightray/browser/win/devtools_window.cc b/brightray/browser/win/devtools_window.cc index 96d0a3048475..bce83cc5fbdb 100644 --- a/brightray/browser/win/devtools_window.cc +++ b/brightray/browser/win/devtools_window.cc @@ -4,52 +4,63 @@ #include "browser/win/inspectable_web_contents_view_win.h" #include "content/public/browser/web_contents_view.h" -#include "ui/base/win/hidden_window.h" +#include "ui/views/layout/fill_layout.h" +#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" +#include "ui/views/widget/widget_delegate.h" namespace brightray { +namespace { + +class WidgetDelegateView : public views::WidgetDelegateView { + public: + WidgetDelegateView() { + SetLayoutManager(new views::FillLayout); + } + + virtual void DeleteDelegate() OVERRIDE { delete this; } + virtual views::View* GetContentsView() OVERRIDE{ return this; } + virtual bool CanResize() const OVERRIDE { return true; } + virtual bool CanMaximize() const OVERRIDE { return true; } + virtual base::string16 GetWindowTitle() const OVERRIDE { return L"Developer Tools"; } + virtual gfx::Size GetPreferredSize() OVERRIDE { return gfx::Size(800, 600); } + virtual gfx::Size GetMinimumSize() OVERRIDE { return gfx::Size(100, 100); } +}; + +} + DevToolsWindow* DevToolsWindow::Create( InspectableWebContentsViewWin* controller) { return new DevToolsWindow(controller); } DevToolsWindow::DevToolsWindow(InspectableWebContentsViewWin* controller) - : controller_(controller) { + : controller_(controller), + widget_(new views::Widget) { + auto delegate_view = new WidgetDelegateView; + views::Widget::InitParams params; + params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; + params.top_level = true; + params.native_widget = new views::DesktopNativeWidgetAura(widget_.get()); + params.delegate = delegate_view; + widget_->Init(params); + delegate_view->AddChildView(controller->GetView()); + delegate_view->Layout(); } DevToolsWindow::~DevToolsWindow() { } -LRESULT DevToolsWindow::OnCreate(UINT, WPARAM, LPARAM) { - auto devtools_web_contents = - controller_->inspectable_web_contents()->devtools_web_contents(); - SetParent(devtools_web_contents->GetView()->GetNativeView(), hwnd()); - SetWindowText(hwnd(), L"Developer Tools"); - return 0; +void DevToolsWindow::Show() { + widget_->Show(); } -LRESULT DevToolsWindow::OnDestroy(UINT, WPARAM, LPARAM) { - auto devtools_web_contents = - controller_->inspectable_web_contents()->devtools_web_contents(); - SetParent( - devtools_web_contents->GetView()->GetNativeView(), ui::GetHiddenWindow()); +void DevToolsWindow::Close() { + widget_->Hide(); +} + +void DevToolsWindow::Destroy() { delete this; - return 0; -} - -LRESULT DevToolsWindow::OnSize(UINT, WPARAM, LPARAM) { - RECT rect; - GetClientRect(hwnd(), &rect); - - auto devtools_web_contents = - controller_->inspectable_web_contents()->devtools_web_contents(); - SetWindowPos(devtools_web_contents->GetView()->GetNativeView(), - nullptr, - rect.left, rect.top, - rect.right - rect.left, rect.bottom - rect.top, - SWP_NOZORDER | SWP_SHOWWINDOW); - - return 0; } } // namespace brightray diff --git a/brightray/browser/win/devtools_window.h b/brightray/browser/win/devtools_window.h index a7e34d2b738c..33c1a4120bc1 100644 --- a/brightray/browser/win/devtools_window.h +++ b/brightray/browser/win/devtools_window.h @@ -1,35 +1,33 @@ #ifndef BRIGHTRAY_BROWSER_WIN_DEVTOOLS_WINDOW_H_ #define BRIGHTRAY_BROWSER_WIN_DEVTOOLS_WINDOW_H_ +#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "ui/gfx/win/window_impl.h" + +namespace views { +class Widget; +} namespace brightray { class InspectableWebContentsViewWin; -class DevToolsWindow : public gfx::WindowImpl, - public base::SupportsWeakPtr { +class DevToolsWindow : public base::SupportsWeakPtr { public: static DevToolsWindow* Create( InspectableWebContentsViewWin* inspectable_web_contents_view_win); - CR_BEGIN_MSG_MAP_EX(DevToolsWindow) - CR_MESSAGE_HANDLER_EX(WM_CREATE, OnCreate) - CR_MESSAGE_HANDLER_EX(WM_DESTROY, OnDestroy) - CR_MESSAGE_HANDLER_EX(WM_SIZE, OnSize) - CR_END_MSG_MAP() + void Show(); + void Close(); + void Destroy(); private: explicit DevToolsWindow( InspectableWebContentsViewWin* inspectable_web_contents_view_win); ~DevToolsWindow(); - LRESULT OnCreate(UINT message, WPARAM, LPARAM); - LRESULT OnDestroy(UINT message, WPARAM, LPARAM); - LRESULT OnSize(UINT message, WPARAM, LPARAM); - InspectableWebContentsViewWin* controller_; + scoped_ptr widget_; DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); }; diff --git a/brightray/browser/win/inspectable_web_contents_view_win.cc b/brightray/browser/win/inspectable_web_contents_view_win.cc index 24a52b658f7d..641725889bf6 100644 --- a/brightray/browser/win/inspectable_web_contents_view_win.cc +++ b/brightray/browser/win/inspectable_web_contents_view_win.cc @@ -143,7 +143,7 @@ InspectableWebContentsViewWin::InspectableWebContentsViewWin( InspectableWebContentsViewWin::~InspectableWebContentsViewWin() { if (devtools_window_) - DestroyWindow(devtools_window_->hwnd()); + devtools_window_->Destroy(); } views::View* InspectableWebContentsViewWin::GetView() const { @@ -161,19 +161,10 @@ gfx::NativeView InspectableWebContentsViewWin::GetNativeView() const { void InspectableWebContentsViewWin::ShowDevTools() { if (undocked_) { - if (!devtools_window_) { + if (!devtools_window_) devtools_window_ = DevToolsWindow::Create(this)->AsWeakPtr(); - devtools_window_->Init(HWND_DESKTOP, gfx::Rect()); - } - auto contents_view = inspectable_web_contents_->GetWebContents()->GetView(); - auto size = contents_view->GetContainerSize(); - size.Enlarge(-kWindowInset, -kWindowInset); - gfx::CenterAndSizeWindow(contents_view->GetNativeView(), - devtools_window_->hwnd(), - size); - - ShowWindow(devtools_window_->hwnd(), SW_SHOWNORMAL); + devtools_window_->Show(); } else { container_->ShowDevTools(); } @@ -181,7 +172,7 @@ void InspectableWebContentsViewWin::ShowDevTools() { void InspectableWebContentsViewWin::CloseDevTools() { if (undocked_) - SendMessage(devtools_window_->hwnd(), WM_CLOSE, 0, 0); + devtools_window_->Close(); else container_->CloseDevTools(); } @@ -197,7 +188,7 @@ bool InspectableWebContentsViewWin::SetDockSide(const std::string& side) { } else if (side == "right" || side == "bottom") { undocked_ = false; if (devtools_window_) - SendMessage(devtools_window_->hwnd(), WM_CLOSE, 0, 0); + devtools_window_->Close(); container_->SetDockSide(side); } else { return false; From 859051669b15384c4616067e180b1b106ffbf5c7 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 14:40:22 -0400 Subject: [PATCH 28/29] Make sure our copy of gyp is used If gyp is installed on the system, gyp_main.py might find it instead of our own version. --- brightray/script/build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/brightray/script/build b/brightray/script/build index f337c37615b3..30ee528230a4 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -15,7 +15,12 @@ def main(): def run_gyp(): - return subprocess.call([sys.executable, GYP, '--depth', '.', 'brightray.gyp']) + env = os.environ.copy() + gyp_pylib = os.path.join(os.path.dirname(GYP), 'pylib') + env['PYTHONPATH'] = os.path.pathsep.join([gyp_pylib, + env.get('PYTHONPATH', '')]) + return subprocess.call([sys.executable, GYP, '--depth', '.', + 'brightray.gyp'], env=env) def build(): From 8f367f6b35559109761316aa66988c04eeda98ce Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 7 Jul 2014 14:42:30 -0400 Subject: [PATCH 29/29] More coding style fixes --- brightray/browser/win/devtools_window.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brightray/browser/win/devtools_window.cc b/brightray/browser/win/devtools_window.cc index bce83cc5fbdb..59857057d5a4 100644 --- a/brightray/browser/win/devtools_window.cc +++ b/brightray/browser/win/devtools_window.cc @@ -19,7 +19,7 @@ class WidgetDelegateView : public views::WidgetDelegateView { } virtual void DeleteDelegate() OVERRIDE { delete this; } - virtual views::View* GetContentsView() OVERRIDE{ return this; } + virtual views::View* GetContentsView() OVERRIDE { return this; } virtual bool CanResize() const OVERRIDE { return true; } virtual bool CanMaximize() const OVERRIDE { return true; } virtual base::string16 GetWindowTitle() const OVERRIDE { return L"Developer Tools"; } @@ -27,7 +27,7 @@ class WidgetDelegateView : public views::WidgetDelegateView { virtual gfx::Size GetMinimumSize() OVERRIDE { return gfx::Size(100, 100); } }; -} +} // namespace DevToolsWindow* DevToolsWindow::Create( InspectableWebContentsViewWin* controller) {