commit
afca245916
29 changed files with 270 additions and 200 deletions
|
@ -71,10 +71,10 @@
|
||||||
'browser/notification_presenter.h',
|
'browser/notification_presenter.h',
|
||||||
'browser/notification_presenter_mac.h',
|
'browser/notification_presenter_mac.h',
|
||||||
'browser/notification_presenter_mac.mm',
|
'browser/notification_presenter_mac.mm',
|
||||||
|
'browser/platform_notification_service_impl.cc',
|
||||||
|
'browser/platform_notification_service_impl.h',
|
||||||
'browser/linux/notification_presenter_linux.h',
|
'browser/linux/notification_presenter_linux.h',
|
||||||
'browser/linux/notification_presenter_linux.cc',
|
'browser/linux/notification_presenter_linux.cc',
|
||||||
'browser/remote_debugging_server.cc',
|
|
||||||
'browser/remote_debugging_server.h',
|
|
||||||
'browser/url_request_context_getter.cc',
|
'browser/url_request_context_getter.cc',
|
||||||
'browser/url_request_context_getter.h',
|
'browser/url_request_context_getter.h',
|
||||||
'browser/views/inspectable_web_contents_view_views.h',
|
'browser/views/inspectable_web_contents_view_views.h',
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "browser/browser_main_parts.h"
|
#include "browser/browser_main_parts.h"
|
||||||
#include "browser/devtools_manager_delegate.h"
|
#include "browser/devtools_manager_delegate.h"
|
||||||
#include "browser/media/media_capture_devices_dispatcher.h"
|
#include "browser/media/media_capture_devices_dispatcher.h"
|
||||||
#include "browser/notification_presenter.h"
|
#include "browser/platform_notification_service_impl.h"
|
||||||
|
|
||||||
#include "base/base_paths.h"
|
#include "base/base_paths.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
@ -39,14 +39,6 @@ BrowserContext* BrowserClient::browser_context() {
|
||||||
return browser_main_parts_->browser_context();
|
return browser_main_parts_->browser_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationPresenter* BrowserClient::notification_presenter() {
|
|
||||||
#if defined(OS_MACOSX) || defined(OS_LINUX)
|
|
||||||
if (!notification_presenter_)
|
|
||||||
notification_presenter_.reset(NotificationPresenter::Create());
|
|
||||||
#endif
|
|
||||||
return notification_presenter_.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
BrowserMainParts* BrowserClient::OverrideCreateBrowserMainParts(
|
BrowserMainParts* BrowserClient::OverrideCreateBrowserMainParts(
|
||||||
const content::MainFunctionParams&) {
|
const content::MainFunctionParams&) {
|
||||||
return new BrowserMainParts;
|
return new BrowserMainParts;
|
||||||
|
@ -67,21 +59,14 @@ net::URLRequestContextGetter* BrowserClient::CreateRequestContext(
|
||||||
return context->CreateRequestContext(protocol_handlers, protocol_interceptors.Pass());
|
return context->CreateRequestContext(protocol_handlers, protocol_interceptors.Pass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserClient::ShowDesktopNotification(
|
|
||||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
|
||||||
content::BrowserContext* browser_context,
|
|
||||||
int render_process_id,
|
|
||||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
|
||||||
base::Closure* cancel_callback) {
|
|
||||||
auto presenter = notification_presenter();
|
|
||||||
if (presenter)
|
|
||||||
presenter->ShowNotification(params, delegate.Pass(), cancel_callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
content::MediaObserver* BrowserClient::GetMediaObserver() {
|
content::MediaObserver* BrowserClient::GetMediaObserver() {
|
||||||
return MediaCaptureDevicesDispatcher::GetInstance();
|
return MediaCaptureDevicesDispatcher::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::PlatformNotificationService* BrowserClient::GetPlatformNotificationService() {
|
||||||
|
return PlatformNotificationServiceImpl::GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
void BrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
||||||
std::vector<std::string>* additional_schemes) {
|
std::vector<std::string>* additional_schemes) {
|
||||||
additional_schemes->push_back(content::kChromeDevToolsScheme);
|
additional_schemes->push_back(content::kChromeDevToolsScheme);
|
||||||
|
|
|
@ -11,7 +11,6 @@ namespace brightray {
|
||||||
|
|
||||||
class BrowserContext;
|
class BrowserContext;
|
||||||
class BrowserMainParts;
|
class BrowserMainParts;
|
||||||
class NotificationPresenter;
|
|
||||||
|
|
||||||
class BrowserClient : public content::ContentBrowserClient {
|
class BrowserClient : public content::ContentBrowserClient {
|
||||||
public:
|
public:
|
||||||
|
@ -22,7 +21,6 @@ class BrowserClient : public content::ContentBrowserClient {
|
||||||
|
|
||||||
BrowserContext* browser_context();
|
BrowserContext* browser_context();
|
||||||
BrowserMainParts* browser_main_parts() { return browser_main_parts_; }
|
BrowserMainParts* browser_main_parts() { return browser_main_parts_; }
|
||||||
NotificationPresenter* notification_presenter();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Subclasses should override this to provide their own BrowserMainParts
|
// Subclasses should override this to provide their own BrowserMainParts
|
||||||
|
@ -41,20 +39,14 @@ class BrowserClient : public content::ContentBrowserClient {
|
||||||
private:
|
private:
|
||||||
content::BrowserMainParts* CreateBrowserMainParts(
|
content::BrowserMainParts* CreateBrowserMainParts(
|
||||||
const content::MainFunctionParams&) override;
|
const content::MainFunctionParams&) override;
|
||||||
void ShowDesktopNotification(
|
|
||||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
|
||||||
content::BrowserContext* browser_context,
|
|
||||||
int render_process_id,
|
|
||||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
|
||||||
base::Closure* cancel_callback) override;
|
|
||||||
content::MediaObserver* GetMediaObserver() override;
|
content::MediaObserver* GetMediaObserver() override;
|
||||||
|
content::PlatformNotificationService* GetPlatformNotificationService() override;
|
||||||
void GetAdditionalAllowedSchemesForFileSystem(
|
void GetAdditionalAllowedSchemesForFileSystem(
|
||||||
std::vector<std::string>* additional_schemes) override;
|
std::vector<std::string>* additional_schemes) override;
|
||||||
base::FilePath GetDefaultDownloadDirectory() override;
|
base::FilePath GetDefaultDownloadDirectory() override;
|
||||||
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
|
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
|
||||||
|
|
||||||
BrowserMainParts* browser_main_parts_;
|
BrowserMainParts* browser_main_parts_;
|
||||||
scoped_ptr<NotificationPresenter> notification_presenter_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(BrowserClient);
|
DISALLOW_COPY_AND_ASSIGN(BrowserClient);
|
||||||
};
|
};
|
||||||
|
|
|
@ -99,6 +99,11 @@ base::FilePath BrowserContext::GetPath() const {
|
||||||
return path_;
|
return path_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scoped_ptr<content::ZoomLevelDelegate> BrowserContext::CreateZoomLevelDelegate(
|
||||||
|
const base::FilePath& partition_path) {
|
||||||
|
return scoped_ptr<content::ZoomLevelDelegate>();
|
||||||
|
}
|
||||||
|
|
||||||
bool BrowserContext::IsOffTheRecord() const {
|
bool BrowserContext::IsOffTheRecord() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,8 @@ class BrowserContext : public content::BrowserContext,
|
||||||
|
|
||||||
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
|
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
|
||||||
|
|
||||||
|
scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||||
|
const base::FilePath& partition_path) override;
|
||||||
bool IsOffTheRecord() const override;
|
bool IsOffTheRecord() const override;
|
||||||
net::URLRequestContextGetter* GetRequestContext() override;
|
net::URLRequestContextGetter* GetRequestContext() override;
|
||||||
net::URLRequestContextGetter* GetRequestContextForRenderProcess(
|
net::URLRequestContextGetter* GetRequestContextForRenderProcess(
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
#include "browser/browser_main_parts.h"
|
#include "browser/browser_main_parts.h"
|
||||||
|
|
||||||
#include "browser/browser_context.h"
|
#include "browser/browser_context.h"
|
||||||
#include "browser/remote_debugging_server.h"
|
#include "browser/devtools_manager_delegate.h"
|
||||||
#include "browser/web_ui_controller_factory.h"
|
#include "browser/web_ui_controller_factory.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
|
#include "content/public/browser/devtools_http_handler.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "net/proxy/proxy_resolver_v8.h"
|
#include "net/proxy/proxy_resolver_v8.h"
|
||||||
|
|
||||||
|
@ -125,16 +126,9 @@ void BrowserMainParts::PreMainMessageLoopRun() {
|
||||||
web_ui_controller_factory_.get());
|
web_ui_controller_factory_.get());
|
||||||
|
|
||||||
// --remote-debugging-port
|
// --remote-debugging-port
|
||||||
base::CommandLine* command_line = CommandLine::ForCurrentProcess();
|
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||||
if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) {
|
if (command_line->HasSwitch(switches::kRemoteDebuggingPort))
|
||||||
std::string port_str = command_line->GetSwitchValueASCII(switches::kRemoteDebuggingPort);
|
devtools_http_handler_.reset(DevToolsManagerDelegate::CreateHttpHandler());
|
||||||
int port;
|
|
||||||
if (base::StringToInt(port_str, &port) && port >= 0 && port < 65535)
|
|
||||||
remote_debugging_server_.reset(
|
|
||||||
new RemoteDebuggingServer("127.0.0.1", static_cast<uint16>(port)));
|
|
||||||
else
|
|
||||||
DLOG(WARNING) << "Invalid http debugger port number " << port;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserMainParts::PostMainMessageLoopRun() {
|
void BrowserMainParts::PostMainMessageLoopRun() {
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "content/public/browser/browser_main_parts.h"
|
#include "content/public/browser/browser_main_parts.h"
|
||||||
|
|
||||||
|
namespace content {
|
||||||
|
class DevToolsHttpHandler;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS)
|
#if defined(TOOLKIT_VIEWS)
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
class ViewsDelegate;
|
class ViewsDelegate;
|
||||||
|
@ -25,7 +29,6 @@ namespace brightray {
|
||||||
|
|
||||||
class BrowserContext;
|
class BrowserContext;
|
||||||
class WebUIControllerFactory;
|
class WebUIControllerFactory;
|
||||||
class RemoteDebuggingServer;
|
|
||||||
|
|
||||||
class BrowserMainParts : public content::BrowserMainParts {
|
class BrowserMainParts : public content::BrowserMainParts {
|
||||||
public:
|
public:
|
||||||
|
@ -58,7 +61,7 @@ class BrowserMainParts : public content::BrowserMainParts {
|
||||||
|
|
||||||
scoped_ptr<BrowserContext> browser_context_;
|
scoped_ptr<BrowserContext> browser_context_;
|
||||||
scoped_ptr<WebUIControllerFactory> web_ui_controller_factory_;
|
scoped_ptr<WebUIControllerFactory> web_ui_controller_factory_;
|
||||||
scoped_ptr<RemoteDebuggingServer> remote_debugging_server_;
|
scoped_ptr<content::DevToolsHttpHandler> devtools_http_handler_;
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS)
|
#if defined(TOOLKIT_VIEWS)
|
||||||
scoped_ptr<ViewsDelegate> views_delegate_;
|
scoped_ptr<ViewsDelegate> views_delegate_;
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
#define BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_
|
#define BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "ui/gfx/insets.h"
|
#include "ui/gfx/geometry/insets.h"
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
#include "ui/gfx/size.h"
|
#include "ui/gfx/geometry/size.h"
|
||||||
|
|
||||||
// This class knows how to resize both DevTools and inspected WebContents
|
// This class knows how to resize both DevTools and inspected WebContents
|
||||||
// inside a browser window hierarchy.
|
// inside a browser window hierarchy.
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "ui/gfx/insets.h"
|
#include "ui/gfx/geometry/insets.h"
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
#include "ui/gfx/size.h"
|
#include "ui/gfx/geometry/size.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class ListValue;
|
class ListValue;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "content/public/common/user_agent.h"
|
#include "content/public/common/user_agent.h"
|
||||||
#include "net/socket/tcp_server_socket.h"
|
#include "net/socket/tcp_server_socket.h"
|
||||||
|
#include "net/socket/stream_socket.h"
|
||||||
#include "ui/base/resource/resource_bundle.h"
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
|
|
||||||
using content::DevToolsAgentHost;
|
using content::DevToolsAgentHost;
|
||||||
|
@ -65,7 +66,7 @@ class TCPServerSocketFactory
|
||||||
|
|
||||||
scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>
|
scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>
|
||||||
CreateSocketFactory() {
|
CreateSocketFactory() {
|
||||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
auto& command_line = *base::CommandLine::ForCurrentProcess();
|
||||||
// See if the user specified a port on the command line (useful for
|
// See if the user specified a port on the command line (useful for
|
||||||
// automation). If not, use an ephemeral port by specifying 0.
|
// automation). If not, use an ephemeral port by specifying 0.
|
||||||
int port = 0;
|
int port = 0;
|
||||||
|
@ -151,8 +152,7 @@ class DevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
|
||||||
std::string GetDiscoveryPageHTML() override;
|
std::string GetDiscoveryPageHTML() override;
|
||||||
bool BundlesFrontendResources() override;
|
bool BundlesFrontendResources() override;
|
||||||
base::FilePath GetDebugFrontendDir() override;
|
base::FilePath GetDebugFrontendDir() override;
|
||||||
scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
|
scoped_ptr<net::ServerSocket> CreateSocketForTethering(
|
||||||
net::StreamListenSocket::Delegate* delegate,
|
|
||||||
std::string* name) override;
|
std::string* name) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -178,11 +178,9 @@ base::FilePath DevToolsDelegate::GetDebugFrontendDir() {
|
||||||
return base::FilePath();
|
return base::FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<net::StreamListenSocket>
|
scoped_ptr<net::ServerSocket> DevToolsDelegate::CreateSocketForTethering(
|
||||||
DevToolsDelegate::CreateSocketForTethering(
|
|
||||||
net::StreamListenSocket::Delegate* delegate,
|
|
||||||
std::string* name) {
|
std::string* name) {
|
||||||
return scoped_ptr<net::StreamListenSocket>();
|
return scoped_ptr<net::ServerSocket>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -162,7 +162,7 @@ void InspectableWebContentsImpl::ShowDevTools() {
|
||||||
|
|
||||||
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get());
|
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get());
|
||||||
frontend_host_.reset(content::DevToolsFrontendHost::Create(
|
frontend_host_.reset(content::DevToolsFrontendHost::Create(
|
||||||
web_contents_->GetRenderViewHost(), this));
|
web_contents_->GetMainFrame(), this));
|
||||||
agent_host_->AttachClient(this);
|
agent_host_->AttachClient(this);
|
||||||
|
|
||||||
GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, can_dock_ ? "true" : ""));
|
GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, can_dock_ ? "true" : ""));
|
||||||
|
@ -243,7 +243,7 @@ void InspectableWebContentsImpl::AppendToFile(
|
||||||
|
|
||||||
void InspectableWebContentsImpl::RequestFileSystems() {
|
void InspectableWebContentsImpl::RequestFileSystems() {
|
||||||
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(
|
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(
|
||||||
base::ASCIIToUTF16("InspectorFrontendAPI.fileSystemsLoaded([])"));
|
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([])"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::AddFileSystem() {
|
void InspectableWebContentsImpl::AddFileSystem() {
|
||||||
|
@ -296,7 +296,7 @@ void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::st
|
||||||
std::string error = embedder_message_dispatcher_->Dispatch(method, ¶ms);
|
std::string error = embedder_message_dispatcher_->Dispatch(method, ¶ms);
|
||||||
if (id) {
|
if (id) {
|
||||||
std::string ack = base::StringPrintf(
|
std::string ack = base::StringPrintf(
|
||||||
"InspectorFrontendAPI.embedderMessageAck(%d, \"%s\");", id, error.c_str());
|
"DevToolsAPI.embedderMessageAck(%d, \"%s\");", id, error.c_str());
|
||||||
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(ack));
|
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(ack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontendToBackend(
|
||||||
|
|
||||||
void InspectableWebContentsImpl::DispatchProtocolMessage(
|
void InspectableWebContentsImpl::DispatchProtocolMessage(
|
||||||
content::DevToolsAgentHost* agent_host, const std::string& message) {
|
content::DevToolsAgentHost* agent_host, const std::string& message) {
|
||||||
std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");";
|
std::string code = "DevToolsAPI.dispatchMessage(" + message + ");";
|
||||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||||
}
|
}
|
||||||
|
@ -317,10 +317,11 @@ void InspectableWebContentsImpl::AgentHostClosed(
|
||||||
content::DevToolsAgentHost* agent_host, bool replaced) {
|
content::DevToolsAgentHost* agent_host, bool replaced) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::AboutToNavigateRenderView(
|
void InspectableWebContentsImpl::AboutToNavigateRenderFrame(
|
||||||
content::RenderViewHost* render_view_host) {
|
content::RenderFrameHost* new_host) {
|
||||||
frontend_host_.reset(content::DevToolsFrontendHost::Create(
|
if (new_host->GetParent())
|
||||||
render_view_host, this));
|
return;
|
||||||
|
frontend_host_.reset(content::DevToolsFrontendHost::Create(new_host, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
void InspectableWebContentsImpl::DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
||||||
|
@ -355,6 +356,7 @@ bool InspectableWebContentsImpl::AddMessageToConsole(
|
||||||
bool InspectableWebContentsImpl::ShouldCreateWebContents(
|
bool InspectableWebContentsImpl::ShouldCreateWebContents(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
int route_id,
|
int route_id,
|
||||||
|
int main_frame_route_id,
|
||||||
WindowContainerType window_container_type,
|
WindowContainerType window_container_type,
|
||||||
const base::string16& frame_name,
|
const base::string16& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "content/public/browser/devtools_frontend_host.h"
|
#include "content/public/browser/devtools_frontend_host.h"
|
||||||
#include "content/public/browser/web_contents_delegate.h"
|
#include "content/public/browser/web_contents_delegate.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "ui/gfx/rect.h"
|
#include "ui/gfx/geometry/rect.h"
|
||||||
|
|
||||||
class PrefRegistrySimple;
|
class PrefRegistrySimple;
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class InspectableWebContentsImpl :
|
||||||
bool replaced) override;
|
bool replaced) override;
|
||||||
|
|
||||||
// content::WebContentsObserver:
|
// content::WebContentsObserver:
|
||||||
void AboutToNavigateRenderView(content::RenderViewHost* render_view_host) override;
|
void AboutToNavigateRenderFrame(content::RenderFrameHost* new_host) override;
|
||||||
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& validated_url) override;
|
const GURL& validated_url) override;
|
||||||
void WebContentsDestroyed() override;
|
void WebContentsDestroyed() override;
|
||||||
|
@ -118,6 +118,7 @@ class InspectableWebContentsImpl :
|
||||||
bool ShouldCreateWebContents(
|
bool ShouldCreateWebContents(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
int route_id,
|
int route_id,
|
||||||
|
int main_frame_route_id,
|
||||||
WindowContainerType window_container_type,
|
WindowContainerType window_container_type,
|
||||||
const base::string16& frame_name,
|
const base::string16& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "content/public/browser/desktop_notification_delegate.h"
|
#include "content/public/browser/desktop_notification_delegate.h"
|
||||||
#include "content/public/common/show_desktop_notification_params.h"
|
#include "content/public/common/platform_notification_data.h"
|
||||||
#include "common/application_info.h"
|
#include "common/application_info.h"
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
@ -51,11 +51,11 @@ NotificationPresenterLinux::~NotificationPresenterLinux() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationPresenterLinux::ShowNotification(
|
void NotificationPresenterLinux::ShowNotification(
|
||||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
const content::PlatformNotificationData& data,
|
||||||
scoped_ptr<content::DesktopNotificationDelegate> delegate_ptr,
|
scoped_ptr<content::DesktopNotificationDelegate> delegate_ptr,
|
||||||
base::Closure* cancel_callback) {
|
base::Closure* cancel_callback) {
|
||||||
std::string title = base::UTF16ToUTF8(params.title);
|
std::string title = base::UTF16ToUTF8(data.title);
|
||||||
std::string body = base::UTF16ToUTF8(params.body);
|
std::string body = base::UTF16ToUTF8(data.body);
|
||||||
NotifyNotification* notification = notify_notification_new(title.c_str(), body.c_str(), nullptr);
|
NotifyNotification* notification = notify_notification_new(title.c_str(), body.c_str(), nullptr);
|
||||||
|
|
||||||
content::DesktopNotificationDelegate* delegate = delegate_ptr.release();
|
content::DesktopNotificationDelegate* delegate = delegate_ptr.release();
|
||||||
|
|
|
@ -25,8 +25,8 @@ class NotificationPresenterLinux : public NotificationPresenter {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// NotificationPresenter:
|
// NotificationPresenter:
|
||||||
virtual void ShowNotification(
|
void ShowNotification(
|
||||||
const content::ShowDesktopNotificationHostMsgParams&,
|
const content::PlatformNotificationData&,
|
||||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||||
base::Closure* cancel_callback) override;
|
base::Closure* cancel_callback) override;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ bool MediaStreamDevicesController::TakeAction() {
|
||||||
// Do special handling of desktop screen cast.
|
// Do special handling of desktop screen cast.
|
||||||
if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE ||
|
if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE ||
|
||||||
request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE ||
|
request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE ||
|
||||||
request_.audio_type == content::MEDIA_LOOPBACK_AUDIO_CAPTURE ||
|
request_.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE ||
|
||||||
request_.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
|
request_.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
|
||||||
HandleUserMediaRequest();
|
HandleUserMediaRequest();
|
||||||
return true;
|
return true;
|
||||||
|
@ -59,7 +59,7 @@ bool MediaStreamDevicesController::TakeAction() {
|
||||||
|
|
||||||
// Deny the request if there is no device attached to the OS.
|
// Deny the request if there is no device attached to the OS.
|
||||||
if (!HasAnyAvailableDevice()) {
|
if (!HasAnyAvailableDevice()) {
|
||||||
Deny();
|
Deny(content::MEDIA_DEVICE_NO_HARDWARE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,11 +149,11 @@ void MediaStreamDevicesController::Accept() {
|
||||||
cb.Run(devices, content::MEDIA_DEVICE_OK, scoped_ptr<content::MediaStreamUI>());
|
cb.Run(devices, content::MEDIA_DEVICE_OK, scoped_ptr<content::MediaStreamUI>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaStreamDevicesController::Deny() {
|
void MediaStreamDevicesController::Deny(content::MediaStreamRequestResult result) {
|
||||||
content::MediaResponseCallback cb = callback_;
|
content::MediaResponseCallback cb = callback_;
|
||||||
callback_.Reset();
|
callback_.Reset();
|
||||||
cb.Run(content::MediaStreamDevices(),
|
cb.Run(content::MediaStreamDevices(),
|
||||||
content::MEDIA_DEVICE_PERMISSION_DENIED,
|
result,
|
||||||
scoped_ptr<content::MediaStreamUI>());
|
scoped_ptr<content::MediaStreamUI>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,9 +168,9 @@ void MediaStreamDevicesController::HandleUserMediaRequest() {
|
||||||
devices.push_back(content::MediaStreamDevice(
|
devices.push_back(content::MediaStreamDevice(
|
||||||
content::MEDIA_TAB_VIDEO_CAPTURE, "", ""));
|
content::MEDIA_TAB_VIDEO_CAPTURE, "", ""));
|
||||||
}
|
}
|
||||||
if (request_.audio_type == content::MEDIA_LOOPBACK_AUDIO_CAPTURE) {
|
if (request_.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE) {
|
||||||
devices.push_back(content::MediaStreamDevice(
|
devices.push_back(content::MediaStreamDevice(
|
||||||
content::MEDIA_LOOPBACK_AUDIO_CAPTURE, "loopback", "System Audio"));
|
content::MEDIA_DESKTOP_AUDIO_CAPTURE, "loopback", "System Audio"));
|
||||||
}
|
}
|
||||||
if (request_.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
|
if (request_.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
|
||||||
content::DesktopMediaID screen_id;
|
content::DesktopMediaID screen_id;
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MediaStreamDevicesController {
|
||||||
|
|
||||||
// Explicitly accept or deny the request.
|
// Explicitly accept or deny the request.
|
||||||
void Accept();
|
void Accept();
|
||||||
void Deny();
|
void Deny(content::MediaStreamRequestResult result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Handle the request of desktop or tab screen cast.
|
// Handle the request of desktop or tab screen cast.
|
||||||
|
|
|
@ -21,6 +21,15 @@ int NetworkDelegate::OnBeforeURLRequest(
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkDelegate::OnResolveProxy(const GURL& url,
|
||||||
|
int load_flags,
|
||||||
|
const net::ProxyService& proxy_service,
|
||||||
|
net::ProxyInfo* result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkDelegate::OnProxyFallback(const net::ProxyServer& bad_proxy, int net_error) {
|
||||||
|
}
|
||||||
|
|
||||||
int NetworkDelegate::OnBeforeSendHeaders(
|
int NetworkDelegate::OnBeforeSendHeaders(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
const net::CompletionCallback& callback,
|
||||||
|
@ -28,6 +37,11 @@ int NetworkDelegate::OnBeforeSendHeaders(
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkDelegate::OnBeforeSendProxyHeaders(net::URLRequest* request,
|
||||||
|
const net::ProxyInfo& proxy_info,
|
||||||
|
net::HttpRequestHeaders* headers) {
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkDelegate::OnSendHeaders(
|
void NetworkDelegate::OnSendHeaders(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::HttpRequestHeaders& headers) {
|
const net::HttpRequestHeaders& headers) {
|
||||||
|
@ -92,10 +106,17 @@ bool NetworkDelegate::OnCanThrottleRequest(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NetworkDelegate::OnBeforeSocketStreamConnect(
|
bool NetworkDelegate::OnCanEnablePrivacyMode(
|
||||||
net::SocketStream* socket,
|
const GURL& url,
|
||||||
const net::CompletionCallback& callback) {
|
const GURL& first_party_for_cookies) const {
|
||||||
return net::OK;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
||||||
|
const net::URLRequest& request,
|
||||||
|
const GURL& target_url,
|
||||||
|
const GURL& referrer_url) const {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -15,46 +15,57 @@ class NetworkDelegate : public net::NetworkDelegate {
|
||||||
virtual ~NetworkDelegate();
|
virtual ~NetworkDelegate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int OnBeforeURLRequest(net::URLRequest* request,
|
int OnBeforeURLRequest(net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
const net::CompletionCallback& callback,
|
||||||
GURL* new_url) override;
|
GURL* new_url) override;
|
||||||
virtual int OnBeforeSendHeaders(net::URLRequest* request,
|
void OnResolveProxy(const GURL& url,
|
||||||
const net::CompletionCallback& callback,
|
int load_flags,
|
||||||
net::HttpRequestHeaders* headers) override;
|
const net::ProxyService& proxy_service,
|
||||||
virtual void OnSendHeaders(net::URLRequest* request,
|
net::ProxyInfo* result) override;
|
||||||
const net::HttpRequestHeaders& headers) override;
|
void OnProxyFallback(const net::ProxyServer& bad_proxy, int net_error) override;
|
||||||
virtual int OnHeadersReceived(
|
int OnBeforeSendHeaders(net::URLRequest* request,
|
||||||
|
const net::CompletionCallback& callback,
|
||||||
|
net::HttpRequestHeaders* headers) override;
|
||||||
|
void OnBeforeSendProxyHeaders(net::URLRequest* request,
|
||||||
|
const net::ProxyInfo& proxy_info,
|
||||||
|
net::HttpRequestHeaders* headers) override;
|
||||||
|
void OnSendHeaders(net::URLRequest* request,
|
||||||
|
const net::HttpRequestHeaders& headers) override;
|
||||||
|
int 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) override;
|
GURL* allowed_unsafe_redirect_url) override;
|
||||||
virtual void OnBeforeRedirect(net::URLRequest* request,
|
void OnBeforeRedirect(net::URLRequest* request,
|
||||||
const GURL& new_location) override;
|
const GURL& new_location) override;
|
||||||
virtual void OnResponseStarted(net::URLRequest* request) override;
|
void OnResponseStarted(net::URLRequest* request) override;
|
||||||
virtual void OnRawBytesRead(const net::URLRequest& request,
|
void OnRawBytesRead(const net::URLRequest& request,
|
||||||
int bytes_read) override;
|
int bytes_read) override;
|
||||||
virtual void OnCompleted(net::URLRequest* request, bool started) override;
|
void OnCompleted(net::URLRequest* request, bool started) override;
|
||||||
virtual void OnURLRequestDestroyed(net::URLRequest* request) override;
|
void OnURLRequestDestroyed(net::URLRequest* request) override;
|
||||||
virtual void OnPACScriptError(int line_number,
|
void OnPACScriptError(int line_number,
|
||||||
const base::string16& error) override;
|
const base::string16& error) override;
|
||||||
virtual AuthRequiredResponse OnAuthRequired(
|
AuthRequiredResponse OnAuthRequired(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::AuthChallengeInfo& auth_info,
|
const net::AuthChallengeInfo& auth_info,
|
||||||
const AuthCallback& callback,
|
const AuthCallback& callback,
|
||||||
net::AuthCredentials* credentials) override;
|
net::AuthCredentials* credentials) override;
|
||||||
virtual bool OnCanGetCookies(const net::URLRequest& request,
|
bool OnCanGetCookies(const net::URLRequest& request,
|
||||||
const net::CookieList& cookie_list) override;
|
const net::CookieList& cookie_list) override;
|
||||||
virtual bool OnCanSetCookie(const net::URLRequest& request,
|
bool OnCanSetCookie(const net::URLRequest& request,
|
||||||
const std::string& cookie_line,
|
const std::string& cookie_line,
|
||||||
net::CookieOptions* options) override;
|
net::CookieOptions* options) override;
|
||||||
virtual bool OnCanAccessFile(const net::URLRequest& request,
|
bool OnCanAccessFile(const net::URLRequest& request,
|
||||||
const base::FilePath& path) const override;
|
const base::FilePath& path) const override;
|
||||||
virtual bool OnCanThrottleRequest(
|
bool OnCanThrottleRequest(const net::URLRequest& request) const override;
|
||||||
const net::URLRequest& request) const override;
|
bool OnCanEnablePrivacyMode(
|
||||||
virtual int OnBeforeSocketStreamConnect(
|
const GURL& url,
|
||||||
net::SocketStream* stream,
|
const GURL& first_party_for_cookies) const override;
|
||||||
const net::CompletionCallback& callback) override;
|
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
||||||
|
const net::URLRequest& request,
|
||||||
|
const GURL& target_url,
|
||||||
|
const GURL& referrer_url) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(NetworkDelegate);
|
DISALLOW_COPY_AND_ASSIGN(NetworkDelegate);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
class DesktopNotificationDelegate;
|
class DesktopNotificationDelegate;
|
||||||
struct ShowDesktopNotificationHostMsgParams;
|
struct PlatformNotificationData;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
@ -18,7 +18,7 @@ class NotificationPresenter {
|
||||||
static NotificationPresenter* Create();
|
static NotificationPresenter* Create();
|
||||||
|
|
||||||
virtual void ShowNotification(
|
virtual void ShowNotification(
|
||||||
const content::ShowDesktopNotificationHostMsgParams&,
|
const content::PlatformNotificationData&,
|
||||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||||
base::Closure* cancel_callback) = 0;
|
base::Closure* cancel_callback) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,8 +20,9 @@ class NotificationPresenterMac : public NotificationPresenter {
|
||||||
NotificationPresenterMac();
|
NotificationPresenterMac();
|
||||||
~NotificationPresenterMac();
|
~NotificationPresenterMac();
|
||||||
|
|
||||||
virtual void ShowNotification(
|
// NotificationPresenter:
|
||||||
const content::ShowDesktopNotificationHostMsgParams&,
|
void ShowNotification(
|
||||||
|
const content::PlatformNotificationData&,
|
||||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||||
base::Closure* cancel_callback) override;
|
base::Closure* cancel_callback) override;
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/stl_util.h"
|
#include "base/stl_util.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
#include "content/public/common/platform_notification_data.h"
|
||||||
#include "content/public/browser/desktop_notification_delegate.h"
|
#include "content/public/browser/desktop_notification_delegate.h"
|
||||||
#include "content/public/common/show_desktop_notification_params.h"
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@ -40,12 +40,12 @@ NotificationPresenterMac::~NotificationPresenterMac() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationPresenterMac::ShowNotification(
|
void NotificationPresenterMac::ShowNotification(
|
||||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
const content::PlatformNotificationData& data,
|
||||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||||
base::Closure* cancel_callback) {
|
base::Closure* cancel_callback) {
|
||||||
auto notification = [[NSUserNotification alloc] init];
|
auto notification = [[NSUserNotification alloc] init];
|
||||||
notification.title = base::SysUTF16ToNSString(params.title);
|
notification.title = base::SysUTF16ToNSString(data.title);
|
||||||
notification.informativeText = base::SysUTF16ToNSString(params.body);
|
notification.informativeText = base::SysUTF16ToNSString(data.body);
|
||||||
|
|
||||||
notifications_map_[delegate.get()].reset(notification);
|
notifications_map_[delegate.get()].reset(notification);
|
||||||
[NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:notification];
|
[NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:notification];
|
||||||
|
|
64
brightray/browser/platform_notification_service_impl.cc
Normal file
64
brightray/browser/platform_notification_service_impl.cc
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE-CHROMIUM file.
|
||||||
|
|
||||||
|
#include "browser/platform_notification_service_impl.h"
|
||||||
|
|
||||||
|
#include "browser/notification_presenter.h"
|
||||||
|
|
||||||
|
#include "content/public/browser/desktop_notification_delegate.h"
|
||||||
|
|
||||||
|
namespace brightray {
|
||||||
|
|
||||||
|
// static
|
||||||
|
PlatformNotificationServiceImpl*
|
||||||
|
PlatformNotificationServiceImpl::GetInstance() {
|
||||||
|
return Singleton<PlatformNotificationServiceImpl>::get();
|
||||||
|
}
|
||||||
|
|
||||||
|
PlatformNotificationServiceImpl::PlatformNotificationServiceImpl() {}
|
||||||
|
PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {}
|
||||||
|
|
||||||
|
NotificationPresenter* PlatformNotificationServiceImpl::notification_presenter() {
|
||||||
|
#if defined(OS_MACOSX) || defined(OS_LINUX)
|
||||||
|
if (!notification_presenter_)
|
||||||
|
notification_presenter_.reset(NotificationPresenter::Create());
|
||||||
|
#endif
|
||||||
|
return notification_presenter_.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
blink::WebNotificationPermission PlatformNotificationServiceImpl::CheckPermission(
|
||||||
|
content::ResourceContext* resource_context,
|
||||||
|
const GURL& origin,
|
||||||
|
int render_process_id) {
|
||||||
|
return blink::WebNotificationPermissionAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlatformNotificationServiceImpl::DisplayNotification(
|
||||||
|
content::BrowserContext* browser_context,
|
||||||
|
const GURL& origin,
|
||||||
|
const SkBitmap& icon,
|
||||||
|
const content::PlatformNotificationData& notification_data,
|
||||||
|
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||||
|
int render_process_id,
|
||||||
|
base::Closure* cancel_callback) {
|
||||||
|
auto presenter = notification_presenter();
|
||||||
|
if (presenter)
|
||||||
|
presenter->ShowNotification(notification_data, delegate.Pass(), cancel_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlatformNotificationServiceImpl::DisplayPersistentNotification(
|
||||||
|
content::BrowserContext* browser_context,
|
||||||
|
int64 service_worker_registration_id,
|
||||||
|
const GURL& origin,
|
||||||
|
const SkBitmap& icon,
|
||||||
|
const content::PlatformNotificationData& notification_data,
|
||||||
|
int render_process_id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlatformNotificationServiceImpl::ClosePersistentNotification(
|
||||||
|
content::BrowserContext* browser_context,
|
||||||
|
const std::string& persistent_notification_id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace brightray
|
61
brightray/browser/platform_notification_service_impl.h
Normal file
61
brightray/browser/platform_notification_service_impl.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE-CHROMIUM file.
|
||||||
|
|
||||||
|
#ifndef BROWSER_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
|
||||||
|
#define BROWSER_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
|
||||||
|
|
||||||
|
#include "base/memory/singleton.h"
|
||||||
|
#include "content/public/browser/platform_notification_service.h"
|
||||||
|
|
||||||
|
namespace brightray {
|
||||||
|
|
||||||
|
class NotificationPresenter;
|
||||||
|
|
||||||
|
class PlatformNotificationServiceImpl
|
||||||
|
: public content::PlatformNotificationService {
|
||||||
|
public:
|
||||||
|
// Returns the active instance of the service in the browser process. Safe to
|
||||||
|
// be called from any thread.
|
||||||
|
static PlatformNotificationServiceImpl* GetInstance();
|
||||||
|
|
||||||
|
NotificationPresenter* notification_presenter();
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend struct DefaultSingletonTraits<PlatformNotificationServiceImpl>;
|
||||||
|
|
||||||
|
PlatformNotificationServiceImpl();
|
||||||
|
~PlatformNotificationServiceImpl() override;
|
||||||
|
|
||||||
|
// content::PlatformNotificationService:
|
||||||
|
virtual blink::WebNotificationPermission CheckPermission(
|
||||||
|
content::ResourceContext* resource_context,
|
||||||
|
const GURL& origin,
|
||||||
|
int render_process_id) override;
|
||||||
|
virtual void DisplayNotification(
|
||||||
|
content::BrowserContext* browser_context,
|
||||||
|
const GURL& origin,
|
||||||
|
const SkBitmap& icon,
|
||||||
|
const content::PlatformNotificationData& notification_data,
|
||||||
|
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||||
|
int render_process_id,
|
||||||
|
base::Closure* cancel_callback) override;
|
||||||
|
virtual void DisplayPersistentNotification(
|
||||||
|
content::BrowserContext* browser_context,
|
||||||
|
int64 service_worker_registration_id,
|
||||||
|
const GURL& origin,
|
||||||
|
const SkBitmap& icon,
|
||||||
|
const content::PlatformNotificationData& notification_data,
|
||||||
|
int render_process_id) override;
|
||||||
|
virtual void ClosePersistentNotification(
|
||||||
|
content::BrowserContext* browser_context,
|
||||||
|
const std::string& persistent_notification_id) override;
|
||||||
|
|
||||||
|
scoped_ptr<NotificationPresenter> notification_presenter_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace brightray
|
||||||
|
|
||||||
|
#endif // BROWSER_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
|
|
@ -1,44 +0,0 @@
|
||||||
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE-CHROMIUM file.
|
|
||||||
|
|
||||||
#include "browser/remote_debugging_server.h"
|
|
||||||
|
|
||||||
#include "browser/devtools_manager_delegate.h"
|
|
||||||
|
|
||||||
#include "base/files/file_util.h"
|
|
||||||
#include "content/public/browser/devtools_http_handler.h"
|
|
||||||
#include "net/socket/tcp_server_socket.h"
|
|
||||||
|
|
||||||
namespace brightray {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
class TCPServerSocketFactory
|
|
||||||
: public content::DevToolsHttpHandler::ServerSocketFactory {
|
|
||||||
public:
|
|
||||||
TCPServerSocketFactory(const std::string& address, uint16 port, int backlog)
|
|
||||||
: content::DevToolsHttpHandler::ServerSocketFactory(address, port, backlog) {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// content::DevToolsHttpHandler::ServerSocketFactory:
|
|
||||||
scoped_ptr<net::ServerSocket> Create() const override {
|
|
||||||
return scoped_ptr<net::ServerSocket>(new net::TCPServerSocket(NULL, net::NetLog::Source()));
|
|
||||||
}
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
RemoteDebuggingServer::RemoteDebuggingServer(const std::string& ip, uint16 port) {
|
|
||||||
scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> factory(
|
|
||||||
new TCPServerSocketFactory(ip, port, 1));
|
|
||||||
devtools_http_handler_ = DevToolsManagerDelegate::CreateHttpHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteDebuggingServer::~RemoteDebuggingServer() {
|
|
||||||
devtools_http_handler_->Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace brightray
|
|
|
@ -1,31 +0,0 @@
|
||||||
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE-CHROMIUM file.
|
|
||||||
|
|
||||||
#ifndef BROWSER_REMOTE_DEBUGGING_SERVER_H_
|
|
||||||
#define BROWSER_REMOTE_DEBUGGING_SERVER_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
|
||||||
|
|
||||||
namespace content {
|
|
||||||
class DevToolsHttpHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace brightray {
|
|
||||||
|
|
||||||
class RemoteDebuggingServer {
|
|
||||||
public:
|
|
||||||
RemoteDebuggingServer(const std::string& ip, uint16 port);
|
|
||||||
virtual ~RemoteDebuggingServer();
|
|
||||||
|
|
||||||
private:
|
|
||||||
content::DevToolsHttpHandler* devtools_http_handler_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(RemoteDebuggingServer);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace brightray
|
|
||||||
|
|
||||||
#endif // BROWSER_REMOTE_DEBUGGING_SERVER_H_
|
|
|
@ -142,7 +142,7 @@ net::HostResolver* URLRequestContextGetter::host_resolver() {
|
||||||
net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||||
|
|
||||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
auto& command_line = *base::CommandLine::ForCurrentProcess();
|
||||||
if (!url_request_context_.get()) {
|
if (!url_request_context_.get()) {
|
||||||
url_request_context_.reset(new net::URLRequestContext);
|
url_request_context_.reset(new net::URLRequestContext);
|
||||||
network_delegate_.reset(delegate_->CreateNetworkDelegate());
|
network_delegate_.reset(delegate_->CreateNetworkDelegate());
|
||||||
|
|
|
@ -54,6 +54,10 @@ HICON ViewsDelegate::GetDefaultWindowIcon() const {
|
||||||
return LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(1 /* IDR_MAINFRAME */));
|
return LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(1 /* IDR_MAINFRAME */));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HICON ViewsDelegate::GetSmallWindowIcon() const {
|
||||||
|
return GetDefaultWindowIcon();
|
||||||
|
}
|
||||||
|
|
||||||
bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const {
|
bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ class ViewsDelegate : public views::ViewsDelegate {
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
virtual HICON GetDefaultWindowIcon() const override;
|
virtual HICON GetDefaultWindowIcon() const override;
|
||||||
|
virtual HICON GetSmallWindowIcon() const override;
|
||||||
virtual bool IsWindowInMetro(gfx::NativeWindow window) const override;
|
virtual bool IsWindowInMetro(gfx::NativeWindow window) const override;
|
||||||
#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||||
virtual gfx::ImageSkia* GetDefaultWindowIcon() const override;
|
virtual gfx::ImageSkia* GetDefaultWindowIcon() const override;
|
||||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 3f108160eded696b3e843c2fbb4e5e2ac696555e
|
Subproject commit 78ddaee2158886da53d0801db572be38230fd814
|
Loading…
Reference in a new issue