commit
e94795a600
16 changed files with 92 additions and 79 deletions
|
@ -69,11 +69,11 @@ net::URLRequestContextGetter* BrowserClient::CreateRequestContext(
|
|||
void BrowserClient::ShowDesktopNotification(
|
||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
content::DesktopNotificationDelegate* delegate,
|
||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||
base::Closure* cancel_callback) {
|
||||
auto presenter = notification_presenter();
|
||||
if (presenter)
|
||||
presenter->ShowNotification(params, delegate, cancel_callback);
|
||||
presenter->ShowNotification(params, delegate.Pass(), cancel_callback);
|
||||
}
|
||||
|
||||
content::MediaObserver* BrowserClient::GetMediaObserver() {
|
||||
|
|
|
@ -42,10 +42,10 @@ class BrowserClient : public content::ContentBrowserClient {
|
|||
virtual content::BrowserMainParts* CreateBrowserMainParts(
|
||||
const content::MainFunctionParams&) OVERRIDE;
|
||||
virtual void ShowDesktopNotification(
|
||||
const content::ShowDesktopNotificationHostMsgParams&,
|
||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
content::DesktopNotificationDelegate* delegate,
|
||||
base::Closure* cancel_callback) OVERRIDE;
|
||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||
base::Closure* cancel_callback) override;
|
||||
virtual content::MediaObserver* GetMediaObserver() OVERRIDE;
|
||||
virtual void GetAdditionalAllowedSchemesForFileSystem(
|
||||
std::vector<std::string>* additional_schemes) OVERRIDE;
|
||||
|
|
|
@ -174,4 +174,8 @@ content::PushMessagingService* BrowserContext::GetPushMessagingService() {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate* BrowserContext::GetSSLHostStateDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -63,6 +63,7 @@ class BrowserContext : public content::BrowserContext,
|
|||
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
|
||||
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
||||
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
|
||||
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
|
||||
base::FilePath path_;
|
||||
scoped_ptr<ResourceContext> resource_context_;
|
||||
|
|
|
@ -96,8 +96,7 @@ class Target : public content::DevToolsTarget {
|
|||
};
|
||||
|
||||
Target::Target(WebContents* web_contents) {
|
||||
agent_host_ =
|
||||
DevToolsAgentHost::GetOrCreateFor(web_contents->GetRenderViewHost());
|
||||
agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents);
|
||||
id_ = agent_host_->GetId();
|
||||
title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
||||
url_ = web_contents->GetURL();
|
||||
|
@ -109,10 +108,7 @@ Target::Target(WebContents* web_contents) {
|
|||
}
|
||||
|
||||
bool Target::Activate() const {
|
||||
RenderViewHost* rvh = agent_host_->GetRenderViewHost();
|
||||
if (!rvh)
|
||||
return false;
|
||||
WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
|
||||
WebContents* web_contents = agent_host_->GetWebContents();
|
||||
if (!web_contents)
|
||||
return false;
|
||||
web_contents->GetDelegate()->ActivateContents(web_contents);
|
||||
|
@ -120,10 +116,10 @@ bool Target::Activate() const {
|
|||
}
|
||||
|
||||
bool Target::Close() const {
|
||||
RenderViewHost* rvh = agent_host_->GetRenderViewHost();
|
||||
if (!rvh)
|
||||
WebContents* web_contents = agent_host_->GetWebContents();
|
||||
if (!web_contents)
|
||||
return false;
|
||||
rvh->ClosePage();
|
||||
web_contents->GetRenderViewHost()->ClosePage();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -176,13 +172,12 @@ DevToolsDelegate::CreateNewTarget(const GURL& url) {
|
|||
|
||||
void DevToolsDelegate::EnumerateTargets(TargetCallback callback) {
|
||||
TargetList targets;
|
||||
std::vector<RenderViewHost*> rvh_list =
|
||||
content::DevToolsAgentHost::GetValidRenderViewHosts();
|
||||
for (std::vector<RenderViewHost*>::iterator it = rvh_list.begin();
|
||||
it != rvh_list.end(); ++it) {
|
||||
WebContents* web_contents = WebContents::FromRenderViewHost(*it);
|
||||
if (web_contents)
|
||||
targets.push_back(new Target(web_contents));
|
||||
std::vector<WebContents*> wc_list =
|
||||
content::DevToolsAgentHost::GetInspectableWebContents();
|
||||
for (std::vector<WebContents*>::iterator it = wc_list.begin();
|
||||
it != wc_list.end();
|
||||
++it) {
|
||||
targets.push_back(new Target(*it));
|
||||
}
|
||||
callback.Run(targets);
|
||||
}
|
||||
|
|
|
@ -164,13 +164,10 @@ void InspectableWebContentsImpl::ShowDevTools() {
|
|||
Observe(devtools_web_contents_.get());
|
||||
devtools_web_contents_->SetDelegate(this);
|
||||
|
||||
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(
|
||||
web_contents_->GetRenderViewHost());
|
||||
frontend_host_.reset(
|
||||
content::DevToolsClientHost::CreateDevToolsFrontendHost(
|
||||
devtools_web_contents_.get(), this));
|
||||
content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(
|
||||
agent_host_, frontend_host_.get());
|
||||
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get());
|
||||
frontend_host_.reset(content::DevToolsFrontendHost::Create(
|
||||
web_contents_->GetRenderViewHost(), this));
|
||||
content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(agent_host_, this);
|
||||
|
||||
GURL devtools_url(kChromeUIDevToolsURL);
|
||||
devtools_web_contents_->GetController().LoadURL(
|
||||
|
@ -291,8 +288,7 @@ void InspectableWebContentsImpl::ResetZoom() {
|
|||
SetZoomLevelForWebContents(devtools_web_contents(), 0.);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::DispatchOnEmbedder(
|
||||
const std::string& message) {
|
||||
void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::string& message) {
|
||||
std::string method;
|
||||
base::ListValue params;
|
||||
int id;
|
||||
|
@ -309,31 +305,43 @@ void InspectableWebContentsImpl::DispatchOnEmbedder(
|
|||
}
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontendToBackend(
|
||||
const std::string& message) {
|
||||
content::DevToolsManager::GetInstance()->DispatchOnInspectorBackend(
|
||||
this, message);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::DispatchOnInspectorFrontend(
|
||||
const std::string& message) {
|
||||
std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::InspectedContentsClosing() {
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::ReplacedWithAnotherClient() {
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::AboutToNavigateRenderView(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
content::DevToolsClientHost::SetupDevToolsFrontendClient(
|
||||
web_contents()->GetRenderViewHost());
|
||||
frontend_host_.reset(content::DevToolsFrontendHost::Create(
|
||||
render_view_host, this));
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::DidFinishLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
content::RenderViewHost*) {
|
||||
if (!is_main_frame)
|
||||
void InspectableWebContentsImpl::DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url) {
|
||||
if (render_frame_host->GetParent())
|
||||
return;
|
||||
|
||||
view_->ShowDevTools();
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::WebContentsDestroyed() {
|
||||
content::DevToolsManager::GetInstance()->ClientHostClosing(
|
||||
frontend_host_.get());
|
||||
content::DevToolsManager::GetInstance()->ClientHostClosing(this);
|
||||
Observe(nullptr);
|
||||
agent_host_ = nullptr;
|
||||
frontend_host_.reset();
|
||||
}
|
||||
|
||||
bool InspectableWebContentsImpl::AddMessageToConsole(
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "browser/devtools_contents_resizing_strategy.h"
|
||||
#include "browser/devtools_embedder_message_dispatcher.h"
|
||||
|
||||
#include "content/public/browser/devtools_frontend_host_delegate.h"
|
||||
#include "content/public/browser/devtools_client_host.h"
|
||||
#include "content/public/browser/devtools_frontend_host.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
|
@ -20,7 +21,6 @@ class PrefRegistrySimple;
|
|||
|
||||
namespace content {
|
||||
class DevToolsAgentHost;
|
||||
class DevToolsClientHost;
|
||||
}
|
||||
|
||||
namespace brightray {
|
||||
|
@ -30,10 +30,11 @@ class InspectableWebContentsView;
|
|||
|
||||
class InspectableWebContentsImpl :
|
||||
public InspectableWebContents,
|
||||
content::DevToolsFrontendHostDelegate,
|
||||
content::WebContentsObserver,
|
||||
content::WebContentsDelegate,
|
||||
DevToolsEmbedderMessageDispatcher::Delegate {
|
||||
public content::DevToolsFrontendHost::Delegate,
|
||||
public content::DevToolsClientHost,
|
||||
public content::WebContentsObserver,
|
||||
public content::WebContentsDelegate,
|
||||
public DevToolsEmbedderMessageDispatcher::Delegate {
|
||||
public:
|
||||
static void RegisterPrefs(PrefRegistrySimple* pref_registry);
|
||||
|
||||
|
@ -92,19 +93,19 @@ class InspectableWebContentsImpl :
|
|||
virtual void ZoomOut() OVERRIDE;
|
||||
virtual void ResetZoom() OVERRIDE;
|
||||
|
||||
// content::DevToolsFrontendHostDelegate
|
||||
// content::DevToolsClientHost:
|
||||
virtual void DispatchOnInspectorFrontend(const std::string& message) override;
|
||||
virtual void InspectedContentsClosing() override;
|
||||
virtual void ReplacedWithAnotherClient() override;
|
||||
|
||||
virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE;
|
||||
virtual void InspectedContentsClosing() OVERRIDE;
|
||||
// content::DevToolsFrontendHostDelegate:
|
||||
virtual void HandleMessageFromDevToolsFrontend(const std::string& message) override;
|
||||
virtual void HandleMessageFromDevToolsFrontendToBackend(const std::string& message) override;
|
||||
|
||||
// content::WebContentsObserver
|
||||
|
||||
virtual void AboutToNavigateRenderView(
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
virtual void DidFinishLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
content::RenderViewHost*) OVERRIDE;
|
||||
// content::WebContentsObserver:
|
||||
virtual void AboutToNavigateRenderView(content::RenderViewHost* render_view_host) override;
|
||||
virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url) OVERRIDE;
|
||||
virtual void WebContentsDestroyed() OVERRIDE;
|
||||
|
||||
// content::WebContentsDelegate
|
||||
|
@ -119,10 +120,10 @@ class InspectableWebContentsImpl :
|
|||
virtual void CloseContents(content::WebContents* source) OVERRIDE;
|
||||
|
||||
scoped_ptr<content::WebContents> web_contents_;
|
||||
scoped_ptr<content::DevToolsClientHost> frontend_host_;
|
||||
scoped_ptr<content::WebContents> devtools_web_contents_;
|
||||
scoped_ptr<InspectableWebContentsView> view_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||
|
||||
DevToolsContentsResizingStrategy contents_resizing_strategy_;
|
||||
gfx::Rect devtools_bounds_;
|
||||
|
|
|
@ -52,13 +52,15 @@ NotificationPresenterLinux::~NotificationPresenterLinux() {
|
|||
|
||||
void NotificationPresenterLinux::ShowNotification(
|
||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
||||
content::DesktopNotificationDelegate* delegate,
|
||||
scoped_ptr<content::DesktopNotificationDelegate> delegate_ptr,
|
||||
base::Closure* cancel_callback) {
|
||||
std::string title = base::UTF16ToUTF8(params.title);
|
||||
std::string body = base::UTF16ToUTF8(params.body);
|
||||
NotifyNotification* notification = notify_notification_new(title.c_str(), body.c_str(), nullptr);
|
||||
|
||||
g_object_set_data(G_OBJECT(notification), "delegate", delegate);
|
||||
content::DesktopNotificationDelegate* delegate = delegate_ptr.release();
|
||||
|
||||
g_object_set_data_full(G_OBJECT(notification), "delegate", delegate, operator delete);
|
||||
g_signal_connect(notification, "closed", G_CALLBACK(OnNotificationClosedThunk), this);
|
||||
notify_notification_add_action(notification, "default", "View", OnNotificationViewThunk, this,
|
||||
nullptr);
|
||||
|
|
|
@ -27,7 +27,7 @@ class NotificationPresenterLinux : public NotificationPresenter {
|
|||
// NotificationPresenter:
|
||||
virtual void ShowNotification(
|
||||
const content::ShowDesktopNotificationHostMsgParams&,
|
||||
content::DesktopNotificationDelegate* delegate,
|
||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||
base::Closure* cancel_callback) OVERRIDE;
|
||||
|
||||
void CancelNotification(NotifyNotification* notification);
|
||||
|
|
|
@ -138,9 +138,8 @@ void MediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(
|
|||
int render_view_id,
|
||||
int page_request_id,
|
||||
const GURL& security_origin,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaStreamType stream_type,
|
||||
content::MediaRequestState state) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
}
|
||||
|
||||
void MediaCaptureDevicesDispatcher::OnAudioStreamPlaying(
|
||||
|
|
|
@ -58,8 +58,8 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
|
|||
int render_view_id,
|
||||
int page_request_id,
|
||||
const GURL& security_origin,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) OVERRIDE;
|
||||
content::MediaStreamType stream_type,
|
||||
content::MediaRequestState state) override;
|
||||
virtual void OnAudioStreamPlaying(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
||||
namespace content {
|
||||
class DesktopNotificationDelegate;
|
||||
|
@ -18,7 +19,7 @@ class NotificationPresenter {
|
|||
|
||||
virtual void ShowNotification(
|
||||
const content::ShowDesktopNotificationHostMsgParams&,
|
||||
content::DesktopNotificationDelegate* delegate,
|
||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||
base::Closure* cancel_callback) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ class NotificationPresenterMac : public NotificationPresenter {
|
|||
|
||||
virtual void ShowNotification(
|
||||
const content::ShowDesktopNotificationHostMsgParams&,
|
||||
content::DesktopNotificationDelegate* delegate,
|
||||
base::Closure* cancel_callback) OVERRIDE;
|
||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||
base::Closure* cancel_callback) override;
|
||||
|
||||
// Get the delegate accroding from the notification object.
|
||||
content::DesktopNotificationDelegate* GetDelegateFromNotification(
|
||||
|
|
|
@ -41,20 +41,20 @@ NotificationPresenterMac::~NotificationPresenterMac() {
|
|||
|
||||
void NotificationPresenterMac::ShowNotification(
|
||||
const content::ShowDesktopNotificationHostMsgParams& params,
|
||||
content::DesktopNotificationDelegate* delegate,
|
||||
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
||||
base::Closure* cancel_callback) {
|
||||
auto notification = [[NSUserNotification alloc] init];
|
||||
notification.title = base::SysUTF16ToNSString(params.title);
|
||||
notification.informativeText = base::SysUTF16ToNSString(params.body);
|
||||
|
||||
notifications_map_[delegate].reset(notification);
|
||||
notifications_map_[delegate.get()].reset(notification);
|
||||
[NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:notification];
|
||||
|
||||
if (cancel_callback)
|
||||
*cancel_callback = base::Bind(
|
||||
&NotificationPresenterMac::CancelNotification,
|
||||
base::Unretained(this),
|
||||
delegate);
|
||||
delegate.release());
|
||||
}
|
||||
|
||||
content::DesktopNotificationDelegate* NotificationPresenterMac::GetDelegateFromNotification(
|
||||
|
@ -67,8 +67,10 @@ content::DesktopNotificationDelegate* NotificationPresenterMac::GetDelegateFromN
|
|||
}
|
||||
|
||||
void NotificationPresenterMac::RemoveNotification(content::DesktopNotificationDelegate* delegate) {
|
||||
if (ContainsKey(notifications_map_, delegate))
|
||||
if (ContainsKey(notifications_map_, delegate)) {
|
||||
delete delegate;
|
||||
notifications_map_.erase(delegate);
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationPresenterMac::CancelNotification(content::DesktopNotificationDelegate* delegate) {
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "net/proxy/proxy_script_fetcher_impl.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
#include "net/proxy/proxy_service_v8.h"
|
||||
#include "net/ssl/default_server_bound_cert_store.h"
|
||||
#include "net/ssl/server_bound_cert_service.h"
|
||||
#include "net/ssl/channel_id_service.h"
|
||||
#include "net/ssl/default_channel_id_store.h"
|
||||
#include "net/ssl/ssl_config_service_defaults.h"
|
||||
#include "net/url_request/data_protocol_handler.h"
|
||||
#include "net/url_request/file_protocol_handler.h"
|
||||
|
@ -145,8 +145,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
|||
content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
|
||||
NULL, NULL);
|
||||
storage_->set_cookie_store(content::CreateCookieStore(cookie_config));
|
||||
storage_->set_server_bound_cert_service(new net::ServerBoundCertService(
|
||||
new net::DefaultServerBoundCertStore(NULL),
|
||||
storage_->set_channel_id_service(new net::ChannelIDService(
|
||||
new net::DefaultChannelIDStore(NULL),
|
||||
base::WorkerPool::GetTaskRunner(true)));
|
||||
storage_->set_http_user_agent_settings(new net::StaticHttpUserAgentSettings(
|
||||
"en-us,en", base::EmptyString()));
|
||||
|
@ -197,8 +197,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
|||
network_session_params.ignore_certificate_errors = false;
|
||||
network_session_params.transport_security_state =
|
||||
url_request_context_->transport_security_state();
|
||||
network_session_params.server_bound_cert_service =
|
||||
url_request_context_->server_bound_cert_service();
|
||||
network_session_params.channel_id_service =
|
||||
url_request_context_->channel_id_service();
|
||||
network_session_params.http_auth_handler_factory =
|
||||
url_request_context_->http_auth_handler_factory();
|
||||
|
||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 887f3b7895c55625d20d7ea06fa041dcacdb8b47
|
||||
Subproject commit f9abe65eddd9f233e215151c7487ac19af2a60d9
|
Loading…
Reference in a new issue