| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "content/public/browser/dom_operation_notification_details.h" | 38 #include "content/public/browser/dom_operation_notification_details.h" |
| 39 #include "content/public/browser/native_web_keyboard_event.h" | 39 #include "content/public/browser/native_web_keyboard_event.h" |
| 40 #include "content/public/browser/notification_details.h" | 40 #include "content/public/browser/notification_details.h" |
| 41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
| 42 #include "content/public/browser/notification_types.h" | 42 #include "content/public/browser/notification_types.h" |
| 43 #include "content/public/browser/render_view_host_delegate.h" | 43 #include "content/public/browser/render_view_host_delegate.h" |
| 44 #include "content/public/browser/render_view_host_observer.h" | 44 #include "content/public/browser/render_view_host_observer.h" |
| 45 #include "content/public/browser/user_metrics.h" | 45 #include "content/public/browser/user_metrics.h" |
| 46 #include "content/public/common/bindings_policy.h" | 46 #include "content/public/common/bindings_policy.h" |
| 47 #include "content/public/common/content_constants.h" | 47 #include "content/public/common/content_constants.h" |
| 48 #include "content/public/common/context_menu_params.h" |
| 48 #include "content/public/common/result_codes.h" | 49 #include "content/public/common/result_codes.h" |
| 49 #include "content/public/common/url_constants.h" | 50 #include "content/public/common/url_constants.h" |
| 50 #include "net/base/net_util.h" | 51 #include "net/base/net_util.h" |
| 51 #include "net/url_request/url_request_context_getter.h" | 52 #include "net/url_request/url_request_context_getter.h" |
| 52 #include "third_party/skia/include/core/SkBitmap.h" | 53 #include "third_party/skia/include/core/SkBitmap.h" |
| 53 #include "ui/gfx/native_widget_types.h" | 54 #include "ui/gfx/native_widget_types.h" |
| 54 #include "webkit/fileapi/isolated_context.h" | 55 #include "webkit/fileapi/isolated_context.h" |
| 55 #include "webkit/glue/context_menu.h" | |
| 56 #include "webkit/glue/webaccessibility.h" | 56 #include "webkit/glue/webaccessibility.h" |
| 57 #include "webkit/glue/webdropdata.h" | 57 #include "webkit/glue/webdropdata.h" |
| 58 | 58 |
| 59 using base::TimeDelta; | 59 using base::TimeDelta; |
| 60 using content::BrowserMessageFilter; | 60 using content::BrowserMessageFilter; |
| 61 using content::BrowserThread; | 61 using content::BrowserThread; |
| 62 using content::DomOperationNotificationDetails; | 62 using content::DomOperationNotificationDetails; |
| 63 using content::RenderViewHostDelegate; | 63 using content::RenderViewHostDelegate; |
| 64 using content::SiteInstance; | 64 using content::SiteInstance; |
| 65 using content::UserMetricsAction; | 65 using content::UserMetricsAction; |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 void RenderViewHost::OnMsgDocumentAvailableInMainFrame() { | 1023 void RenderViewHost::OnMsgDocumentAvailableInMainFrame() { |
| 1024 delegate_->DocumentAvailableInMainFrame(this); | 1024 delegate_->DocumentAvailableInMainFrame(this); |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 void RenderViewHost::OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id) { | 1027 void RenderViewHost::OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id) { |
| 1028 delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id); | 1028 delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) { | 1031 void RenderViewHost::OnMsgContextMenu( |
| 1032 const content::ContextMenuParams& params) { |
| 1032 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1033 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1033 if (!view) | 1034 if (!view) |
| 1034 return; | 1035 return; |
| 1035 | 1036 |
| 1036 // Validate the URLs in |params|. If the renderer can't request the URLs | 1037 // Validate the URLs in |params|. If the renderer can't request the URLs |
| 1037 // directly, don't show them in the context menu. | 1038 // directly, don't show them in the context menu. |
| 1038 ContextMenuParams validated_params(params); | 1039 content::ContextMenuParams validated_params(params); |
| 1039 int renderer_id = process()->GetID(); | 1040 int renderer_id = process()->GetID(); |
| 1040 ChildProcessSecurityPolicyImpl* policy = | 1041 ChildProcessSecurityPolicyImpl* policy = |
| 1041 ChildProcessSecurityPolicyImpl::GetInstance(); | 1042 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 1042 | 1043 |
| 1043 // We don't validate |unfiltered_link_url| so that this field can be used | 1044 // We don't validate |unfiltered_link_url| so that this field can be used |
| 1044 // when users want to copy the original link URL. | 1045 // when users want to copy the original link URL. |
| 1045 FilterURL(policy, renderer_id, &validated_params.link_url); | 1046 FilterURL(policy, renderer_id, &validated_params.link_url); |
| 1046 FilterURL(policy, renderer_id, &validated_params.src_url); | 1047 FilterURL(policy, renderer_id, &validated_params.src_url); |
| 1047 FilterURL(policy, renderer_id, &validated_params.page_url); | 1048 FilterURL(policy, renderer_id, &validated_params.page_url); |
| 1048 FilterURL(policy, renderer_id, &validated_params.frame_url); | 1049 FilterURL(policy, renderer_id, &validated_params.frame_url); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id())); | 1391 Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id())); |
| 1391 } | 1392 } |
| 1392 | 1393 |
| 1393 void RenderViewHost::EnableAutoResize(const gfx::Size& min_size, | 1394 void RenderViewHost::EnableAutoResize(const gfx::Size& min_size, |
| 1394 const gfx::Size& max_size) { | 1395 const gfx::Size& max_size) { |
| 1395 SetShouldAutoResize(true); | 1396 SetShouldAutoResize(true); |
| 1396 Send(new ViewMsg_EnableAutoResize(routing_id(), min_size, max_size)); | 1397 Send(new ViewMsg_EnableAutoResize(routing_id(), min_size, max_size)); |
| 1397 } | 1398 } |
| 1398 | 1399 |
| 1399 void RenderViewHost::ExecuteCustomContextMenuCommand( | 1400 void RenderViewHost::ExecuteCustomContextMenuCommand( |
| 1400 int action, const webkit_glue::CustomContextMenuContext& context) { | 1401 int action, const content::CustomContextMenuContext& context) { |
| 1401 Send(new ViewMsg_CustomContextMenuAction(routing_id(), context, action)); | 1402 Send(new ViewMsg_CustomContextMenuAction(routing_id(), context, action)); |
| 1402 } | 1403 } |
| 1403 | 1404 |
| 1404 void RenderViewHost::NotifyContextMenuClosed( | 1405 void RenderViewHost::NotifyContextMenuClosed( |
| 1405 const webkit_glue::CustomContextMenuContext& context) { | 1406 const content::CustomContextMenuContext& context) { |
| 1406 Send(new ViewMsg_ContextMenuClosed(routing_id(), context)); | 1407 Send(new ViewMsg_ContextMenuClosed(routing_id(), context)); |
| 1407 } | 1408 } |
| 1408 | 1409 |
| 1409 void RenderViewHost::CopyImageAt(int x, int y) { | 1410 void RenderViewHost::CopyImageAt(int x, int y) { |
| 1410 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); | 1411 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); |
| 1411 } | 1412 } |
| 1412 | 1413 |
| 1413 void RenderViewHost::ExecuteMediaPlayerActionAtLocation( | 1414 void RenderViewHost::ExecuteMediaPlayerActionAtLocation( |
| 1414 const gfx::Point& location, const WebKit::WebMediaPlayerAction& action) { | 1415 const gfx::Point& location, const WebKit::WebMediaPlayerAction& action) { |
| 1415 Send(new ViewMsg_MediaPlayerActionAt(routing_id(), location, action)); | 1416 Send(new ViewMsg_MediaPlayerActionAt(routing_id(), location, action)); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 // Whenever we change swap out state, we should not be waiting for | 1576 // Whenever we change swap out state, we should not be waiting for |
| 1576 // beforeunload or unload acks. We clear them here to be safe, since they | 1577 // beforeunload or unload acks. We clear them here to be safe, since they |
| 1577 // can cause navigations to be ignored in OnMsgNavigate. | 1578 // can cause navigations to be ignored in OnMsgNavigate. |
| 1578 is_waiting_for_beforeunload_ack_ = false; | 1579 is_waiting_for_beforeunload_ack_ = false; |
| 1579 is_waiting_for_unload_ack_ = false; | 1580 is_waiting_for_unload_ack_ = false; |
| 1580 } | 1581 } |
| 1581 | 1582 |
| 1582 void RenderViewHost::ClearPowerSaveBlockers() { | 1583 void RenderViewHost::ClearPowerSaveBlockers() { |
| 1583 STLDeleteValues(&power_save_blockers_); | 1584 STLDeleteValues(&power_save_blockers_); |
| 1584 } | 1585 } |
| OLD | NEW |