| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 24 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
| 25 #include "content/browser/renderer_host/render_process_host.h" | 25 #include "content/browser/renderer_host/render_process_host.h" |
| 26 #include "content/browser/renderer_host/render_view_host_delegate.h" | 26 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 27 #include "content/browser/renderer_host/render_view_host_observer.h" | 27 #include "content/browser/renderer_host/render_view_host_observer.h" |
| 28 #include "content/browser/renderer_host/render_widget_host.h" | 28 #include "content/browser/renderer_host/render_widget_host.h" |
| 29 #include "content/browser/renderer_host/render_widget_host_view.h" | 29 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 30 #include "content/browser/site_instance.h" | 30 #include "content/browser/site_instance.h" |
| 31 #include "content/browser/user_metrics.h" | 31 #include "content/browser/user_metrics.h" |
| 32 #include "content/common/bindings_policy.h" | 32 #include "content/common/bindings_policy.h" |
| 33 #include "content/common/content_constants.h" | 33 #include "content/common/content_constants.h" |
| 34 #include "content/common/content_notification_types.h" |
| 34 #include "content/common/desktop_notification_messages.h" | 35 #include "content/common/desktop_notification_messages.h" |
| 35 #include "content/common/drag_messages.h" | 36 #include "content/common/drag_messages.h" |
| 36 #include "content/common/native_web_keyboard_event.h" | 37 #include "content/common/native_web_keyboard_event.h" |
| 37 #include "content/common/notification_details.h" | 38 #include "content/common/notification_details.h" |
| 38 #include "content/common/notification_service.h" | 39 #include "content/common/notification_service.h" |
| 39 #include "content/common/notification_type.h" | |
| 40 #include "content/common/result_codes.h" | 40 #include "content/common/result_codes.h" |
| 41 #include "content/common/swapped_out_messages.h" | 41 #include "content/common/swapped_out_messages.h" |
| 42 #include "content/common/url_constants.h" | 42 #include "content/common/url_constants.h" |
| 43 #include "content/common/view_messages.h" | 43 #include "content/common/view_messages.h" |
| 44 #include "net/base/net_util.h" | 44 #include "net/base/net_util.h" |
| 45 #include "net/url_request/url_request_context_getter.h" | 45 #include "net/url_request/url_request_context_getter.h" |
| 46 #include "third_party/skia/include/core/SkBitmap.h" | 46 #include "third_party/skia/include/core/SkBitmap.h" |
| 47 #include "ui/gfx/native_widget_types.h" | 47 #include "ui/gfx/native_widget_types.h" |
| 48 #include "webkit/glue/context_menu.h" | 48 #include "webkit/glue/context_menu.h" |
| 49 #include "webkit/glue/webaccessibility.h" | 49 #include "webkit/glue/webaccessibility.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 DCHECK(instance_); | 111 DCHECK(instance_); |
| 112 CHECK(delegate_); // http://crbug.com/82827 | 112 CHECK(delegate_); // http://crbug.com/82827 |
| 113 | 113 |
| 114 process()->EnableSendQueue(); | 114 process()->EnableSendQueue(); |
| 115 | 115 |
| 116 content::GetContentClient()->browser()->RenderViewHostCreated(this); | 116 content::GetContentClient()->browser()->RenderViewHostCreated(this); |
| 117 | 117 |
| 118 NotificationService::current()->Notify( | 118 NotificationService::current()->Notify( |
| 119 NotificationType::RENDER_VIEW_HOST_CREATED, | 119 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, |
| 120 Source<RenderViewHost>(this), | 120 Source<RenderViewHost>(this), |
| 121 NotificationService::NoDetails()); | 121 NotificationService::NoDetails()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 RenderViewHost::~RenderViewHost() { | 124 RenderViewHost::~RenderViewHost() { |
| 125 FOR_EACH_OBSERVER( | 125 FOR_EACH_OBSERVER( |
| 126 RenderViewHostObserver, observers_, RenderViewHostDestruction()); | 126 RenderViewHostObserver, observers_, RenderViewHostDestruction()); |
| 127 | 127 |
| 128 NotificationService::current()->Notify( | 128 NotificationService::current()->Notify( |
| 129 NotificationType::RENDER_VIEW_HOST_DELETED, | 129 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
| 130 Source<RenderViewHost>(this), | 130 Source<RenderViewHost>(this), |
| 131 NotificationService::NoDetails()); | 131 NotificationService::NoDetails()); |
| 132 | 132 |
| 133 delegate()->RenderViewDeleted(this); | 133 delegate()->RenderViewDeleted(this); |
| 134 | 134 |
| 135 // Be sure to clean up any leftover state from cross-site requests. | 135 // Be sure to clean up any leftover state from cross-site requests. |
| 136 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( | 136 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( |
| 137 process()->id(), routing_id(), false); | 137 process()->id(), routing_id(), false); |
| 138 } | 138 } |
| 139 | 139 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 347 |
| 348 void RenderViewHost::ClosePage() { | 348 void RenderViewHost::ClosePage() { |
| 349 // Start the hang monitor in case the renderer hangs in the unload handler. | 349 // Start the hang monitor in case the renderer hangs in the unload handler. |
| 350 is_waiting_for_unload_ack_ = true; | 350 is_waiting_for_unload_ack_ = true; |
| 351 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 351 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
| 352 | 352 |
| 353 if (IsRenderViewLive()) { | 353 if (IsRenderViewLive()) { |
| 354 // TODO(creis): Should this be moved to Shutdown? It may not be called for | 354 // TODO(creis): Should this be moved to Shutdown? It may not be called for |
| 355 // RenderViewHosts that have been swapped out. | 355 // RenderViewHosts that have been swapped out. |
| 356 NotificationService::current()->Notify( | 356 NotificationService::current()->Notify( |
| 357 NotificationType::RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, | 357 content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, |
| 358 Source<RenderViewHost>(this), | 358 Source<RenderViewHost>(this), |
| 359 NotificationService::NoDetails()); | 359 NotificationService::NoDetails()); |
| 360 | 360 |
| 361 Send(new ViewMsg_ClosePage(routing_id())); | 361 Send(new ViewMsg_ClosePage(routing_id())); |
| 362 } else { | 362 } else { |
| 363 // This RenderViewHost doesn't have a live renderer, so just skip the unload | 363 // This RenderViewHost doesn't have a live renderer, so just skip the unload |
| 364 // event and close the page. | 364 // event and close the page. |
| 365 ClosePageIgnoringUnloadEvents(); | 365 ClosePageIgnoringUnloadEvents(); |
| 366 } | 366 } |
| 367 } | 367 } |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { | 1046 void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { |
| 1047 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1047 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1048 if (view) | 1048 if (view) |
| 1049 view->UpdateDragCursor(current_op); | 1049 view->UpdateDragCursor(current_op); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 void RenderViewHost::OnTargetDropACK() { | 1052 void RenderViewHost::OnTargetDropACK() { |
| 1053 NotificationService::current()->Notify( | 1053 NotificationService::current()->Notify( |
| 1054 NotificationType::RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, | 1054 content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, |
| 1055 Source<RenderViewHost>(this), | 1055 Source<RenderViewHost>(this), |
| 1056 NotificationService::NoDetails()); | 1056 NotificationService::NoDetails()); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 void RenderViewHost::OnTakeFocus(bool reverse) { | 1059 void RenderViewHost::OnTakeFocus(bool reverse) { |
| 1060 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1060 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1061 if (view) | 1061 if (view) |
| 1062 view->TakeFocus(reverse); | 1062 view->TakeFocus(reverse); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 // TODO(ctguil): Remove when mac processes OnAccessibilityNotifications. | 1241 // TODO(ctguil): Remove when mac processes OnAccessibilityNotifications. |
| 1242 if (view()) | 1242 if (view()) |
| 1243 view()->UpdateAccessibilityTree(param.acc_obj); | 1243 view()->UpdateAccessibilityTree(param.acc_obj); |
| 1244 | 1244 |
| 1245 if (save_accessibility_tree_for_testing_) | 1245 if (save_accessibility_tree_for_testing_) |
| 1246 accessibility_tree_ = param.acc_obj; | 1246 accessibility_tree_ = param.acc_obj; |
| 1247 } | 1247 } |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 NotificationService::current()->Notify( | 1250 NotificationService::current()->Notify( |
| 1251 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 1251 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
| 1252 Source<RenderViewHost>(this), | 1252 Source<RenderViewHost>(this), |
| 1253 NotificationService::NoDetails()); | 1253 NotificationService::NoDetails()); |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id())); | 1256 Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id())); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) { | 1259 void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) { |
| 1260 Value* result_value; | 1260 Value* result_value; |
| 1261 if (!result.Get(0, &result_value)) { | 1261 if (!result.Get(0, &result_value)) { |
| 1262 // Programming error or rogue renderer. | 1262 // Programming error or rogue renderer. |
| 1263 NOTREACHED() << "Got bad arguments for OnScriptEvalResponse"; | 1263 NOTREACHED() << "Got bad arguments for OnScriptEvalResponse"; |
| 1264 return; | 1264 return; |
| 1265 } | 1265 } |
| 1266 std::pair<int, Value*> details(id, result_value); | 1266 std::pair<int, Value*> details(id, result_value); |
| 1267 NotificationService::current()->Notify( | 1267 NotificationService::current()->Notify( |
| 1268 NotificationType::EXECUTE_JAVASCRIPT_RESULT, | 1268 content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, |
| 1269 Source<RenderViewHost>(this), | 1269 Source<RenderViewHost>(this), |
| 1270 Details<std::pair<int, Value*> >(&details)); | 1270 Details<std::pair<int, Value*> >(&details)); |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 void RenderViewHost::OnDidZoomURL(double zoom_level, | 1273 void RenderViewHost::OnDidZoomURL(double zoom_level, |
| 1274 bool remember, | 1274 bool remember, |
| 1275 const GURL& url) { | 1275 const GURL& url) { |
| 1276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1277 HostZoomMap* host_zoom_map = process()->profile()->GetHostZoomMap(); | 1277 HostZoomMap* host_zoom_map = process()->profile()->GetHostZoomMap(); |
| 1278 if (remember) { | 1278 if (remember) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 if (view) { | 1327 if (view) { |
| 1328 view->ShowPopupMenu(params.bounds, | 1328 view->ShowPopupMenu(params.bounds, |
| 1329 params.item_height, | 1329 params.item_height, |
| 1330 params.item_font_size, | 1330 params.item_font_size, |
| 1331 params.selected_item, | 1331 params.selected_item, |
| 1332 params.popup_items, | 1332 params.popup_items, |
| 1333 params.right_aligned); | 1333 params.right_aligned); |
| 1334 } | 1334 } |
| 1335 } | 1335 } |
| 1336 #endif | 1336 #endif |
| OLD | NEW |