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

Side by Side Diff: content/browser/renderer_host/render_view_host.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_view_host.h" 5 #include "content/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 #include "content/browser/renderer_host/render_process_host.h" 26 #include "content/browser/renderer_host/render_process_host.h"
27 #include "content/browser/renderer_host/render_view_host_delegate.h" 27 #include "content/browser/renderer_host/render_view_host_delegate.h"
28 #include "content/browser/renderer_host/render_view_host_observer.h" 28 #include "content/browser/renderer_host/render_view_host_observer.h"
29 #include "content/browser/renderer_host/render_widget_host.h" 29 #include "content/browser/renderer_host/render_widget_host.h"
30 #include "content/browser/renderer_host/render_widget_host_view.h" 30 #include "content/browser/renderer_host/render_widget_host_view.h"
31 #include "content/browser/site_instance.h" 31 #include "content/browser/site_instance.h"
32 #include "content/browser/user_metrics.h" 32 #include "content/browser/user_metrics.h"
33 #include "content/common/content_constants.h" 33 #include "content/common/content_constants.h"
34 #include "content/common/desktop_notification_messages.h" 34 #include "content/common/desktop_notification_messages.h"
35 #include "content/common/drag_messages.h" 35 #include "content/common/drag_messages.h"
36 #include "content/common/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/common/result_codes.h" 37 #include "content/common/result_codes.h"
38 #include "content/common/speech_input_messages.h" 38 #include "content/common/speech_input_messages.h"
39 #include "content/common/swapped_out_messages.h" 39 #include "content/common/swapped_out_messages.h"
40 #include "content/common/view_messages.h" 40 #include "content/common/view_messages.h"
41 #include "content/public/browser/content_browser_client.h" 41 #include "content/public/browser/content_browser_client.h"
42 #include "content/public/browser/native_web_keyboard_event.h" 42 #include "content/public/browser/native_web_keyboard_event.h"
43 #include "content/public/browser/notification_details.h" 43 #include "content/public/browser/notification_details.h"
44 #include "content/public/browser/notification_types.h" 44 #include "content/public/browser/notification_types.h"
45 #include "content/public/common/bindings_policy.h" 45 #include "content/public/common/bindings_policy.h"
46 #include "content/public/common/url_constants.h" 46 #include "content/public/common/url_constants.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 process()->browser_context()->GetWebKitContext()); 124 process()->browser_context()->GetWebKitContext());
125 } 125 }
126 126
127 DCHECK(instance_); 127 DCHECK(instance_);
128 CHECK(delegate_); // http://crbug.com/82827 128 CHECK(delegate_); // http://crbug.com/82827
129 129
130 process()->EnableSendQueue(); 130 process()->EnableSendQueue();
131 131
132 content::GetContentClient()->browser()->RenderViewHostCreated(this); 132 content::GetContentClient()->browser()->RenderViewHostCreated(this);
133 133
134 NotificationService::current()->Notify( 134 content::NotificationService::current()->Notify(
135 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, 135 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED,
136 content::Source<RenderViewHost>(this), 136 content::Source<RenderViewHost>(this),
137 NotificationService::NoDetails()); 137 content::NotificationService::NoDetails());
138 } 138 }
139 139
140 RenderViewHost::~RenderViewHost() { 140 RenderViewHost::~RenderViewHost() {
141 FOR_EACH_OBSERVER( 141 FOR_EACH_OBSERVER(
142 RenderViewHostObserver, observers_, RenderViewHostDestruction()); 142 RenderViewHostObserver, observers_, RenderViewHostDestruction());
143 143
144 NotificationService::current()->Notify( 144 content::NotificationService::current()->Notify(
145 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, 145 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
146 content::Source<RenderViewHost>(this), 146 content::Source<RenderViewHost>(this),
147 NotificationService::NoDetails()); 147 content::NotificationService::NoDetails());
148 148
149 ClearPowerSaveBlockers(); 149 ClearPowerSaveBlockers();
150 150
151 delegate()->RenderViewDeleted(this); 151 delegate()->RenderViewDeleted(this);
152 152
153 // Be sure to clean up any leftover state from cross-site requests. 153 // Be sure to clean up any leftover state from cross-site requests.
154 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( 154 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest(
155 process()->id(), routing_id(), false); 155 process()->id(), routing_id(), false);
156 } 156 }
157 157
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 void RenderViewHost::ClosePage() { 365 void RenderViewHost::ClosePage() {
366 // Start the hang monitor in case the renderer hangs in the unload handler. 366 // Start the hang monitor in case the renderer hangs in the unload handler.
367 is_waiting_for_unload_ack_ = true; 367 is_waiting_for_unload_ack_ = true;
368 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); 368 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
369 369
370 if (IsRenderViewLive()) { 370 if (IsRenderViewLive()) {
371 // TODO(creis): Should this be moved to Shutdown? It may not be called for 371 // TODO(creis): Should this be moved to Shutdown? It may not be called for
372 // RenderViewHosts that have been swapped out. 372 // RenderViewHosts that have been swapped out.
373 NotificationService::current()->Notify( 373 content::NotificationService::current()->Notify(
374 content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, 374 content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW,
375 content::Source<RenderViewHost>(this), 375 content::Source<RenderViewHost>(this),
376 NotificationService::NoDetails()); 376 content::NotificationService::NoDetails());
377 377
378 Send(new ViewMsg_ClosePage(routing_id())); 378 Send(new ViewMsg_ClosePage(routing_id()));
379 } else { 379 } else {
380 // This RenderViewHost doesn't have a live renderer, so just skip the unload 380 // This RenderViewHost doesn't have a live renderer, so just skip the unload
381 // event and close the page. 381 // event and close the page.
382 ClosePageIgnoringUnloadEvents(); 382 ClosePageIgnoringUnloadEvents();
383 } 383 }
384 } 384 }
385 385
386 void RenderViewHost::ClosePageIgnoringUnloadEvents() { 386 void RenderViewHost::ClosePageIgnoringUnloadEvents() {
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 } 1067 }
1068 } 1068 }
1069 1069
1070 void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { 1070 void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) {
1071 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); 1071 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1072 if (view) 1072 if (view)
1073 view->UpdateDragCursor(current_op); 1073 view->UpdateDragCursor(current_op);
1074 } 1074 }
1075 1075
1076 void RenderViewHost::OnTargetDropACK() { 1076 void RenderViewHost::OnTargetDropACK() {
1077 NotificationService::current()->Notify( 1077 content::NotificationService::current()->Notify(
1078 content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, 1078 content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK,
1079 content::Source<RenderViewHost>(this), 1079 content::Source<RenderViewHost>(this),
1080 NotificationService::NoDetails()); 1080 content::NotificationService::NoDetails());
1081 } 1081 }
1082 1082
1083 void RenderViewHost::OnTakeFocus(bool reverse) { 1083 void RenderViewHost::OnTakeFocus(bool reverse) {
1084 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); 1084 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1085 if (view) 1085 if (view)
1086 view->TakeFocus(reverse); 1086 view->TakeFocus(reverse);
1087 } 1087 }
1088 1088
1089 void RenderViewHost::OnAddMessageToConsole(int32 level, 1089 void RenderViewHost::OnAddMessageToConsole(int32 level,
1090 const string16& message, 1090 const string16& message,
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 if (!params.empty()) { 1337 if (!params.empty()) {
1338 for (unsigned i = 0; i < params.size(); i++) { 1338 for (unsigned i = 0; i < params.size(); i++) {
1339 const ViewHostMsg_AccessibilityNotification_Params& param = params[i]; 1339 const ViewHostMsg_AccessibilityNotification_Params& param = params[i];
1340 1340
1341 if (param.notification_type == ViewHostMsg_AccEvent::LOAD_COMPLETE && 1341 if (param.notification_type == ViewHostMsg_AccEvent::LOAD_COMPLETE &&
1342 save_accessibility_tree_for_testing_) { 1342 save_accessibility_tree_for_testing_) {
1343 accessibility_tree_ = param.acc_tree; 1343 accessibility_tree_ = param.acc_tree;
1344 } 1344 }
1345 } 1345 }
1346 1346
1347 NotificationService::current()->Notify( 1347 content::NotificationService::current()->Notify(
1348 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, 1348 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
1349 content::Source<RenderViewHost>(this), 1349 content::Source<RenderViewHost>(this),
1350 NotificationService::NoDetails()); 1350 content::NotificationService::NoDetails());
1351 } 1351 }
1352 1352
1353 Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id())); 1353 Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id()));
1354 } 1354 }
1355 1355
1356 void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) { 1356 void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) {
1357 Value* result_value; 1357 Value* result_value;
1358 if (!result.Get(0, &result_value)) { 1358 if (!result.Get(0, &result_value)) {
1359 // Programming error or rogue renderer. 1359 // Programming error or rogue renderer.
1360 NOTREACHED() << "Got bad arguments for OnScriptEvalResponse"; 1360 NOTREACHED() << "Got bad arguments for OnScriptEvalResponse";
1361 return; 1361 return;
1362 } 1362 }
1363 std::pair<int, Value*> details(id, result_value); 1363 std::pair<int, Value*> details(id, result_value);
1364 NotificationService::current()->Notify( 1364 content::NotificationService::current()->Notify(
1365 content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, 1365 content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT,
1366 content::Source<RenderViewHost>(this), 1366 content::Source<RenderViewHost>(this),
1367 content::Details<std::pair<int, Value*> >(&details)); 1367 content::Details<std::pair<int, Value*> >(&details));
1368 } 1368 }
1369 1369
1370 void RenderViewHost::OnDidZoomURL(double zoom_level, 1370 void RenderViewHost::OnDidZoomURL(double zoom_level,
1371 bool remember, 1371 bool remember,
1372 const GURL& url) { 1372 const GURL& url) {
1373 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1373 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1374 HostZoomMap* host_zoom_map = process()->browser_context()->GetHostZoomMap(); 1374 HostZoomMap* host_zoom_map = process()->browser_context()->GetHostZoomMap();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 1460
1461 void RenderViewHost::OnWebUISend(const GURL& source_url, 1461 void RenderViewHost::OnWebUISend(const GURL& source_url,
1462 const std::string& name, 1462 const std::string& name,
1463 const base::ListValue& args) { 1463 const base::ListValue& args) {
1464 delegate_->WebUISend(this, source_url, name, args); 1464 delegate_->WebUISend(this, source_url, name, args);
1465 } 1465 }
1466 1466
1467 void RenderViewHost::ClearPowerSaveBlockers() { 1467 void RenderViewHost::ClearPowerSaveBlockers() {
1468 STLDeleteValues(&power_save_blockers_); 1468 STLDeleteValues(&power_save_blockers_);
1469 } 1469 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host.cc ('k') | content/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698