Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2971)

Unified Diff: chrome/renderer/notification_provider.cc

Issue 6151011: Introduce RenderView::Observer interface so that RenderView doesn't have to k... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/notification_provider.h ('k') | chrome/renderer/page_click_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/notification_provider.cc
===================================================================
--- chrome/renderer/notification_provider.cc (revision 71253)
+++ chrome/renderer/notification_provider.cc (working copy)
@@ -25,8 +25,8 @@
using WebKit::WebString;
using WebKit::WebURL;
-NotificationProvider::NotificationProvider(RenderView* view)
- : view_(view) {
+NotificationProvider::NotificationProvider(RenderView* render_view)
+ : RenderViewObserver(render_view) {
}
NotificationProvider::~NotificationProvider() {
@@ -46,7 +46,7 @@
bool id_found = manager_.GetId(notification, id);
// Won't be found if the notification has already been closed by the user.
if (id_found)
- Send(new ViewHostMsg_CancelDesktopNotification(view_->routing_id(), id));
+ Send(new ViewHostMsg_CancelDesktopNotification(routing_id(), id));
}
void NotificationProvider::objectDestroyed(
@@ -62,7 +62,7 @@
const WebURL& url) {
int permission;
Send(new ViewHostMsg_CheckNotificationPermission(
- view_->routing_id(),
+ routing_id(),
url,
&permission));
return static_cast<WebNotificationPresenter::Permission>(permission);
@@ -72,12 +72,12 @@
const WebSecurityOrigin& origin,
WebNotificationPermissionCallback* callback) {
// We only request permission in response to a user gesture.
- if (!view_->webview()->mainFrame()->isProcessingUserGesture())
+ if (!render_view()->webview()->mainFrame()->isProcessingUserGesture())
return;
int id = manager_.RegisterPermissionRequest(callback);
- Send(new ViewHostMsg_RequestNotificationPermission(view_->routing_id(),
+ Send(new ViewHostMsg_RequestNotificationPermission(routing_id(),
GURL(origin.toString()),
id));
}
@@ -93,13 +93,13 @@
OnPermissionRequestComplete);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
+
+ if (message.type() == ViewMsg_Navigate::ID)
+ OnNavigate(); // Don't want to swallow the message.
+
return handled;
}
-void NotificationProvider::OnNavigate() {
- manager_.Clear();
-}
-
bool NotificationProvider::ShowHTML(const WebNotification& notification,
int id) {
// Disallow HTML notifications from unwanted schemes. javascript:
@@ -113,13 +113,13 @@
DCHECK(notification.isHTML());
ViewHostMsg_ShowNotification_Params params;
- params.origin = GURL(view_->webview()->mainFrame()->url()).GetOrigin();
+ params.origin =
+ GURL(render_view()->webview()->mainFrame()->url()).GetOrigin();
params.is_html = true;
params.contents_url = notification.url();
params.notification_id = id;
params.replace_id = notification.replaceId();
- return Send(new ViewHostMsg_ShowDesktopNotification(view_->routing_id(),
- params));
+ return Send(new ViewHostMsg_ShowDesktopNotification(routing_id(), params));
}
bool NotificationProvider::ShowText(const WebNotification& notification,
@@ -127,7 +127,8 @@
DCHECK(!notification.isHTML());
ViewHostMsg_ShowNotification_Params params;
params.is_html = false;
- params.origin = GURL(view_->webview()->mainFrame()->url()).GetOrigin();
+ params.origin = GURL(
+ render_view()->webview()->mainFrame()->url()).GetOrigin();
params.icon_url = notification.iconURL();
params.title = notification.title();
params.body = notification.body();
@@ -135,8 +136,7 @@
params.notification_id = id;
params.replace_id = notification.replaceId();
- return Send(new ViewHostMsg_ShowDesktopNotification(view_->routing_id(),
- params));
+ return Send(new ViewHostMsg_ShowDesktopNotification(routing_id(), params));
}
void NotificationProvider::OnDisplay(int id) {
@@ -184,6 +184,6 @@
manager_.OnPermissionRequestComplete(id);
}
-bool NotificationProvider::Send(IPC::Message* message) {
- return RenderThread::current()->Send(message);
+void NotificationProvider::OnNavigate() {
+ manager_.Clear();
}
« no previous file with comments | « chrome/renderer/notification_provider.h ('k') | chrome/renderer/page_click_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698