commit
6c825042b5
24 changed files with 236 additions and 178 deletions
2
brightray/.gitignore
vendored
2
brightray/.gitignore
vendored
|
@ -2,6 +2,8 @@
|
||||||
/brightray.sdf
|
/brightray.sdf
|
||||||
/brightray.sln
|
/brightray.sln
|
||||||
/brightray.vcxproj*
|
/brightray.vcxproj*
|
||||||
|
/brightray.suo
|
||||||
|
/brightray.v12.suo
|
||||||
/brightray.xcodeproj/
|
/brightray.xcodeproj/
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,21 @@
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'.',
|
'.',
|
||||||
'<(libchromiumcontent_include_dir)',
|
'<(libchromiumcontent_include_dir)',
|
||||||
'<(libchromiumcontent_include_dir)/third_party/skia/include/config',
|
'<(libchromiumcontent_include_dir)/skia/config',
|
||||||
'<(libchromiumcontent_include_dir)/third_party/skia/include/core',
|
'<(libchromiumcontent_include_dir)/third_party/skia/include/core',
|
||||||
|
'<(libchromiumcontent_include_dir)/third_party/WebKit',
|
||||||
|
'<(libchromiumcontent_library_dir)/gen',
|
||||||
],
|
],
|
||||||
'direct_dependent_settings': {
|
'direct_dependent_settings': {
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
|
'.',
|
||||||
'..',
|
'..',
|
||||||
'<(libchromiumcontent_include_dir)',
|
'<(libchromiumcontent_include_dir)',
|
||||||
'<(libchromiumcontent_include_dir)/third_party/skia/include/config',
|
'<(libchromiumcontent_include_dir)/skia/config',
|
||||||
# For SkMatrix.h.
|
|
||||||
'<(libchromiumcontent_include_dir)/third_party/skia/include/core',
|
'<(libchromiumcontent_include_dir)/third_party/skia/include/core',
|
||||||
'<(libchromiumcontent_include_dir)/third_party/icu/source/common',
|
'<(libchromiumcontent_include_dir)/third_party/icu/source/common',
|
||||||
|
'<(libchromiumcontent_include_dir)/third_party/WebKit',
|
||||||
|
'<(libchromiumcontent_library_dir)/gen',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'sources': [
|
'sources': [
|
||||||
|
@ -113,6 +117,7 @@
|
||||||
'link_settings': {
|
'link_settings': {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/base_static.lib',
|
'<(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)/chromiumcontent.dll.lib',
|
||||||
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/sandbox_static.lib',
|
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/sandbox_static.lib',
|
||||||
],
|
],
|
||||||
|
|
|
@ -72,11 +72,21 @@
|
||||||
'VCLinkerTool': {
|
'VCLinkerTool': {
|
||||||
'AdditionalDependencies': [
|
'AdditionalDependencies': [
|
||||||
'advapi32.lib',
|
'advapi32.lib',
|
||||||
|
'dwmapi.lib',
|
||||||
|
'gdi32.lib',
|
||||||
|
'oleacc.lib',
|
||||||
'user32.lib',
|
'user32.lib',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'conditions': [
|
'conditions': [
|
||||||
|
['OS=="win"', {
|
||||||
|
'defines': [
|
||||||
|
'USE_AURA',
|
||||||
|
'VIEWS_IMPLEMENTATION',
|
||||||
|
'WEBVIEW_IMPLEMENTATION',
|
||||||
|
],
|
||||||
|
}],
|
||||||
['OS not in ["mac", "win"]', {
|
['OS not in ["mac", "win"]', {
|
||||||
'defines': [
|
'defines': [
|
||||||
'USE_X11',
|
'USE_X11',
|
||||||
|
|
|
@ -56,9 +56,10 @@ content::BrowserMainParts* BrowserClient::CreateBrowserMainParts(
|
||||||
|
|
||||||
net::URLRequestContextGetter* BrowserClient::CreateRequestContext(
|
net::URLRequestContextGetter* BrowserClient::CreateRequestContext(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
content::ProtocolHandlerMap* protocol_handlers) {
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
|
content::ProtocolHandlerScopedVector protocol_interceptors) {
|
||||||
auto context = static_cast<BrowserContext*>(browser_context);
|
auto context = static_cast<BrowserContext*>(browser_context);
|
||||||
return context->CreateRequestContext(protocol_handlers);
|
return context->CreateRequestContext(protocol_handlers, protocol_interceptors.Pass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserClient::ShowDesktopNotification(
|
void BrowserClient::ShowDesktopNotification(
|
||||||
|
|
|
@ -34,7 +34,9 @@ class BrowserClient : public content::ContentBrowserClient {
|
||||||
// Subclasses that override this (e.g., to provide their own protocol
|
// Subclasses that override this (e.g., to provide their own protocol
|
||||||
// handlers) should call this implementation after doing their own work.
|
// handlers) should call this implementation after doing their own work.
|
||||||
virtual net::URLRequestContextGetter* CreateRequestContext(
|
virtual net::URLRequestContextGetter* CreateRequestContext(
|
||||||
content::BrowserContext*, content::ProtocolHandlerMap*) OVERRIDE;
|
content::BrowserContext* browser_context,
|
||||||
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
|
content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual content::BrowserMainParts* CreateBrowserMainParts(
|
virtual content::BrowserMainParts* CreateBrowserMainParts(
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "base/prefs/json_pref_store.h"
|
#include "base/prefs/json_pref_store.h"
|
||||||
#include "base/prefs/pref_registry_simple.h"
|
#include "base/prefs/pref_registry_simple.h"
|
||||||
#include "base/prefs/pref_service.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/browser_thread.h"
|
||||||
#include "content/public/browser/resource_context.h"
|
#include "content/public/browser/resource_context.h"
|
||||||
#include "content/public/browser/storage_partition.h"
|
#include "content/public/browser/storage_partition.h"
|
||||||
|
@ -76,8 +76,8 @@ void BrowserContext::Initialize() {
|
||||||
path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
|
path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
|
||||||
|
|
||||||
auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences"));
|
auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences"));
|
||||||
PrefServiceBuilder builder;
|
base::PrefServiceFactory prefs_factory;
|
||||||
builder.WithUserFilePrefs(prefs_path,
|
prefs_factory.SetUserPrefsFile(prefs_path,
|
||||||
JsonPrefStore::GetTaskRunnerForFile(
|
JsonPrefStore::GetTaskRunnerForFile(
|
||||||
prefs_path, content::BrowserThread::GetBlockingPool()));
|
prefs_path, content::BrowserThread::GetBlockingPool()));
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void BrowserContext::Initialize() {
|
||||||
RegisterInternalPrefs(registry);
|
RegisterInternalPrefs(registry);
|
||||||
RegisterPrefs(registry);
|
RegisterPrefs(registry);
|
||||||
|
|
||||||
prefs_.reset(builder.Create(registry));
|
prefs_ = prefs_factory.Create(registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserContext::~BrowserContext() {
|
BrowserContext::~BrowserContext() {
|
||||||
|
@ -99,7 +99,8 @@ void BrowserContext::RegisterInternalPrefs(PrefRegistrySimple* registry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
|
net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
|
||||||
content::ProtocolHandlerMap* protocol_handlers) {
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
|
content::ProtocolHandlerScopedVector protocol_interceptors) {
|
||||||
DCHECK(!url_request_getter_);
|
DCHECK(!url_request_getter_);
|
||||||
auto io_loop = content::BrowserThread::UnsafeGetMessageLoopForThread(
|
auto io_loop = content::BrowserThread::UnsafeGetMessageLoopForThread(
|
||||||
content::BrowserThread::IO);
|
content::BrowserThread::IO);
|
||||||
|
@ -110,7 +111,8 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
|
||||||
io_loop,
|
io_loop,
|
||||||
file_loop,
|
file_loop,
|
||||||
base::Bind(&BrowserContext::CreateNetworkDelegate, base::Unretained(this)),
|
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());
|
resource_context_->set_url_request_context_getter(url_request_getter_.get());
|
||||||
return url_request_getter_.get();
|
return url_request_getter_.get();
|
||||||
}
|
}
|
||||||
|
@ -153,14 +155,36 @@ net::URLRequestContextGetter*
|
||||||
return GetRequestContext();
|
return GetRequestContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserContext::RequestMIDISysExPermission(
|
void BrowserContext::RequestMidiSysExPermission(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_view_id,
|
int render_view_id,
|
||||||
|
int bridge_id,
|
||||||
const GURL& requesting_frame,
|
const GURL& requesting_frame,
|
||||||
const MIDISysExPermissionCallback& callback) {
|
bool user_gesture,
|
||||||
|
const MidiSysExPermissionCallback& callback) {
|
||||||
callback.Run(false);
|
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() {
|
content::ResourceContext* BrowserContext::GetResourceContext() {
|
||||||
return resource_context_.get();
|
return resource_context_.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ class BrowserContext : public content::BrowserContext {
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
|
|
||||||
net::URLRequestContextGetter* CreateRequestContext(
|
net::URLRequestContextGetter* CreateRequestContext(
|
||||||
content::ProtocolHandlerMap*);
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
|
content::ProtocolHandlerScopedVector protocol_interceptors);
|
||||||
|
|
||||||
PrefService* prefs() { return prefs_.get(); }
|
PrefService* prefs() { return prefs_.get(); }
|
||||||
|
|
||||||
|
@ -54,11 +55,26 @@ class BrowserContext : public content::BrowserContext {
|
||||||
virtual net::URLRequestContextGetter*
|
virtual net::URLRequestContextGetter*
|
||||||
GetMediaRequestContextForStoragePartition(
|
GetMediaRequestContextForStoragePartition(
|
||||||
const base::FilePath& partition_path, bool in_memory);
|
const base::FilePath& partition_path, bool in_memory);
|
||||||
virtual void RequestMIDISysExPermission(
|
virtual void RequestMidiSysExPermission(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_view_id,
|
int render_view_id,
|
||||||
|
int bridge_id,
|
||||||
const GURL& requesting_frame,
|
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::ResourceContext* GetResourceContext() OVERRIDE;
|
||||||
virtual content::DownloadManagerDelegate*
|
virtual content::DownloadManagerDelegate*
|
||||||
GetDownloadManagerDelegate() OVERRIDE;
|
GetDownloadManagerDelegate() OVERRIDE;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "browser/browser_context.h"
|
#include "browser/browser_context.h"
|
||||||
#include "browser/web_ui_controller_factory.h"
|
#include "browser/web_ui_controller_factory.h"
|
||||||
#include "net/proxy/proxy_resolver_v8.h"
|
#include "net/proxy/proxy_resolver_v8.h"
|
||||||
|
#include "ui/gfx/screen.h"
|
||||||
|
#include "ui/views/widget/desktop_aura/desktop_screen.h"
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
@ -24,6 +26,10 @@ void BrowserMainParts::PreMainMessageLoopRun() {
|
||||||
new WebUIControllerFactory(browser_context_.get()));
|
new WebUIControllerFactory(browser_context_.get()));
|
||||||
content::WebUIControllerFactory::RegisterFactory(
|
content::WebUIControllerFactory::RegisterFactory(
|
||||||
web_ui_controller_factory_.get());
|
web_ui_controller_factory_.get());
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserMainParts::PostMainMessageLoopRun() {
|
void BrowserMainParts::PostMainMessageLoopRun() {
|
||||||
|
|
|
@ -117,7 +117,7 @@ void InspectableWebContentsImpl::UpdateFrontendDockSide() {
|
||||||
auto javascript = base::StringPrintf(
|
auto javascript = base::StringPrintf(
|
||||||
"InspectorFrontendAPI.setDockSide(\"%s\")", dock_side_.c_str());
|
"InspectorFrontendAPI.setDockSide(\"%s\")", dock_side_.c_str());
|
||||||
devtools_web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
|
devtools_web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
|
||||||
string16(), ASCIIToUTF16(javascript));
|
base::string16(), base::ASCIIToUTF16(javascript));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::ActivateWindow() {
|
void InspectableWebContentsImpl::ActivateWindow() {
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/media_devices_monitor.h"
|
#include "content/public/browser/media_capture_devices.h"
|
||||||
#include "content/public/common/desktop_media_id.h"
|
|
||||||
#include "content/public/common/media_stream_request.h"
|
#include "content/public/common/media_stream_request.h"
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
@ -30,6 +29,11 @@ const content::MediaStreamDevice* FindDeviceWithId(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MediaStreamDevices& EmptyDevices() {
|
||||||
|
static MediaStreamDevices* devices = new MediaStreamDevices;
|
||||||
|
return *devices;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() {
|
MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() {
|
||||||
|
@ -37,8 +41,7 @@ MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher()
|
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher()
|
||||||
: devices_enumerated_(false),
|
: is_device_enumeration_disabled_(false) {
|
||||||
is_device_enumeration_disabled_(false) {
|
|
||||||
// MediaCaptureDevicesDispatcher is a singleton. It should be created on
|
// MediaCaptureDevicesDispatcher is a singleton. It should be created on
|
||||||
// UI thread.
|
// UI thread.
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
|
@ -49,21 +52,17 @@ MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {}
|
||||||
const MediaStreamDevices&
|
const MediaStreamDevices&
|
||||||
MediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
|
MediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
if (!is_device_enumeration_disabled_ && !devices_enumerated_) {
|
if (is_device_enumeration_disabled_)
|
||||||
content::EnsureMonitorCaptureDevices();
|
return EmptyDevices();
|
||||||
devices_enumerated_ = true;
|
return content::MediaCaptureDevices::GetInstance()->GetAudioCaptureDevices();
|
||||||
}
|
|
||||||
return audio_devices_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MediaStreamDevices&
|
const MediaStreamDevices&
|
||||||
MediaCaptureDevicesDispatcher::GetVideoCaptureDevices() {
|
MediaCaptureDevicesDispatcher::GetVideoCaptureDevices() {
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
if (!is_device_enumeration_disabled_ && !devices_enumerated_) {
|
if (is_device_enumeration_disabled_)
|
||||||
content::EnsureMonitorCaptureDevices();
|
return EmptyDevices();
|
||||||
devices_enumerated_ = true;
|
return content::MediaCaptureDevices::GetInstance()->GetVideoCaptureDevices();
|
||||||
}
|
|
||||||
return video_devices_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaCaptureDevicesDispatcher::GetDefaultDevices(
|
void MediaCaptureDevicesDispatcher::GetDefaultDevices(
|
||||||
|
@ -128,36 +127,33 @@ void MediaCaptureDevicesDispatcher::DisableDeviceEnumerationForTesting() {
|
||||||
is_device_enumeration_disabled_ = true;
|
is_device_enumeration_disabled_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged(
|
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::OnVideoCaptureDevicesChanged(
|
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::OnMediaRequestStateChanged(
|
void MediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_view_id,
|
int render_view_id,
|
||||||
int page_request_id,
|
int page_request_id,
|
||||||
|
const GURL& security_origin,
|
||||||
const content::MediaStreamDevice& device,
|
const content::MediaStreamDevice& device,
|
||||||
content::MediaRequestState state) {
|
content::MediaRequestState state) {
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaCaptureDevicesDispatcher::OnAudioStreamPlayingChanged(
|
void MediaCaptureDevicesDispatcher::OnAudioStreamPlaying(
|
||||||
int render_process_id, int render_view_id, int stream_id,
|
int render_process_id,
|
||||||
bool is_playing, float power_dbfs, bool clipped) {
|
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(
|
void MediaCaptureDevicesDispatcher::OnCreatingAudioStream(
|
||||||
|
@ -166,18 +162,4 @@ void MediaCaptureDevicesDispatcher::OnCreatingAudioStream(
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
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
|
} // namespace brightray
|
||||||
|
|
|
@ -51,23 +51,24 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||||
void DisableDeviceEnumerationForTesting();
|
void DisableDeviceEnumerationForTesting();
|
||||||
|
|
||||||
// Overridden from content::MediaObserver:
|
// Overridden from content::MediaObserver:
|
||||||
virtual void OnAudioCaptureDevicesChanged(
|
virtual void OnAudioCaptureDevicesChanged() OVERRIDE;
|
||||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
virtual void OnVideoCaptureDevicesChanged() OVERRIDE;
|
||||||
virtual void OnVideoCaptureDevicesChanged(
|
|
||||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
|
||||||
virtual void OnMediaRequestStateChanged(
|
virtual void OnMediaRequestStateChanged(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_view_id,
|
int render_view_id,
|
||||||
int page_request_id,
|
int page_request_id,
|
||||||
|
const GURL& security_origin,
|
||||||
const content::MediaStreamDevice& device,
|
const content::MediaStreamDevice& device,
|
||||||
content::MediaRequestState state) OVERRIDE;
|
content::MediaRequestState state) OVERRIDE;
|
||||||
virtual void OnAudioStreamPlayingChanged(
|
virtual void OnAudioStreamPlaying(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_view_id,
|
int render_frame_id,
|
||||||
int stream_id,
|
int stream_id,
|
||||||
bool is_playing,
|
const ReadPowerAndClipCallback& power_read_callback) OVERRIDE;
|
||||||
float power_dBFS,
|
virtual void OnAudioStreamStopped(
|
||||||
bool clipped) OVERRIDE;
|
int render_process_id,
|
||||||
|
int render_frame_id,
|
||||||
|
int stream_id) OVERRIDE;
|
||||||
virtual void OnCreatingAudioStream(int render_process_id,
|
virtual void OnCreatingAudioStream(int render_process_id,
|
||||||
int render_view_id) OVERRIDE;
|
int render_view_id) OVERRIDE;
|
||||||
|
|
||||||
|
@ -77,20 +78,6 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||||
MediaCaptureDevicesDispatcher();
|
MediaCaptureDevicesDispatcher();
|
||||||
virtual ~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.
|
// Flag used by unittests to disable device enumeration.
|
||||||
bool is_device_enumeration_disabled_;
|
bool is_device_enumeration_disabled_;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ MediaStreamDevicesController::MediaStreamDevicesController(
|
||||||
MediaStreamDevicesController::~MediaStreamDevicesController() {
|
MediaStreamDevicesController::~MediaStreamDevicesController() {
|
||||||
if (!callback_.is_null()) {
|
if (!callback_.is_null()) {
|
||||||
callback_.Run(content::MediaStreamDevices(),
|
callback_.Run(content::MediaStreamDevices(),
|
||||||
|
content::MEDIA_DEVICE_INVALID_STATE,
|
||||||
scoped_ptr<content::MediaStreamUI>());
|
scoped_ptr<content::MediaStreamUI>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,13 +151,15 @@ void MediaStreamDevicesController::Accept() {
|
||||||
|
|
||||||
content::MediaResponseCallback cb = callback_;
|
content::MediaResponseCallback cb = callback_;
|
||||||
callback_.Reset();
|
callback_.Reset();
|
||||||
cb.Run(devices, scoped_ptr<content::MediaStreamUI>());
|
cb.Run(devices, content::MEDIA_DEVICE_OK, scoped_ptr<content::MediaStreamUI>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaStreamDevicesController::Deny() {
|
void MediaStreamDevicesController::Deny() {
|
||||||
content::MediaResponseCallback cb = callback_;
|
content::MediaResponseCallback cb = callback_;
|
||||||
callback_.Reset();
|
callback_.Reset();
|
||||||
cb.Run(content::MediaStreamDevices(), scoped_ptr<content::MediaStreamUI>());
|
cb.Run(content::MediaStreamDevices(),
|
||||||
|
content::MEDIA_DEVICE_PERMISSION_DENIED,
|
||||||
|
scoped_ptr<content::MediaStreamUI>());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -37,7 +37,8 @@ int NetworkDelegate::OnHeadersReceived(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
const net::CompletionCallback& callback,
|
||||||
const net::HttpResponseHeaders* original_response_headers,
|
const net::HttpResponseHeaders* original_response_headers,
|
||||||
scoped_refptr<net::HttpResponseHeaders>* override_response_headers) {
|
scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
|
||||||
|
GURL* allowed_unsafe_redirect_url) {
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ void NetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkDelegate::OnPACScriptError(int line_number,
|
void NetworkDelegate::OnPACScriptError(int line_number,
|
||||||
const string16& error) {
|
const base::string16& error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkDelegate::AuthRequiredResponse NetworkDelegate::OnAuthRequired(
|
NetworkDelegate::AuthRequiredResponse NetworkDelegate::OnAuthRequired(
|
||||||
|
@ -97,9 +98,4 @@ int NetworkDelegate::OnBeforeSocketStreamConnect(
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkDelegate::OnRequestWaitStateChange(
|
|
||||||
const net::URLRequest& request,
|
|
||||||
RequestWaitState waiting) {
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -27,8 +27,8 @@ class NetworkDelegate : public net::NetworkDelegate {
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
const net::CompletionCallback& callback,
|
||||||
const net::HttpResponseHeaders* original_response_headers,
|
const net::HttpResponseHeaders* original_response_headers,
|
||||||
scoped_refptr<net::HttpResponseHeaders>*
|
scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
|
||||||
override_response_headers) OVERRIDE;
|
GURL* allowed_unsafe_redirect_url) OVERRIDE;
|
||||||
virtual void OnBeforeRedirect(net::URLRequest* request,
|
virtual void OnBeforeRedirect(net::URLRequest* request,
|
||||||
const GURL& new_location) OVERRIDE;
|
const GURL& new_location) OVERRIDE;
|
||||||
virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
|
virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
|
||||||
|
@ -37,7 +37,7 @@ class NetworkDelegate : public net::NetworkDelegate {
|
||||||
virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE;
|
virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE;
|
||||||
virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE;
|
virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE;
|
||||||
virtual void OnPACScriptError(int line_number,
|
virtual void OnPACScriptError(int line_number,
|
||||||
const string16& error) OVERRIDE;
|
const base::string16& error) OVERRIDE;
|
||||||
virtual AuthRequiredResponse OnAuthRequired(
|
virtual AuthRequiredResponse OnAuthRequired(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::AuthChallengeInfo& auth_info,
|
const net::AuthChallengeInfo& auth_info,
|
||||||
|
@ -55,8 +55,6 @@ class NetworkDelegate : public net::NetworkDelegate {
|
||||||
virtual int OnBeforeSocketStreamConnect(
|
virtual int OnBeforeSocketStreamConnect(
|
||||||
net::SocketStream* stream,
|
net::SocketStream* stream,
|
||||||
const net::CompletionCallback& callback) OVERRIDE;
|
const net::CompletionCallback& callback) OVERRIDE;
|
||||||
virtual void OnRequestWaitStateChange(const net::URLRequest& request,
|
|
||||||
RequestWaitState state) OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(NetworkDelegate);
|
DISALLOW_COPY_AND_ASSIGN(NetworkDelegate);
|
||||||
|
|
|
@ -29,10 +29,12 @@
|
||||||
#include "net/ssl/ssl_config_service_defaults.h"
|
#include "net/ssl/ssl_config_service_defaults.h"
|
||||||
#include "net/url_request/data_protocol_handler.h"
|
#include "net/url_request/data_protocol_handler.h"
|
||||||
#include "net/url_request/file_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/static_http_user_agent_settings.h"
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
#include "net/url_request/url_request_context_storage.h"
|
#include "net/url_request/url_request_context_storage.h"
|
||||||
#include "net/url_request/url_request_job_factory_impl.h"
|
#include "net/url_request/url_request_job_factory_impl.h"
|
||||||
|
#include "webkit/browser/quota/special_storage_policy.h"
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
@ -41,11 +43,13 @@ URLRequestContextGetter::URLRequestContextGetter(
|
||||||
base::MessageLoop* io_loop,
|
base::MessageLoop* io_loop,
|
||||||
base::MessageLoop* file_loop,
|
base::MessageLoop* file_loop,
|
||||||
base::Callback<scoped_ptr<NetworkDelegate>(void)> network_delegate_factory,
|
base::Callback<scoped_ptr<NetworkDelegate>(void)> network_delegate_factory,
|
||||||
content::ProtocolHandlerMap* protocol_handlers)
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
|
content::ProtocolHandlerScopedVector protocol_interceptors)
|
||||||
: base_path_(base_path),
|
: base_path_(base_path),
|
||||||
io_loop_(io_loop),
|
io_loop_(io_loop),
|
||||||
file_loop_(file_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.
|
// Must first be created on the UI thread.
|
||||||
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
||||||
|
|
||||||
|
@ -71,18 +75,18 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
url_request_context_->set_network_delegate(network_delegate_.get());
|
url_request_context_->set_network_delegate(network_delegate_.get());
|
||||||
storage_.reset(
|
storage_.reset(
|
||||||
new net::URLRequestContextStorage(url_request_context_.get()));
|
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")),
|
base_path_.Append(FILE_PATH_LITERAL("Cookies")),
|
||||||
false,
|
content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr);
|
||||||
nullptr));
|
storage_->set_cookie_store(content::CreateCookieStore(cookie_config));
|
||||||
storage_->set_server_bound_cert_service(new net::ServerBoundCertService(
|
storage_->set_server_bound_cert_service(new net::ServerBoundCertService(
|
||||||
new net::DefaultServerBoundCertStore(NULL),
|
new net::DefaultServerBoundCertStore(NULL),
|
||||||
base::WorkerPool::GetTaskRunner(true)));
|
base::WorkerPool::GetTaskRunner(true)));
|
||||||
storage_->set_http_user_agent_settings(
|
storage_->set_http_user_agent_settings(
|
||||||
new net::StaticHttpUserAgentSettings(
|
new net::StaticHttpUserAgentSettings(
|
||||||
"en-us,en", EmptyString()));
|
"en-us,en", base::EmptyString()));
|
||||||
|
|
||||||
scoped_ptr<net::HostResolver> host_resolver(
|
scoped_ptr<net::HostResolver> host_resolver(
|
||||||
net::HostResolver::CreateDefaultResolver(NULL));
|
net::HostResolver::CreateDefaultResolver(NULL));
|
||||||
|
@ -151,17 +155,31 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
bool set_protocol = job_factory->SetProtocolHandler(
|
bool set_protocol = job_factory->SetProtocolHandler(
|
||||||
it->first, it->second.release());
|
it->first, it->second.release());
|
||||||
DCHECK(set_protocol);
|
DCHECK(set_protocol);
|
||||||
|
(void)set_protocol; // silence unused-variable warning in Release builds on Windows
|
||||||
}
|
}
|
||||||
protocol_handlers_.clear();
|
protocol_handlers_.clear();
|
||||||
job_factory->SetProtocolHandler(
|
job_factory->SetProtocolHandler(
|
||||||
chrome::kDataScheme, new net::DataProtocolHandler);
|
content::kDataScheme, new net::DataProtocolHandler);
|
||||||
job_factory->SetProtocolHandler(
|
job_factory->SetProtocolHandler(
|
||||||
chrome::kFileScheme,
|
content::kFileScheme,
|
||||||
new net::FileProtocolHandler(
|
new net::FileProtocolHandler(
|
||||||
content::BrowserThread::GetBlockingPool()->
|
content::BrowserThread::GetBlockingPool()->
|
||||||
GetTaskRunnerWithShutdownBehavior(
|
GetTaskRunnerWithShutdownBehavior(
|
||||||
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
|
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
|
||||||
storage_->set_job_factory(job_factory.release());
|
|
||||||
|
// Set up interceptors in the reverse order.
|
||||||
|
scoped_ptr<net::URLRequestJobFactory> top_job_factory =
|
||||||
|
job_factory.PassAs<net::URLRequestJobFactory>();
|
||||||
|
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();
|
return url_request_context_.get();
|
||||||
|
|
|
@ -32,7 +32,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||||
base::MessageLoop* io_loop,
|
base::MessageLoop* io_loop,
|
||||||
base::MessageLoop* file_loop,
|
base::MessageLoop* file_loop,
|
||||||
base::Callback<scoped_ptr<NetworkDelegate>(void)>,
|
base::Callback<scoped_ptr<NetworkDelegate>(void)>,
|
||||||
content::ProtocolHandlerMap*);
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
|
content::ProtocolHandlerScopedVector protocol_interceptors);
|
||||||
virtual ~URLRequestContextGetter();
|
virtual ~URLRequestContextGetter();
|
||||||
|
|
||||||
net::HostResolver* host_resolver();
|
net::HostResolver* host_resolver();
|
||||||
|
@ -53,6 +54,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||||
scoped_ptr<net::URLRequestContextStorage> storage_;
|
scoped_ptr<net::URLRequestContextStorage> storage_;
|
||||||
scoped_ptr<net::URLRequestContext> url_request_context_;
|
scoped_ptr<net::URLRequestContext> url_request_context_;
|
||||||
content::ProtocolHandlerMap protocol_handlers_;
|
content::ProtocolHandlerMap protocol_handlers_;
|
||||||
|
content::ProtocolHandlerScopedVector protocol_interceptors_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
|
DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,52 +4,63 @@
|
||||||
#include "browser/win/inspectable_web_contents_view_win.h"
|
#include "browser/win/inspectable_web_contents_view_win.h"
|
||||||
|
|
||||||
#include "content/public/browser/web_contents_view.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 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); }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
DevToolsWindow* DevToolsWindow::Create(
|
DevToolsWindow* DevToolsWindow::Create(
|
||||||
InspectableWebContentsViewWin* controller) {
|
InspectableWebContentsViewWin* controller) {
|
||||||
return new DevToolsWindow(controller);
|
return new DevToolsWindow(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
DevToolsWindow::DevToolsWindow(InspectableWebContentsViewWin* 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() {
|
DevToolsWindow::~DevToolsWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT DevToolsWindow::OnCreate(UINT, WPARAM, LPARAM, BOOL&) {
|
void DevToolsWindow::Show() {
|
||||||
auto devtools_web_contents =
|
widget_->Show();
|
||||||
controller_->inspectable_web_contents()->devtools_web_contents();
|
|
||||||
SetParent(devtools_web_contents->GetView()->GetNativeView(), hwnd());
|
|
||||||
SetWindowText(hwnd(), L"Developer Tools");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT DevToolsWindow::OnDestroy(UINT, WPARAM, LPARAM, BOOL&) {
|
void DevToolsWindow::Close() {
|
||||||
auto devtools_web_contents =
|
widget_->Hide();
|
||||||
controller_->inspectable_web_contents()->devtools_web_contents();
|
}
|
||||||
SetParent(
|
|
||||||
devtools_web_contents->GetView()->GetNativeView(), ui::GetHiddenWindow());
|
void DevToolsWindow::Destroy() {
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT DevToolsWindow::OnSize(UINT, WPARAM, LPARAM, BOOL&) {
|
|
||||||
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
|
} // namespace brightray
|
||||||
|
|
|
@ -1,35 +1,33 @@
|
||||||
#ifndef BRIGHTRAY_BROWSER_WIN_DEVTOOLS_WINDOW_H_
|
#ifndef BRIGHTRAY_BROWSER_WIN_DEVTOOLS_WINDOW_H_
|
||||||
#define 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 "base/memory/weak_ptr.h"
|
||||||
#include "ui/gfx/win/window_impl.h"
|
|
||||||
|
namespace views {
|
||||||
|
class Widget;
|
||||||
|
}
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
class InspectableWebContentsViewWin;
|
class InspectableWebContentsViewWin;
|
||||||
|
|
||||||
class DevToolsWindow : public gfx::WindowImpl,
|
class DevToolsWindow : public base::SupportsWeakPtr<DevToolsWindow> {
|
||||||
public base::SupportsWeakPtr<DevToolsWindow> {
|
|
||||||
public:
|
public:
|
||||||
static DevToolsWindow* Create(
|
static DevToolsWindow* Create(
|
||||||
InspectableWebContentsViewWin* inspectable_web_contents_view_win);
|
InspectableWebContentsViewWin* inspectable_web_contents_view_win);
|
||||||
|
|
||||||
BEGIN_MSG_MAP_EX(DevToolsWindow)
|
void Show();
|
||||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
void Close();
|
||||||
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
|
void Destroy();
|
||||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
|
||||||
END_MSG_MAP()
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit DevToolsWindow(
|
explicit DevToolsWindow(
|
||||||
InspectableWebContentsViewWin* inspectable_web_contents_view_win);
|
InspectableWebContentsViewWin* inspectable_web_contents_view_win);
|
||||||
~DevToolsWindow();
|
~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);
|
|
||||||
|
|
||||||
InspectableWebContentsViewWin* controller_;
|
InspectableWebContentsViewWin* controller_;
|
||||||
|
scoped_ptr<views::Widget> widget_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(DevToolsWindow);
|
DISALLOW_COPY_AND_ASSIGN(DevToolsWindow);
|
||||||
};
|
};
|
||||||
|
|
|
@ -143,7 +143,7 @@ InspectableWebContentsViewWin::InspectableWebContentsViewWin(
|
||||||
|
|
||||||
InspectableWebContentsViewWin::~InspectableWebContentsViewWin() {
|
InspectableWebContentsViewWin::~InspectableWebContentsViewWin() {
|
||||||
if (devtools_window_)
|
if (devtools_window_)
|
||||||
DestroyWindow(devtools_window_->hwnd());
|
devtools_window_->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
views::View* InspectableWebContentsViewWin::GetView() const {
|
views::View* InspectableWebContentsViewWin::GetView() const {
|
||||||
|
@ -161,19 +161,10 @@ gfx::NativeView InspectableWebContentsViewWin::GetNativeView() const {
|
||||||
|
|
||||||
void InspectableWebContentsViewWin::ShowDevTools() {
|
void InspectableWebContentsViewWin::ShowDevTools() {
|
||||||
if (undocked_) {
|
if (undocked_) {
|
||||||
if (!devtools_window_) {
|
if (!devtools_window_)
|
||||||
devtools_window_ = DevToolsWindow::Create(this)->AsWeakPtr();
|
devtools_window_ = DevToolsWindow::Create(this)->AsWeakPtr();
|
||||||
devtools_window_->Init(HWND_DESKTOP, gfx::Rect());
|
|
||||||
}
|
|
||||||
|
|
||||||
auto contents_view = inspectable_web_contents_->GetWebContents()->GetView();
|
devtools_window_->Show();
|
||||||
auto size = contents_view->GetContainerSize();
|
|
||||||
size.Enlarge(-kWindowInset, -kWindowInset);
|
|
||||||
gfx::CenterAndSizeWindow(contents_view->GetNativeView(),
|
|
||||||
devtools_window_->hwnd(),
|
|
||||||
size);
|
|
||||||
|
|
||||||
ShowWindow(devtools_window_->hwnd(), SW_SHOWNORMAL);
|
|
||||||
} else {
|
} else {
|
||||||
container_->ShowDevTools();
|
container_->ShowDevTools();
|
||||||
}
|
}
|
||||||
|
@ -181,7 +172,7 @@ void InspectableWebContentsViewWin::ShowDevTools() {
|
||||||
|
|
||||||
void InspectableWebContentsViewWin::CloseDevTools() {
|
void InspectableWebContentsViewWin::CloseDevTools() {
|
||||||
if (undocked_)
|
if (undocked_)
|
||||||
SendMessage(devtools_window_->hwnd(), WM_CLOSE, 0, 0);
|
devtools_window_->Close();
|
||||||
else
|
else
|
||||||
container_->CloseDevTools();
|
container_->CloseDevTools();
|
||||||
}
|
}
|
||||||
|
@ -197,7 +188,7 @@ bool InspectableWebContentsViewWin::SetDockSide(const std::string& side) {
|
||||||
} else if (side == "right" || side == "bottom") {
|
} else if (side == "right" || side == "bottom") {
|
||||||
undocked_ = false;
|
undocked_ = false;
|
||||||
if (devtools_window_)
|
if (devtools_window_)
|
||||||
SendMessage(devtools_window_->hwnd(), WM_CLOSE, 0, 0);
|
devtools_window_->Close();
|
||||||
container_->SetDockSide(side);
|
container_->SetDockSide(side);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -10,14 +10,14 @@ std::string GetApplicationName() {
|
||||||
auto module = GetModuleHandle(nullptr);
|
auto module = GetModuleHandle(nullptr);
|
||||||
auto info = make_scoped_ptr(
|
auto info = make_scoped_ptr(
|
||||||
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
||||||
return UTF16ToUTF8(info->product_name());
|
return base::UTF16ToUTF8(info->product_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetApplicationVersion() {
|
std::string GetApplicationVersion() {
|
||||||
auto module = GetModuleHandle(nullptr);
|
auto module = GetModuleHandle(nullptr);
|
||||||
auto info = make_scoped_ptr(
|
auto info = make_scoped_ptr(
|
||||||
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
||||||
return UTF16ToUTF8(info->product_version());
|
return base::UTF16ToUTF8(info->product_version());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
|
#include "content/public/common/user_agent.h"
|
||||||
#include "ui/base/resource/resource_bundle.h"
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
#include "webkit/common/user_agent/user_agent_util.h"
|
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ ContentClient::~ContentClient() {
|
||||||
|
|
||||||
std::string ContentClient::GetProduct() const {
|
std::string ContentClient::GetProduct() const {
|
||||||
auto name = GetApplicationName();
|
auto name = GetApplicationName();
|
||||||
RemoveChars(name, kWhitespaceASCII, &name);
|
base::RemoveChars(name, base::kWhitespaceASCII, &name);
|
||||||
return base::StringPrintf("%s/%s",
|
return base::StringPrintf("%s/%s",
|
||||||
name.c_str(), GetApplicationVersion().c_str());
|
name.c_str(), GetApplicationVersion().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ContentClient::GetUserAgent() const {
|
std::string ContentClient::GetUserAgent() const {
|
||||||
return webkit_glue::BuildUserAgentFromProduct(GetProduct());
|
return content::BuildUserAgentFromProduct(GetProduct());
|
||||||
}
|
}
|
||||||
|
|
||||||
base::StringPiece ContentClient::GetDataResource(
|
base::StringPiece ContentClient::GetDataResource(
|
||||||
|
|
|
@ -27,14 +27,14 @@ scoped_ptr<ContentClient> MainDelegate::CreateContentClient() {
|
||||||
bool MainDelegate::BasicStartupComplete(int* exit_code) {
|
bool MainDelegate::BasicStartupComplete(int* exit_code) {
|
||||||
content_client_ = CreateContentClient().Pass();
|
content_client_ = CreateContentClient().Pass();
|
||||||
SetContentClient(content_client_.get());
|
SetContentClient(content_client_.get());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainDelegate::PreSandboxStartup() {
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
OverrideChildProcessPath();
|
OverrideChildProcessPath();
|
||||||
OverrideFrameworkBundlePath();
|
OverrideFrameworkBundlePath();
|
||||||
#endif
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainDelegate::PreSandboxStartup() {
|
||||||
InitializeResourceBundle();
|
InitializeResourceBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,12 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
def run_gyp():
|
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():
|
def build():
|
||||||
|
@ -25,7 +30,8 @@ def build():
|
||||||
return subprocess.call(['make'])
|
return subprocess.call(['make'])
|
||||||
|
|
||||||
assert sys.platform == 'win32', sys.platform
|
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'])
|
return subprocess.call([msbuild, 'brightray.sln'])
|
||||||
|
|
||||||
|
|
||||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 656be9408484de40ba4938ef47acdebeec8a1784
|
Subproject commit 331dbed44676c534faf21f7db1985e796260649a
|
Loading…
Reference in a new issue