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