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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 static const char kBackForwardNavigationScheme[] = "history"; | 269 static const char kBackForwardNavigationScheme[] = "history"; |
270 | 270 |
271 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 271 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
272 WebVector<WebURL> urls; | 272 WebVector<WebURL> urls; |
273 ds->redirectChain(urls); | 273 ds->redirectChain(urls); |
274 result->reserve(urls.size()); | 274 result->reserve(urls.size()); |
275 for (size_t i = 0; i < urls.size(); ++i) | 275 for (size_t i = 0; i < urls.size(); ++i) |
276 result->push_back(urls[i]); | 276 result->push_back(urls[i]); |
277 } | 277 } |
278 | 278 |
279 // True if |frame| contains content that is white-listed for content settings. | |
280 static bool IsWhitelistedForContentSettings(WebFrame* frame) { | |
281 WebSecurityOrigin origin = frame->securityOrigin(); | |
282 if (origin.isEmpty()) | |
283 return false; // Uninitialized document? | |
284 | |
285 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) | |
286 return true; // Browser UI elements should still work. | |
287 | |
288 // If the scheme is ftp: or file:, an empty file name indicates a directory | |
289 // listing, which requires JavaScript to function properly. | |
290 GURL frame_url = frame->url(); | |
291 const char* kDirProtocols[] = { "ftp", "file" }; | |
292 for (size_t i = 0; i < arraysize(kDirProtocols); ++i) { | |
293 if (EqualsASCII(origin.protocol(), kDirProtocols[i])) { | |
294 return frame_url.SchemeIs(kDirProtocols[i]) && | |
295 frame_url.ExtractFileName().empty(); | |
296 } | |
297 } | |
298 | |
299 return false; | |
300 } | |
301 | |
302 static bool WebAccessibilityNotificationToViewHostMsg( | 279 static bool WebAccessibilityNotificationToViewHostMsg( |
303 WebAccessibilityNotification notification, | 280 WebAccessibilityNotification notification, |
304 ViewHostMsg_AccessibilityNotification_Type::Value* type) { | 281 ViewHostMsg_AccessibilityNotification_Type::Value* type) { |
305 switch (notification) { | 282 switch (notification) { |
306 case WebKit::WebAccessibilityNotificationCheckedStateChanged: | 283 case WebKit::WebAccessibilityNotificationCheckedStateChanged: |
307 *type = ViewHostMsg_AccessibilityNotification_Type:: | 284 *type = ViewHostMsg_AccessibilityNotification_Type:: |
308 NOTIFICATION_TYPE_CHECK_STATE_CHANGED; | 285 NOTIFICATION_TYPE_CHECK_STATE_CHANGED; |
309 break; | 286 break; |
310 case WebKit::WebAccessibilityNotificationChildrenChanged: | 287 case WebKit::WebAccessibilityNotificationChildrenChanged: |
311 *type = ViewHostMsg_AccessibilityNotification_Type:: | 288 *type = ViewHostMsg_AccessibilityNotification_Type:: |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 browser_window_id_(-1), | 388 browser_window_id_(-1), |
412 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 389 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
413 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), | 390 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), |
414 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 391 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
415 geolocation_dispatcher_(NULL), | 392 geolocation_dispatcher_(NULL), |
416 speech_input_dispatcher_(NULL), | 393 speech_input_dispatcher_(NULL), |
417 device_orientation_dispatcher_(NULL), | 394 device_orientation_dispatcher_(NULL), |
418 accessibility_ack_pending_(false), | 395 accessibility_ack_pending_(false), |
419 p2p_socket_dispatcher_(NULL), | 396 p2p_socket_dispatcher_(NULL), |
420 session_storage_namespace_id_(session_storage_namespace_id) { | 397 session_storage_namespace_id_(session_storage_namespace_id) { |
421 | |
422 ClearBlockedContentSettings(); | |
423 | |
424 routing_id_ = routing_id; | 398 routing_id_ = routing_id; |
425 if (opener_id != MSG_ROUTING_NONE) | 399 if (opener_id != MSG_ROUTING_NONE) |
426 opener_id_ = opener_id; | 400 opener_id_ = opener_id; |
427 | 401 |
428 webwidget_ = WebView::create(this); | 402 webwidget_ = WebView::create(this); |
429 | 403 |
430 if (counter) { | 404 if (counter) { |
431 shared_popup_counter_ = counter; | 405 shared_popup_counter_ = counter; |
432 shared_popup_counter_->data++; | 406 shared_popup_counter_->data++; |
433 decrement_shared_popup_at_destruction_ = true; | 407 decrement_shared_popup_at_destruction_ = true; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 648 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
675 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 649 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
676 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 650 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
677 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 651 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
678 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 652 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
679 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 653 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
680 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 654 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
681 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 655 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
682 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 656 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
683 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 657 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
684 IPC_MESSAGE_HANDLER(ViewMsg_SetContentSettingsForLoadingURL, | |
685 OnSetContentSettingsForLoadingURL) | |
686 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 658 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
687 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 659 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
688 OnSetZoomLevelForLoadingURL) | 660 OnSetZoomLevelForLoadingURL) |
689 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 661 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
690 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 662 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
691 OnResetPageEncodingToDefault) | 663 OnResetPageEncodingToDefault) |
692 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon) | 664 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon) |
693 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 665 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
694 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 666 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
695 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 667 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1016 if (!node.isNull()) { | 988 if (!node.isNull()) { |
1017 if (IsEditableNode(node)) | 989 if (IsEditableNode(node)) |
1018 // TODO(varunjain): Change webkit API to scroll a particular node into | 990 // TODO(varunjain): Change webkit API to scroll a particular node into |
1019 // view and use that API here instead. | 991 // view and use that API here instead. |
1020 webview()->scrollFocusedNodeIntoView(); | 992 webview()->scrollFocusedNodeIntoView(); |
1021 } | 993 } |
1022 } | 994 } |
1023 | 995 |
1024 /////////////////////////////////////////////////////////////////////////////// | 996 /////////////////////////////////////////////////////////////////////////////// |
1025 | 997 |
1026 void RenderView::SetContentSettings(const ContentSettings& settings) { | |
1027 current_content_settings_ = settings; | |
1028 } | |
1029 | |
1030 // Tell the embedding application that the URL of the active page has changed | 998 // Tell the embedding application that the URL of the active page has changed |
1031 void RenderView::UpdateURL(WebFrame* frame) { | 999 void RenderView::UpdateURL(WebFrame* frame) { |
1032 WebDataSource* ds = frame->dataSource(); | 1000 WebDataSource* ds = frame->dataSource(); |
1033 DCHECK(ds); | 1001 DCHECK(ds); |
1034 | 1002 |
1035 const WebURLRequest& request = ds->request(); | 1003 const WebURLRequest& request = ds->request(); |
1036 const WebURLRequest& original_request = ds->originalRequest(); | 1004 const WebURLRequest& original_request = ds->originalRequest(); |
1037 const WebURLResponse& response = ds->response(); | 1005 const WebURLResponse& response = ds->response(); |
1038 | 1006 |
1039 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 1007 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1086 // entry had it at all times. | 1054 // entry had it at all times. |
1087 const WebHistoryItem& item = frame->currentHistoryItem(); | 1055 const WebHistoryItem& item = frame->currentHistoryItem(); |
1088 if (!item.isNull()) { | 1056 if (!item.isNull()) { |
1089 params.content_state = webkit_glue::HistoryItemToString(item); | 1057 params.content_state = webkit_glue::HistoryItemToString(item); |
1090 } else { | 1058 } else { |
1091 params.content_state = | 1059 params.content_state = |
1092 webkit_glue::CreateHistoryStateForURL(GURL(request.url())); | 1060 webkit_glue::CreateHistoryStateForURL(GURL(request.url())); |
1093 } | 1061 } |
1094 | 1062 |
1095 if (!frame->parent()) { | 1063 if (!frame->parent()) { |
1096 // Top-level navigation. | 1064 // Top-level navigation. |
pastarmovj
2011/04/18 16:09:23
Do you want to preserve one empty line here.
jam
2011/04/18 16:50:10
Done.
| |
1097 | |
1098 // Clear "block" flags for the new page. This needs to happen before any of | |
1099 // allowScripts(), allowImages(), allowPlugins() is called for the new page | |
1100 // so that these functions can correctly detect that a piece of content | |
1101 // flipped from "not blocked" to "blocked". | |
1102 ClearBlockedContentSettings(); | |
1103 | |
1104 // Set content settings. Default them from the parent window if one exists. | |
1105 // This makes sure about:blank windows work as expected. | |
1106 HostContentSettings::iterator host_content_settings = | |
1107 host_content_settings_.find(GURL(request.url())); | |
1108 if (host_content_settings != host_content_settings_.end()) { | |
1109 SetContentSettings(host_content_settings->second); | |
1110 | |
1111 // These content settings were merely recorded transiently for this load. | |
1112 // We can erase them now. If at some point we reload this page, the | |
1113 // browser will send us new, up-to-date content settings. | |
1114 host_content_settings_.erase(host_content_settings); | |
1115 } else if (frame->opener()) { | |
1116 // The opener's view is not guaranteed to be non-null (it could be | |
1117 // detached from its page but not yet destructed). | |
1118 if (WebView* opener_view = frame->opener()->view()) { | |
1119 RenderView* opener = FromWebView(opener_view); | |
1120 SetContentSettings(opener->current_content_settings_); | |
1121 } | |
1122 } | |
1123 | |
1124 // Set zoom level, but don't do it for full-page plugin since they don't use | 1065 // Set zoom level, but don't do it for full-page plugin since they don't use |
1125 // the same zoom settings. | 1066 // the same zoom settings. |
1126 HostZoomLevels::iterator host_zoom = | 1067 HostZoomLevels::iterator host_zoom = |
1127 host_zoom_levels_.find(GURL(request.url())); | 1068 host_zoom_levels_.find(GURL(request.url())); |
1128 if (webview()->mainFrame()->document().isPluginDocument()) { | 1069 if (webview()->mainFrame()->document().isPluginDocument()) { |
1129 // Reset the zoom levels for plugins. | 1070 // Reset the zoom levels for plugins. |
1130 webview()->setZoomLevel(false, 0); | 1071 webview()->setZoomLevel(false, 0); |
1131 } else { | 1072 } else { |
1132 if (host_zoom != host_zoom_levels_.end()) | 1073 if (host_zoom != host_zoom_levels_.end()) |
1133 webview()->setZoomLevel(false, host_zoom->second); | 1074 webview()->setZoomLevel(false, host_zoom->second); |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2101 } | 2042 } |
2102 | 2043 |
2103 void RenderView::frameDetached(WebFrame* frame) { | 2044 void RenderView::frameDetached(WebFrame* frame) { |
2104 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); | 2045 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); |
2105 } | 2046 } |
2106 | 2047 |
2107 void RenderView::willClose(WebFrame* frame) { | 2048 void RenderView::willClose(WebFrame* frame) { |
2108 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); | 2049 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); |
2109 } | 2050 } |
2110 | 2051 |
2111 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { | |
2112 if (enabled_per_settings && | |
2113 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) | |
2114 return true; | |
2115 | |
2116 if (IsWhitelistedForContentSettings(frame)) | |
2117 return true; | |
2118 | |
2119 DidBlockContentType(CONTENT_SETTINGS_TYPE_IMAGES, std::string()); | |
2120 return false; // Other protocols fall through here. | |
2121 } | |
2122 | |
2123 bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) { | |
2124 return WebFrameClient::allowPlugins(frame, enabled_per_settings); | |
2125 } | |
2126 | |
2127 void RenderView::loadURLExternally( | 2052 void RenderView::loadURLExternally( |
2128 WebFrame* frame, const WebURLRequest& request, | 2053 WebFrame* frame, const WebURLRequest& request, |
2129 WebNavigationPolicy policy) { | 2054 WebNavigationPolicy policy) { |
2130 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2055 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); |
2131 if (policy == WebKit::WebNavigationPolicyDownload) { | 2056 if (policy == WebKit::WebNavigationPolicyDownload) { |
2132 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer)); | 2057 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer)); |
2133 } else { | 2058 } else { |
2134 OpenURL(request.url(), referrer, policy); | 2059 OpenURL(request.url(), referrer, policy); |
2135 } | 2060 } |
2136 } | 2061 } |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2875 } | 2800 } |
2876 | 2801 |
2877 void RenderView::didRunInsecureContent( | 2802 void RenderView::didRunInsecureContent( |
2878 WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) { | 2803 WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) { |
2879 Send(new ViewHostMsg_DidRunInsecureContent( | 2804 Send(new ViewHostMsg_DidRunInsecureContent( |
2880 routing_id_, | 2805 routing_id_, |
2881 origin.toString().utf8(), | 2806 origin.toString().utf8(), |
2882 target)); | 2807 target)); |
2883 } | 2808 } |
2884 | 2809 |
2810 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { | |
2811 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | |
2812 RenderViewObserver* observer; | |
2813 while ((observer = it.GetNext()) != NULL) | |
2814 if (!observer->AllowImages(frame, enabled_per_settings)) | |
2815 return false; | |
2816 | |
2817 return true; | |
2818 } | |
2819 | |
2820 bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) { | |
2821 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | |
2822 RenderViewObserver* observer; | |
2823 while ((observer = it.GetNext()) != NULL) | |
2824 if (!observer->AllowPlugins(frame, enabled_per_settings)) | |
2825 return false; | |
2826 | |
2827 return true; | |
2828 } | |
2829 | |
2885 bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) { | 2830 bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) { |
2886 if (enabled_per_settings && | 2831 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
2887 AllowContentType(CONTENT_SETTINGS_TYPE_JAVASCRIPT)) | 2832 RenderViewObserver* observer; |
2888 return true; | 2833 while ((observer = it.GetNext()) != NULL) |
2834 if (!observer->AllowScript(frame, enabled_per_settings)) | |
2835 return false; | |
2889 | 2836 |
2890 if (IsWhitelistedForContentSettings(frame)) | 2837 return true; |
2891 return true; | |
2892 | |
2893 return false; // Other protocols fall through here. | |
2894 } | 2838 } |
2895 | 2839 |
2896 bool RenderView::allowDatabase( | 2840 bool RenderView::allowDatabase( |
2897 WebFrame* frame, const WebString& name, const WebString& display_name, | 2841 WebFrame* frame, const WebString& name, const WebString& display_name, |
2898 unsigned long estimated_size) { | 2842 unsigned long estimated_size) { |
2899 WebSecurityOrigin origin = frame->securityOrigin(); | 2843 WebSecurityOrigin origin = frame->securityOrigin(); |
2900 if (origin.isEmpty()) | 2844 if (origin.isEmpty()) |
2901 return false; // Uninitialized document? | 2845 return false; // Uninitialized document? |
2902 | 2846 |
2903 bool result; | 2847 bool result; |
2904 if (!Send(new DatabaseHostMsg_Allow(routing_id_, | 2848 if (!Send(new DatabaseHostMsg_Allow(routing_id_, |
2905 origin.toString().utf8(), name, display_name, estimated_size, &result))) | 2849 origin.toString().utf8(), name, display_name, estimated_size, &result))) |
2906 return false; | 2850 return false; |
2907 Send(new ViewHostMsg_WebDatabaseAccessed(routing_id_, | 2851 Send(new ViewHostMsg_WebDatabaseAccessed(routing_id_, |
2908 GURL(origin.toString().utf8()), | 2852 GURL(origin.toString().utf8()), |
2909 name, | 2853 name, |
2910 display_name, | 2854 display_name, |
2911 estimated_size, | 2855 estimated_size, |
2912 !result)); | 2856 !result)); |
2913 return result; | 2857 return result; |
2914 } | 2858 } |
2915 void RenderView::didNotAllowScript(WebKit::WebFrame* frame) { | 2859 void RenderView::didNotAllowScript(WebKit::WebFrame* frame) { |
2916 DidBlockContentType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()); | 2860 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidNotAllowScript(frame)); |
2917 } | 2861 } |
2918 | 2862 |
2919 void RenderView::didNotAllowPlugins(WebKit::WebFrame* frame) { | 2863 void RenderView::didNotAllowPlugins(WebKit::WebFrame* frame) { |
2920 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); | 2864 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidNotAllowPlugins(frame)); |
2921 } | 2865 } |
2922 | 2866 |
2923 void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) { | 2867 void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) { |
2924 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); | 2868 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); |
2925 } | 2869 } |
2926 | 2870 |
2927 void RenderView::didCreateScriptContext(WebFrame* frame) { | 2871 void RenderView::didCreateScriptContext(WebFrame* frame) { |
2928 content::GetContentClient()->renderer()->DidCreateScriptContext(frame); | 2872 content::GetContentClient()->renderer()->DidCreateScriptContext(frame); |
2929 } | 2873 } |
2930 | 2874 |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3462 } | 3406 } |
3463 | 3407 |
3464 void RenderView::OnFindReplyAck() { | 3408 void RenderView::OnFindReplyAck() { |
3465 // Check if there is any queued up request waiting to be sent. | 3409 // Check if there is any queued up request waiting to be sent. |
3466 if (queued_find_reply_message_.get()) { | 3410 if (queued_find_reply_message_.get()) { |
3467 // Send the search result over to the browser process. | 3411 // Send the search result over to the browser process. |
3468 Send(queued_find_reply_message_.release()); | 3412 Send(queued_find_reply_message_.release()); |
3469 } | 3413 } |
3470 } | 3414 } |
3471 | 3415 |
3472 bool RenderView::AllowContentType(ContentSettingsType settings_type) { | |
3473 // CONTENT_SETTING_ASK is only valid for cookies. | |
3474 return current_content_settings_.settings[settings_type] != | |
3475 CONTENT_SETTING_BLOCK; | |
3476 } | |
3477 | |
3478 void RenderView::DidBlockContentType(ContentSettingsType settings_type, | |
3479 const std::string& resource_identifier) { | |
3480 if (!content_blocked_[settings_type]) { | |
3481 content_blocked_[settings_type] = true; | |
3482 Send(new ViewHostMsg_ContentBlocked(routing_id_, settings_type, | |
3483 resource_identifier)); | |
3484 } | |
3485 } | |
3486 | |
3487 void RenderView::ClearBlockedContentSettings() { | |
3488 for (size_t i = 0; i < arraysize(content_blocked_); ++i) | |
3489 content_blocked_[i] = false; | |
3490 } | |
3491 | |
3492 WebPlugin* RenderView::CreatePepperPlugin( | 3416 WebPlugin* RenderView::CreatePepperPlugin( |
3493 WebFrame* frame, | 3417 WebFrame* frame, |
3494 const WebPluginParams& params, | 3418 const WebPluginParams& params, |
3495 const FilePath& path, | 3419 const FilePath& path, |
3496 webkit::ppapi::PluginModule* pepper_module) { | 3420 webkit::ppapi::PluginModule* pepper_module) { |
3497 return new webkit::ppapi::WebPluginImpl( | 3421 return new webkit::ppapi::WebPluginImpl( |
3498 pepper_module, params, pepper_delegate_.AsWeakPtr()); | 3422 pepper_module, params, pepper_delegate_.AsWeakPtr()); |
3499 } | 3423 } |
3500 | 3424 |
3501 WebPlugin* RenderView::CreateNPAPIPlugin( | 3425 WebPlugin* RenderView::CreateNPAPIPlugin( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3542 // Don't set zoom level for full-page plugin since they don't use the same | 3466 // Don't set zoom level for full-page plugin since they don't use the same |
3543 // zoom settings. | 3467 // zoom settings. |
3544 if (webview()->mainFrame()->document().isPluginDocument()) | 3468 if (webview()->mainFrame()->document().isPluginDocument()) |
3545 return; | 3469 return; |
3546 | 3470 |
3547 webview()->hidePopups(); | 3471 webview()->hidePopups(); |
3548 webview()->setZoomLevel(false, zoom_level); | 3472 webview()->setZoomLevel(false, zoom_level); |
3549 zoomLevelChanged(); | 3473 zoomLevelChanged(); |
3550 } | 3474 } |
3551 | 3475 |
3552 void RenderView::OnSetContentSettingsForLoadingURL( | |
3553 const GURL& url, | |
3554 const ContentSettings& content_settings) { | |
3555 host_content_settings_[url] = content_settings; | |
3556 } | |
3557 | |
3558 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, | 3476 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, |
3559 double zoom_level) { | 3477 double zoom_level) { |
3560 host_zoom_levels_[url] = zoom_level; | 3478 host_zoom_levels_[url] = zoom_level; |
3561 } | 3479 } |
3562 | 3480 |
3563 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { | 3481 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { |
3564 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 3482 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
3565 } | 3483 } |
3566 | 3484 |
3567 void RenderView::OnResetPageEncodingToDefault() { | 3485 void RenderView::OnResetPageEncodingToDefault() { |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4618 const webkit_glue::CustomContextMenuContext& custom_context) { | 4536 const webkit_glue::CustomContextMenuContext& custom_context) { |
4619 if (custom_context.is_pepper_menu) | 4537 if (custom_context.is_pepper_menu) |
4620 pepper_delegate_.OnContextMenuClosed(custom_context); | 4538 pepper_delegate_.OnContextMenuClosed(custom_context); |
4621 else | 4539 else |
4622 context_menu_node_.reset(); | 4540 context_menu_node_.reset(); |
4623 } | 4541 } |
4624 | 4542 |
4625 void RenderView::OnNetworkStateChanged(bool online) { | 4543 void RenderView::OnNetworkStateChanged(bool online) { |
4626 WebNetworkStateNotifier::setOnLine(online); | 4544 WebNetworkStateNotifier::setOnLine(online); |
4627 } | 4545 } |
OLD | NEW |