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/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 static const char kBackForwardNavigationScheme[] = "history"; | 254 static const char kBackForwardNavigationScheme[] = "history"; |
255 | 255 |
256 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 256 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
257 WebVector<WebURL> urls; | 257 WebVector<WebURL> urls; |
258 ds->redirectChain(urls); | 258 ds->redirectChain(urls); |
259 result->reserve(urls.size()); | 259 result->reserve(urls.size()); |
260 for (size_t i = 0; i < urls.size(); ++i) | 260 for (size_t i = 0; i < urls.size(); ++i) |
261 result->push_back(urls[i]); | 261 result->push_back(urls[i]); |
262 } | 262 } |
263 | 263 |
264 // True if |frame| contains content that is white-listed for content settings. | |
265 static bool IsWhitelistedForContentSettings(WebFrame* frame) { | |
266 WebSecurityOrigin origin = frame->securityOrigin(); | |
267 if (origin.isEmpty()) | |
268 return false; // Uninitialized document? | |
269 | |
270 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) | |
271 return true; // Browser UI elements should still work. | |
272 | |
273 // If the scheme is ftp: or file:, an empty file name indicates a directory | |
274 // listing, which requires JavaScript to function properly. | |
275 GURL frame_url = frame->url(); | |
276 const char* kDirProtocols[] = { "ftp", "file" }; | |
277 for (size_t i = 0; i < arraysize(kDirProtocols); ++i) { | |
278 if (EqualsASCII(origin.protocol(), kDirProtocols[i])) { | |
279 return frame_url.SchemeIs(kDirProtocols[i]) && | |
280 frame_url.ExtractFileName().empty(); | |
281 } | |
282 } | |
283 | |
284 return false; | |
285 } | |
286 | |
287 static bool WebAccessibilityNotificationToViewHostMsg( | 264 static bool WebAccessibilityNotificationToViewHostMsg( |
288 WebAccessibilityNotification notification, | 265 WebAccessibilityNotification notification, |
289 ViewHostMsg_AccessibilityNotification_Type::Value* type) { | 266 ViewHostMsg_AccessibilityNotification_Type::Value* type) { |
290 switch (notification) { | 267 switch (notification) { |
291 case WebKit::WebAccessibilityNotificationCheckedStateChanged: | 268 case WebKit::WebAccessibilityNotificationCheckedStateChanged: |
292 *type = ViewHostMsg_AccessibilityNotification_Type:: | 269 *type = ViewHostMsg_AccessibilityNotification_Type:: |
293 NOTIFICATION_TYPE_CHECK_STATE_CHANGED; | 270 NOTIFICATION_TYPE_CHECK_STATE_CHANGED; |
294 break; | 271 break; |
295 case WebKit::WebAccessibilityNotificationChildrenChanged: | 272 case WebKit::WebAccessibilityNotificationChildrenChanged: |
296 *type = ViewHostMsg_AccessibilityNotification_Type:: | 273 *type = ViewHostMsg_AccessibilityNotification_Type:: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 target_url_status_(TARGET_NONE), | 370 target_url_status_(TARGET_NONE), |
394 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 371 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
395 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), | 372 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), |
396 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 373 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
397 geolocation_dispatcher_(NULL), | 374 geolocation_dispatcher_(NULL), |
398 speech_input_dispatcher_(NULL), | 375 speech_input_dispatcher_(NULL), |
399 device_orientation_dispatcher_(NULL), | 376 device_orientation_dispatcher_(NULL), |
400 accessibility_ack_pending_(false), | 377 accessibility_ack_pending_(false), |
401 p2p_socket_dispatcher_(NULL), | 378 p2p_socket_dispatcher_(NULL), |
402 session_storage_namespace_id_(session_storage_namespace_id) { | 379 session_storage_namespace_id_(session_storage_namespace_id) { |
403 | |
404 ClearBlockedContentSettings(); | |
405 | |
406 routing_id_ = routing_id; | 380 routing_id_ = routing_id; |
407 if (opener_id != MSG_ROUTING_NONE) | 381 if (opener_id != MSG_ROUTING_NONE) |
408 opener_id_ = opener_id; | 382 opener_id_ = opener_id; |
409 | 383 |
410 webwidget_ = WebView::create(this); | 384 webwidget_ = WebView::create(this); |
411 | 385 |
412 if (counter) { | 386 if (counter) { |
413 shared_popup_counter_ = counter; | 387 shared_popup_counter_ = counter; |
414 shared_popup_counter_->data++; | 388 shared_popup_counter_->data++; |
415 decrement_shared_popup_at_destruction_ = true; | 389 decrement_shared_popup_at_destruction_ = true; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 622 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
649 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 623 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
650 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 624 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
651 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 625 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
652 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 626 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
653 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 627 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
654 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 628 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
655 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 629 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
656 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 630 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
657 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 631 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
658 IPC_MESSAGE_HANDLER(ViewMsg_SetContentSettingsForLoadingURL, | |
659 OnSetContentSettingsForLoadingURL) | |
660 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 632 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
661 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 633 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
662 OnSetZoomLevelForLoadingURL) | 634 OnSetZoomLevelForLoadingURL) |
663 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 635 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
664 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 636 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
665 OnResetPageEncodingToDefault) | 637 OnResetPageEncodingToDefault) |
666 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 638 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
667 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 639 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
668 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 640 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
669 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 641 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 if (!node.isNull()) { | 936 if (!node.isNull()) { |
965 if (IsEditableNode(node)) | 937 if (IsEditableNode(node)) |
966 // TODO(varunjain): Change webkit API to scroll a particular node into | 938 // TODO(varunjain): Change webkit API to scroll a particular node into |
967 // view and use that API here instead. | 939 // view and use that API here instead. |
968 webview()->scrollFocusedNodeIntoView(); | 940 webview()->scrollFocusedNodeIntoView(); |
969 } | 941 } |
970 } | 942 } |
971 | 943 |
972 /////////////////////////////////////////////////////////////////////////////// | 944 /////////////////////////////////////////////////////////////////////////////// |
973 | 945 |
974 void RenderView::SetContentSettings(const ContentSettings& settings) { | |
975 current_content_settings_ = settings; | |
976 } | |
977 | |
978 // Tell the embedding application that the URL of the active page has changed | 946 // Tell the embedding application that the URL of the active page has changed |
979 void RenderView::UpdateURL(WebFrame* frame) { | 947 void RenderView::UpdateURL(WebFrame* frame) { |
980 WebDataSource* ds = frame->dataSource(); | 948 WebDataSource* ds = frame->dataSource(); |
981 DCHECK(ds); | 949 DCHECK(ds); |
982 | 950 |
983 const WebURLRequest& request = ds->request(); | 951 const WebURLRequest& request = ds->request(); |
984 const WebURLRequest& original_request = ds->originalRequest(); | 952 const WebURLRequest& original_request = ds->originalRequest(); |
985 const WebURLResponse& response = ds->response(); | 953 const WebURLResponse& response = ds->response(); |
986 | 954 |
987 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 955 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 const WebHistoryItem& item = frame->currentHistoryItem(); | 1003 const WebHistoryItem& item = frame->currentHistoryItem(); |
1036 if (!item.isNull()) { | 1004 if (!item.isNull()) { |
1037 params.content_state = webkit_glue::HistoryItemToString(item); | 1005 params.content_state = webkit_glue::HistoryItemToString(item); |
1038 } else { | 1006 } else { |
1039 params.content_state = | 1007 params.content_state = |
1040 webkit_glue::CreateHistoryStateForURL(GURL(request.url())); | 1008 webkit_glue::CreateHistoryStateForURL(GURL(request.url())); |
1041 } | 1009 } |
1042 | 1010 |
1043 if (!frame->parent()) { | 1011 if (!frame->parent()) { |
1044 // Top-level navigation. | 1012 // Top-level navigation. |
1045 | |
1046 // Clear "block" flags for the new page. This needs to happen before any of | |
1047 // allowScripts(), allowImages(), allowPlugins() is called for the new page | |
1048 // so that these functions can correctly detect that a piece of content | |
1049 // flipped from "not blocked" to "blocked". | |
1050 ClearBlockedContentSettings(); | |
1051 | |
1052 // Set content settings. Default them from the parent window if one exists. | |
1053 // This makes sure about:blank windows work as expected. | |
1054 HostContentSettings::iterator host_content_settings = | |
1055 host_content_settings_.find(GURL(request.url())); | |
1056 if (host_content_settings != host_content_settings_.end()) { | |
1057 SetContentSettings(host_content_settings->second); | |
1058 | |
1059 // These content settings were merely recorded transiently for this load. | |
1060 // We can erase them now. If at some point we reload this page, the | |
1061 // browser will send us new, up-to-date content settings. | |
1062 host_content_settings_.erase(host_content_settings); | |
1063 } else if (frame->opener()) { | |
1064 // The opener's view is not guaranteed to be non-null (it could be | |
1065 // detached from its page but not yet destructed). | |
1066 if (WebView* opener_view = frame->opener()->view()) { | |
1067 RenderView* opener = FromWebView(opener_view); | |
1068 SetContentSettings(opener->current_content_settings_); | |
1069 } | |
1070 } | |
1071 | |
1072 // Set zoom level, but don't do it for full-page plugin since they don't use | 1013 // Set zoom level, but don't do it for full-page plugin since they don't use |
1073 // the same zoom settings. | 1014 // the same zoom settings. |
1074 HostZoomLevels::iterator host_zoom = | 1015 HostZoomLevels::iterator host_zoom = |
1075 host_zoom_levels_.find(GURL(request.url())); | 1016 host_zoom_levels_.find(GURL(request.url())); |
1076 if (webview()->mainFrame()->document().isPluginDocument()) { | 1017 if (webview()->mainFrame()->document().isPluginDocument()) { |
1077 // Reset the zoom levels for plugins. | 1018 // Reset the zoom levels for plugins. |
1078 webview()->setZoomLevel(false, 0); | 1019 webview()->setZoomLevel(false, 0); |
1079 } else { | 1020 } else { |
1080 if (host_zoom != host_zoom_levels_.end()) | 1021 if (host_zoom != host_zoom_levels_.end()) |
1081 webview()->setZoomLevel(false, host_zoom->second); | 1022 webview()->setZoomLevel(false, host_zoom->second); |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 } | 1926 } |
1986 | 1927 |
1987 void RenderView::frameDetached(WebFrame* frame) { | 1928 void RenderView::frameDetached(WebFrame* frame) { |
1988 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); | 1929 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); |
1989 } | 1930 } |
1990 | 1931 |
1991 void RenderView::willClose(WebFrame* frame) { | 1932 void RenderView::willClose(WebFrame* frame) { |
1992 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); | 1933 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); |
1993 } | 1934 } |
1994 | 1935 |
1995 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { | |
1996 if (enabled_per_settings && | |
1997 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) | |
1998 return true; | |
1999 | |
2000 if (IsWhitelistedForContentSettings(frame)) | |
2001 return true; | |
2002 | |
2003 DidBlockContentType(CONTENT_SETTINGS_TYPE_IMAGES, std::string()); | |
2004 return false; // Other protocols fall through here. | |
2005 } | |
2006 | |
2007 bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) { | |
2008 return WebFrameClient::allowPlugins(frame, enabled_per_settings); | |
2009 } | |
2010 | |
2011 void RenderView::loadURLExternally( | 1936 void RenderView::loadURLExternally( |
2012 WebFrame* frame, const WebURLRequest& request, | 1937 WebFrame* frame, const WebURLRequest& request, |
2013 WebNavigationPolicy policy) { | 1938 WebNavigationPolicy policy) { |
2014 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 1939 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); |
2015 if (policy == WebKit::WebNavigationPolicyDownload) { | 1940 if (policy == WebKit::WebNavigationPolicyDownload) { |
2016 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer)); | 1941 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer)); |
2017 } else { | 1942 } else { |
2018 OpenURL(request.url(), referrer, policy); | 1943 OpenURL(request.url(), referrer, policy); |
2019 } | 1944 } |
2020 } | 1945 } |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2742 } | 2667 } |
2743 | 2668 |
2744 void RenderView::didRunInsecureContent( | 2669 void RenderView::didRunInsecureContent( |
2745 WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) { | 2670 WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) { |
2746 Send(new ViewHostMsg_DidRunInsecureContent( | 2671 Send(new ViewHostMsg_DidRunInsecureContent( |
2747 routing_id_, | 2672 routing_id_, |
2748 origin.toString().utf8(), | 2673 origin.toString().utf8(), |
2749 target)); | 2674 target)); |
2750 } | 2675 } |
2751 | 2676 |
| 2677 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { |
| 2678 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
| 2679 RenderViewObserver* observer; |
| 2680 while ((observer = it.GetNext()) != NULL) |
| 2681 if (!observer->AllowImages(frame, enabled_per_settings)) |
| 2682 return false; |
| 2683 |
| 2684 return true; |
| 2685 } |
| 2686 |
| 2687 bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) { |
| 2688 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
| 2689 RenderViewObserver* observer; |
| 2690 while ((observer = it.GetNext()) != NULL) |
| 2691 if (!observer->AllowPlugins(frame, enabled_per_settings)) |
| 2692 return false; |
| 2693 |
| 2694 return true; |
| 2695 } |
| 2696 |
2752 bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) { | 2697 bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) { |
2753 if (enabled_per_settings && | 2698 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
2754 AllowContentType(CONTENT_SETTINGS_TYPE_JAVASCRIPT)) | 2699 RenderViewObserver* observer; |
2755 return true; | 2700 while ((observer = it.GetNext()) != NULL) |
| 2701 if (!observer->AllowScript(frame, enabled_per_settings)) |
| 2702 return false; |
2756 | 2703 |
2757 if (IsWhitelistedForContentSettings(frame)) | 2704 return true; |
2758 return true; | |
2759 | |
2760 return false; // Other protocols fall through here. | |
2761 } | 2705 } |
2762 | 2706 |
2763 bool RenderView::allowDatabase( | 2707 bool RenderView::allowDatabase( |
2764 WebFrame* frame, const WebString& name, const WebString& display_name, | 2708 WebFrame* frame, const WebString& name, const WebString& display_name, |
2765 unsigned long estimated_size) { | 2709 unsigned long estimated_size) { |
2766 WebSecurityOrigin origin = frame->securityOrigin(); | 2710 WebSecurityOrigin origin = frame->securityOrigin(); |
2767 if (origin.isEmpty()) | 2711 if (origin.isEmpty()) |
2768 return false; // Uninitialized document? | 2712 return false; // Uninitialized document? |
2769 | 2713 |
2770 bool result; | 2714 bool result; |
2771 if (!Send(new DatabaseHostMsg_Allow(routing_id_, | 2715 if (!Send(new DatabaseHostMsg_Allow(routing_id_, |
2772 origin.toString().utf8(), name, display_name, estimated_size, &result))) | 2716 origin.toString().utf8(), name, display_name, estimated_size, &result))) |
2773 return false; | 2717 return false; |
2774 Send(new ViewHostMsg_WebDatabaseAccessed(routing_id_, | 2718 Send(new ViewHostMsg_WebDatabaseAccessed(routing_id_, |
2775 GURL(origin.toString().utf8()), | 2719 GURL(origin.toString().utf8()), |
2776 name, | 2720 name, |
2777 display_name, | 2721 display_name, |
2778 estimated_size, | 2722 estimated_size, |
2779 !result)); | 2723 !result)); |
2780 return result; | 2724 return result; |
2781 } | 2725 } |
2782 void RenderView::didNotAllowScript(WebKit::WebFrame* frame) { | 2726 void RenderView::didNotAllowScript(WebKit::WebFrame* frame) { |
2783 DidBlockContentType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()); | 2727 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidNotAllowScript(frame)); |
2784 } | 2728 } |
2785 | 2729 |
2786 void RenderView::didNotAllowPlugins(WebKit::WebFrame* frame) { | 2730 void RenderView::didNotAllowPlugins(WebKit::WebFrame* frame) { |
2787 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); | 2731 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidNotAllowPlugins(frame)); |
2788 } | 2732 } |
2789 | 2733 |
2790 void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) { | 2734 void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) { |
2791 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); | 2735 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); |
2792 } | 2736 } |
2793 | 2737 |
2794 void RenderView::didCreateScriptContext(WebFrame* frame) { | 2738 void RenderView::didCreateScriptContext(WebFrame* frame) { |
2795 content::GetContentClient()->renderer()->DidCreateScriptContext(frame); | 2739 content::GetContentClient()->renderer()->DidCreateScriptContext(frame); |
2796 } | 2740 } |
2797 | 2741 |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3253 } | 3197 } |
3254 | 3198 |
3255 void RenderView::OnFindReplyAck() { | 3199 void RenderView::OnFindReplyAck() { |
3256 // Check if there is any queued up request waiting to be sent. | 3200 // Check if there is any queued up request waiting to be sent. |
3257 if (queued_find_reply_message_.get()) { | 3201 if (queued_find_reply_message_.get()) { |
3258 // Send the search result over to the browser process. | 3202 // Send the search result over to the browser process. |
3259 Send(queued_find_reply_message_.release()); | 3203 Send(queued_find_reply_message_.release()); |
3260 } | 3204 } |
3261 } | 3205 } |
3262 | 3206 |
3263 bool RenderView::AllowContentType(ContentSettingsType settings_type) { | |
3264 // CONTENT_SETTING_ASK is only valid for cookies. | |
3265 return current_content_settings_.settings[settings_type] != | |
3266 CONTENT_SETTING_BLOCK; | |
3267 } | |
3268 | |
3269 void RenderView::DidBlockContentType(ContentSettingsType settings_type, | |
3270 const std::string& resource_identifier) { | |
3271 if (!content_blocked_[settings_type]) { | |
3272 content_blocked_[settings_type] = true; | |
3273 Send(new ViewHostMsg_ContentBlocked(routing_id_, settings_type, | |
3274 resource_identifier)); | |
3275 } | |
3276 } | |
3277 | |
3278 void RenderView::ClearBlockedContentSettings() { | |
3279 for (size_t i = 0; i < arraysize(content_blocked_); ++i) | |
3280 content_blocked_[i] = false; | |
3281 } | |
3282 | |
3283 WebPlugin* RenderView::CreatePepperPlugin( | 3207 WebPlugin* RenderView::CreatePepperPlugin( |
3284 WebFrame* frame, | 3208 WebFrame* frame, |
3285 const WebPluginParams& params, | 3209 const WebPluginParams& params, |
3286 const FilePath& path, | 3210 const FilePath& path, |
3287 webkit::ppapi::PluginModule* pepper_module) { | 3211 webkit::ppapi::PluginModule* pepper_module) { |
3288 return new webkit::ppapi::WebPluginImpl( | 3212 return new webkit::ppapi::WebPluginImpl( |
3289 pepper_module, params, pepper_delegate_.AsWeakPtr()); | 3213 pepper_module, params, pepper_delegate_.AsWeakPtr()); |
3290 } | 3214 } |
3291 | 3215 |
3292 WebPlugin* RenderView::CreateNPAPIPlugin( | 3216 WebPlugin* RenderView::CreateNPAPIPlugin( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3333 // Don't set zoom level for full-page plugin since they don't use the same | 3257 // Don't set zoom level for full-page plugin since they don't use the same |
3334 // zoom settings. | 3258 // zoom settings. |
3335 if (webview()->mainFrame()->document().isPluginDocument()) | 3259 if (webview()->mainFrame()->document().isPluginDocument()) |
3336 return; | 3260 return; |
3337 | 3261 |
3338 webview()->hidePopups(); | 3262 webview()->hidePopups(); |
3339 webview()->setZoomLevel(false, zoom_level); | 3263 webview()->setZoomLevel(false, zoom_level); |
3340 zoomLevelChanged(); | 3264 zoomLevelChanged(); |
3341 } | 3265 } |
3342 | 3266 |
3343 void RenderView::OnSetContentSettingsForLoadingURL( | |
3344 const GURL& url, | |
3345 const ContentSettings& content_settings) { | |
3346 host_content_settings_[url] = content_settings; | |
3347 } | |
3348 | |
3349 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, | 3267 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, |
3350 double zoom_level) { | 3268 double zoom_level) { |
3351 host_zoom_levels_[url] = zoom_level; | 3269 host_zoom_levels_[url] = zoom_level; |
3352 } | 3270 } |
3353 | 3271 |
3354 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { | 3272 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { |
3355 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 3273 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
3356 } | 3274 } |
3357 | 3275 |
3358 void RenderView::OnResetPageEncodingToDefault() { | 3276 void RenderView::OnResetPageEncodingToDefault() { |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4320 const webkit_glue::CustomContextMenuContext& custom_context) { | 4238 const webkit_glue::CustomContextMenuContext& custom_context) { |
4321 if (custom_context.is_pepper_menu) | 4239 if (custom_context.is_pepper_menu) |
4322 pepper_delegate_.OnContextMenuClosed(custom_context); | 4240 pepper_delegate_.OnContextMenuClosed(custom_context); |
4323 else | 4241 else |
4324 context_menu_node_.reset(); | 4242 context_menu_node_.reset(); |
4325 } | 4243 } |
4326 | 4244 |
4327 void RenderView::OnNetworkStateChanged(bool online) { | 4245 void RenderView::OnNetworkStateChanged(bool online) { |
4328 WebNetworkStateNotifier::setOnLine(online); | 4246 WebNetworkStateNotifier::setOnLine(online); |
4329 } | 4247 } |
OLD | NEW |