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 12 matching lines...) Expand all Loading... |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "chrome/common/autofill_messages.h" | 24 #include "chrome/common/autofill_messages.h" |
25 #include "chrome/common/bindings_policy.h" | 25 #include "chrome/common/bindings_policy.h" |
26 #include "chrome/common/child_process_logging.h" | 26 #include "chrome/common/child_process_logging.h" |
27 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/devtools_messages.h" | 30 #include "chrome/common/devtools_messages.h" |
31 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
32 #include "chrome/common/extensions/extension_constants.h" | 32 #include "chrome/common/extensions/extension_constants.h" |
| 33 #include "chrome/common/extensions/extension_messages.h" |
33 #include "chrome/common/extensions/extension_set.h" | 34 #include "chrome/common/extensions/extension_set.h" |
34 #include "chrome/common/json_value_serializer.h" | 35 #include "chrome/common/json_value_serializer.h" |
35 #include "chrome/common/pepper_plugin_registry.h" | 36 #include "chrome/common/pepper_plugin_registry.h" |
36 #include "chrome/common/render_messages.h" | 37 #include "chrome/common/render_messages.h" |
37 #include "chrome/common/render_messages_params.h" | |
38 #include "chrome/common/render_view_commands.h" | 38 #include "chrome/common/render_view_commands.h" |
39 #include "chrome/common/spellcheck_messages.h" | 39 #include "chrome/common/spellcheck_messages.h" |
40 #include "chrome/common/thumbnail_score.h" | 40 #include "chrome/common/thumbnail_score.h" |
41 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
42 #include "chrome/common/web_apps.h" | 42 #include "chrome/common/web_apps.h" |
43 #include "chrome/renderer/about_handler.h" | 43 #include "chrome/renderer/about_handler.h" |
44 #include "chrome/renderer/autofill/autofill_agent.h" | 44 #include "chrome/renderer/autofill/autofill_agent.h" |
45 #include "chrome/renderer/autofill/form_manager.h" | 45 #include "chrome/renderer/autofill/form_manager.h" |
46 #include "chrome/renderer/autofill/password_autofill_manager.h" | 46 #include "chrome/renderer/autofill/password_autofill_manager.h" |
47 #include "chrome/renderer/automation/dom_automation_controller.h" | 47 #include "chrome/renderer/automation/dom_automation_controller.h" |
48 #include "chrome/renderer/devtools_agent.h" | 48 #include "chrome/renderer/devtools_agent.h" |
49 #include "chrome/renderer/devtools_client.h" | 49 #include "chrome/renderer/devtools_client.h" |
50 #include "chrome/renderer/extension_groups.h" | 50 #include "chrome/renderer/extension_groups.h" |
51 #include "chrome/renderer/extensions/bindings_utils.h" | 51 #include "chrome/renderer/extensions/bindings_utils.h" |
52 #include "chrome/renderer/extensions/event_bindings.h" | 52 #include "chrome/renderer/extensions/event_bindings.h" |
| 53 #include "chrome/renderer/extensions/extension_helper.h" |
53 #include "chrome/renderer/extensions/extension_process_bindings.h" | 54 #include "chrome/renderer/extensions/extension_process_bindings.h" |
54 #include "chrome/renderer/extensions/extension_resource_request_policy.h" | 55 #include "chrome/renderer/extensions/extension_resource_request_policy.h" |
55 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 56 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
56 #include "chrome/renderer/external_host_bindings.h" | 57 #include "chrome/renderer/external_host_bindings.h" |
57 #include "chrome/renderer/localized_error.h" | 58 #include "chrome/renderer/localized_error.h" |
58 #include "chrome/renderer/page_click_tracker.h" | 59 #include "chrome/renderer/page_click_tracker.h" |
59 #include "chrome/renderer/page_load_histograms.h" | 60 #include "chrome/renderer/page_load_histograms.h" |
60 #include "chrome/renderer/print_web_view_helper.h" | 61 #include "chrome/renderer/print_web_view_helper.h" |
61 #include "chrome/renderer/render_process.h" | 62 #include "chrome/renderer/render_process.h" |
62 #include "chrome/renderer/render_thread.h" | 63 #include "chrome/renderer/render_thread.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); | 641 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); |
641 } | 642 } |
642 | 643 |
643 if (CommandLine::ForCurrentProcess()->HasSwitch( | 644 if (CommandLine::ForCurrentProcess()->HasSwitch( |
644 switches::kEnableClientSidePhishingDetection)) { | 645 switches::kEnableClientSidePhishingDetection)) { |
645 new safe_browsing::PhishingClassifierDelegate(this, NULL); | 646 new safe_browsing::PhishingClassifierDelegate(this, NULL); |
646 } | 647 } |
647 | 648 |
648 // Observer for Malware DOM details messages. | 649 // Observer for Malware DOM details messages. |
649 new safe_browsing::MalwareDOMDetails(this); | 650 new safe_browsing::MalwareDOMDetails(this); |
| 651 |
| 652 new ExtensionHelper(this); |
650 } | 653 } |
651 | 654 |
652 RenderView::~RenderView() { | 655 RenderView::~RenderView() { |
653 if (decrement_shared_popup_at_destruction_) | 656 if (decrement_shared_popup_at_destruction_) |
654 shared_popup_counter_->data--; | 657 shared_popup_counter_->data--; |
655 | 658 |
656 // If file chooser is still waiting for answer, dispatch empty answer. | 659 // If file chooser is still waiting for answer, dispatch empty answer. |
657 while (!file_chooser_completions_.empty()) { | 660 while (!file_chooser_completions_.empty()) { |
658 if (file_chooser_completions_.front()->completion) { | 661 if (file_chooser_completions_.front()->completion) { |
659 file_chooser_completions_.front()->completion->didChooseFile( | 662 file_chooser_completions_.front()->completion->didChooseFile( |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { | 852 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { |
850 app_icon_fetchers_.push_back(linked_ptr<ImageResourceFetcher>( | 853 app_icon_fetchers_.push_back(linked_ptr<ImageResourceFetcher>( |
851 new ImageResourceFetcher( | 854 new ImageResourceFetcher( |
852 pending_app_info_->icons[i].url, | 855 pending_app_info_->icons[i].url, |
853 webview()->mainFrame(), | 856 webview()->mainFrame(), |
854 static_cast<int>(i), | 857 static_cast<int>(i), |
855 pending_app_info_->icons[i].width, | 858 pending_app_info_->icons[i].width, |
856 NewCallback(this, &RenderView::DidDownloadApplicationIcon)))); | 859 NewCallback(this, &RenderView::DidDownloadApplicationIcon)))); |
857 } | 860 } |
858 } else { | 861 } else { |
859 Send(new ViewHostMsg_InstallApplication(routing_id_, *app_info)); | 862 Send(new ExtensionHostMsg_InstallApplication(routing_id_, *app_info)); |
860 } | 863 } |
861 } | 864 } |
862 | 865 |
863 void RenderView::DidDownloadApplicationIcon(ImageResourceFetcher* fetcher, | 866 void RenderView::DidDownloadApplicationIcon(ImageResourceFetcher* fetcher, |
864 const SkBitmap& image) { | 867 const SkBitmap& image) { |
865 pending_app_info_->icons[fetcher->id()].data = image; | 868 pending_app_info_->icons[fetcher->id()].data = image; |
866 | 869 |
867 // Remove the image fetcher from our pending list. We're in the callback from | 870 // Remove the image fetcher from our pending list. We're in the callback from |
868 // ImageResourceFetcher, best to delay deletion. | 871 // ImageResourceFetcher, best to delay deletion. |
869 for (ImageResourceFetcherList::iterator iter = app_icon_fetchers_.begin(); | 872 for (ImageResourceFetcherList::iterator iter = app_icon_fetchers_.begin(); |
(...skipping 28 matching lines...) Expand all Loading... |
898 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { | 901 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { |
899 size_t current_size = pending_app_info_->icons[i].data.getSize(); | 902 size_t current_size = pending_app_info_->icons[i].data.getSize(); |
900 if (current_size > kMaxIconSize - actual_icon_size) { | 903 if (current_size > kMaxIconSize - actual_icon_size) { |
901 AddErrorToRootConsole(ASCIIToUTF16( | 904 AddErrorToRootConsole(ASCIIToUTF16( |
902 "Icons are too large. Maximum total size for app icons is 128 KB.")); | 905 "Icons are too large. Maximum total size for app icons is 128 KB.")); |
903 return; | 906 return; |
904 } | 907 } |
905 actual_icon_size += current_size; | 908 actual_icon_size += current_size; |
906 } | 909 } |
907 | 910 |
908 Send(new ViewHostMsg_InstallApplication(routing_id_, *pending_app_info_)); | 911 Send(new ExtensionHostMsg_InstallApplication( |
| 912 routing_id_, *pending_app_info_)); |
909 pending_app_info_.reset(NULL); | 913 pending_app_info_.reset(NULL); |
910 } | 914 } |
911 | 915 |
912 void RenderView::PluginCrashed(const FilePath& plugin_path) { | 916 void RenderView::PluginCrashed(const FilePath& plugin_path) { |
913 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); | 917 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); |
914 } | 918 } |
915 | 919 |
916 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, | 920 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, |
917 const WebPluginParams& params) { | 921 const WebPluginParams& params) { |
918 webkit::npapi::WebPluginInfo info; | 922 webkit::npapi::WebPluginInfo info; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) | 1025 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
1022 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, | 1026 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, |
1023 OnDisplayPrerenderedPage) | 1027 OnDisplayPrerenderedPage) |
1024 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) | 1028 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
1025 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1029 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1026 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 1030 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
1027 OnGetAllSavableResourceLinksForCurrentPage) | 1031 OnGetAllSavableResourceLinksForCurrentPage) |
1028 IPC_MESSAGE_HANDLER( | 1032 IPC_MESSAGE_HANDLER( |
1029 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1033 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1030 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1034 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1031 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) | 1035 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo) |
1032 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) | 1036 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) |
1033 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 1037 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
1034 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) | 1038 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) |
1035 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, | 1039 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, |
1036 OnHandleMessageFromExternalHost) | 1040 OnHandleMessageFromExternalHost) |
1037 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, | 1041 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, |
1038 OnDisassociateFromPopupCount) | 1042 OnDisassociateFromPopupCount) |
1039 IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose, | 1043 IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose, |
1040 OnAllowScriptToClose) | 1044 OnAllowScriptToClose) |
1041 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 1045 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
1042 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) | |
1043 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, | |
1044 OnExtensionMessageInvoke) | |
1045 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) | 1046 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) |
1046 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) | 1047 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) |
1047 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1048 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
1048 OnEnablePreferredSizeChangedMode) | 1049 OnEnablePreferredSizeChangedMode) |
1049 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, | 1050 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, |
1050 OnDisableScrollbarsForSmallWindows) | 1051 OnDisableScrollbarsForSmallWindows) |
1051 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) | 1052 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) |
1052 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId, | 1053 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId, |
1053 OnUpdateBrowserWindowId) | 1054 OnUpdateBrowserWindowId) |
1054 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, | 1055 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, |
1055 OnNotifyRendererViewType) | 1056 OnNotifyRendererViewType) |
1056 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 1057 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
1057 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 1058 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
1058 #if defined(OS_MACOSX) | 1059 #if defined(OS_MACOSX) |
1059 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1060 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
1060 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1061 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
1061 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 1062 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
1062 OnPluginImeCompositionCompleted) | 1063 OnPluginImeCompositionCompleted) |
1063 #endif | 1064 #endif |
1064 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, | 1065 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, |
1065 OnSetEditCommandsForNextKeyEvent) | 1066 OnSetEditCommandsForNextKeyEvent) |
1066 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCode, | 1067 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode) |
1067 OnExecuteCode) | |
1068 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, | 1068 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, |
1069 OnCustomContextMenuAction) | 1069 OnCustomContextMenuAction) |
1070 IPC_MESSAGE_HANDLER(ViewMsg_EnableAccessibility, OnEnableAccessibility) | 1070 IPC_MESSAGE_HANDLER(ViewMsg_EnableAccessibility, OnEnableAccessibility) |
1071 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityFocus, OnSetAccessibilityFocus) | 1071 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityFocus, OnSetAccessibilityFocus) |
1072 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityDoDefaultAction, | 1072 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityDoDefaultAction, |
1073 OnAccessibilityDoDefaultAction) | 1073 OnAccessibilityDoDefaultAction) |
1074 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK, | 1074 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK, |
1075 OnAccessibilityNotificationsAck) | 1075 OnAccessibilityNotificationsAck) |
1076 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) | 1076 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) |
1077 #if defined(OS_MACOSX) | 1077 #if defined(OS_MACOSX) |
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3363 | 3363 |
3364 void RenderView::OnUserScriptIdleTriggered(WebFrame* frame) { | 3364 void RenderView::OnUserScriptIdleTriggered(WebFrame* frame) { |
3365 if (RenderThread::current()) { // Will be NULL during unit tests. | 3365 if (RenderThread::current()) { // Will be NULL during unit tests. |
3366 RenderThread::current()->user_script_slave()->InjectScripts( | 3366 RenderThread::current()->user_script_slave()->InjectScripts( |
3367 frame, UserScript::DOCUMENT_IDLE); | 3367 frame, UserScript::DOCUMENT_IDLE); |
3368 } | 3368 } |
3369 | 3369 |
3370 WebFrame* main_frame = webview()->mainFrame(); | 3370 WebFrame* main_frame = webview()->mainFrame(); |
3371 if (frame == main_frame) { | 3371 if (frame == main_frame) { |
3372 while (!pending_code_execution_queue_.empty()) { | 3372 while (!pending_code_execution_queue_.empty()) { |
3373 linked_ptr<ViewMsg_ExecuteCode_Params>& params = | 3373 linked_ptr<ExtensionMsg_ExecuteCode_Params>& params = |
3374 pending_code_execution_queue_.front(); | 3374 pending_code_execution_queue_.front(); |
3375 ExecuteCodeImpl(main_frame, *params); | 3375 ExecuteCodeImpl(main_frame, *params); |
3376 pending_code_execution_queue_.pop(); | 3376 pending_code_execution_queue_.pop(); |
3377 } | 3377 } |
3378 } | 3378 } |
3379 } | 3379 } |
3380 | 3380 |
3381 void RenderView::didHandleOnloadEvents(WebFrame* frame) { | 3381 void RenderView::didHandleOnloadEvents(WebFrame* frame) { |
3382 if (webview()->mainFrame() == frame) { | 3382 if (webview()->mainFrame() == frame) { |
3383 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, | 3383 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3898 // any icon with a data URL to have originated from a favicon. We don't want | 3898 // any icon with a data URL to have originated from a favicon. We don't want |
3899 // to decode arbitrary data URLs in the browser process. See | 3899 // to decode arbitrary data URLs in the browser process. See |
3900 // http://b/issue?id=1162972 | 3900 // http://b/issue?id=1162972 |
3901 for (size_t i = 0; i < app_info.icons.size(); ++i) { | 3901 for (size_t i = 0; i < app_info.icons.size(); ++i) { |
3902 if (app_info.icons[i].url.SchemeIs(chrome::kDataScheme)) { | 3902 if (app_info.icons[i].url.SchemeIs(chrome::kDataScheme)) { |
3903 app_info.icons.erase(app_info.icons.begin() + i); | 3903 app_info.icons.erase(app_info.icons.begin() + i); |
3904 --i; | 3904 --i; |
3905 } | 3905 } |
3906 } | 3906 } |
3907 | 3907 |
3908 Send(new ViewHostMsg_DidGetApplicationInfo(routing_id_, page_id, app_info)); | 3908 Send(new ExtensionHostMsg_DidGetApplicationInfo( |
| 3909 routing_id_, page_id, app_info)); |
3909 } | 3910 } |
3910 | 3911 |
3911 GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url, | 3912 GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url, |
3912 ErrorPageType error_type) { | 3913 ErrorPageType error_type) { |
3913 if (failed_url.SchemeIsSecure()) { | 3914 if (failed_url.SchemeIsSecure()) { |
3914 // If the URL that failed was secure, then the embedding web page was not | 3915 // If the URL that failed was secure, then the embedding web page was not |
3915 // expecting a network attacker to be able to manipulate its contents. As | 3916 // expecting a network attacker to be able to manipulate its contents. As |
3916 // we fetch alternate error pages over HTTP, we would be allowing a network | 3917 // we fetch alternate error pages over HTTP, we would be allowing a network |
3917 // attacker to manipulate the contents of the response if we tried to use | 3918 // attacker to manipulate the contents of the response if we tried to use |
3918 // the link doctor here. | 3919 // the link doctor here. |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 // WebPluginDelegateProxy is responsible for figuring out if this event | 4887 // WebPluginDelegateProxy is responsible for figuring out if this event |
4887 // applies to it or not, so inform all the delegates. | 4888 // applies to it or not, so inform all the delegates. |
4888 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 4889 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
4889 for (plugin_it = plugin_delegates_.begin(); | 4890 for (plugin_it = plugin_delegates_.begin(); |
4890 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 4891 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
4891 (*plugin_it)->ImeCompositionCompleted(text, plugin_id); | 4892 (*plugin_it)->ImeCompositionCompleted(text, plugin_id); |
4892 } | 4893 } |
4893 } | 4894 } |
4894 #endif // OS_MACOSX | 4895 #endif // OS_MACOSX |
4895 | 4896 |
4896 void RenderView::SendExtensionRequest( | |
4897 const ViewHostMsg_DomMessage_Params& params) { | |
4898 Send(new ViewHostMsg_ExtensionRequest(routing_id_, params)); | |
4899 } | |
4900 | |
4901 void RenderView::OnExtensionResponse(int request_id, | |
4902 bool success, | |
4903 const std::string& response, | |
4904 const std::string& error) { | |
4905 ExtensionProcessBindings::HandleResponse( | |
4906 request_id, success, response, error); | |
4907 } | |
4908 | |
4909 void RenderView::OnExtensionMessageInvoke(const std::string& extension_id, | |
4910 const std::string& function_name, | |
4911 const ListValue& args, | |
4912 const GURL& event_url) { | |
4913 RendererExtensionBindings::Invoke( | |
4914 extension_id, function_name, args, this, event_url); | |
4915 } | |
4916 | |
4917 void RenderView::postAccessibilityNotification( | 4897 void RenderView::postAccessibilityNotification( |
4918 const WebAccessibilityObject& obj, | 4898 const WebAccessibilityObject& obj, |
4919 WebAccessibilityNotification notification) { | 4899 WebAccessibilityNotification notification) { |
4920 if (!accessibility_.get() && webview()) { | 4900 if (!accessibility_.get() && webview()) { |
4921 // Load complete should be our first notification sent. | 4901 // Load complete should be our first notification sent. |
4922 // TODO(ctguil): Investigate if a different notification is a WebCore bug. | 4902 // TODO(ctguil): Investigate if a different notification is a WebCore bug. |
4923 if (notification != WebKit::WebAccessibilityNotificationLoadComplete) | 4903 if (notification != WebKit::WebAccessibilityNotificationLoadComplete) |
4924 return; | 4904 return; |
4925 | 4905 |
4926 // Create and initialize our accessibility cache | 4906 // Create and initialize our accessibility cache |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4975 accessibility_method_factory_.NewRunnableMethod( | 4955 accessibility_method_factory_.NewRunnableMethod( |
4976 &RenderView::SendPendingAccessibilityNotifications)); | 4956 &RenderView::SendPendingAccessibilityNotifications)); |
4977 } | 4957 } |
4978 } | 4958 } |
4979 | 4959 |
4980 void RenderView::OnSetEditCommandsForNextKeyEvent( | 4960 void RenderView::OnSetEditCommandsForNextKeyEvent( |
4981 const EditCommands& edit_commands) { | 4961 const EditCommands& edit_commands) { |
4982 edit_commands_ = edit_commands; | 4962 edit_commands_ = edit_commands; |
4983 } | 4963 } |
4984 | 4964 |
4985 void RenderView::OnExecuteCode(const ViewMsg_ExecuteCode_Params& params) { | 4965 void RenderView::OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params) { |
4986 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 4966 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
4987 if (!main_frame) { | 4967 if (!main_frame) { |
4988 Send(new ViewHostMsg_ExecuteCodeFinished(routing_id_, params.request_id, | 4968 Send(new ViewHostMsg_ExecuteCodeFinished(routing_id_, params.request_id, |
4989 false)); | 4969 false)); |
4990 return; | 4970 return; |
4991 } | 4971 } |
4992 | 4972 |
4993 WebDataSource* ds = main_frame->dataSource(); | 4973 WebDataSource* ds = main_frame->dataSource(); |
4994 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 4974 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
4995 if (!navigation_state->user_script_idle_scheduler()->has_run()) { | 4975 if (!navigation_state->user_script_idle_scheduler()->has_run()) { |
4996 pending_code_execution_queue_.push( | 4976 pending_code_execution_queue_.push( |
4997 linked_ptr<ViewMsg_ExecuteCode_Params>( | 4977 linked_ptr<ExtensionMsg_ExecuteCode_Params>( |
4998 new ViewMsg_ExecuteCode_Params(params))); | 4978 new ExtensionMsg_ExecuteCode_Params(params))); |
4999 return; | 4979 return; |
5000 } | 4980 } |
5001 | 4981 |
5002 ExecuteCodeImpl(main_frame, params); | 4982 ExecuteCodeImpl(main_frame, params); |
5003 } | 4983 } |
5004 | 4984 |
5005 void RenderView::ExecuteCodeImpl(WebFrame* frame, | 4985 void RenderView::ExecuteCodeImpl( |
5006 const ViewMsg_ExecuteCode_Params& params) { | 4986 WebFrame* frame, const ExtensionMsg_ExecuteCode_Params& params) { |
5007 std::vector<WebFrame*> frame_vector; | 4987 std::vector<WebFrame*> frame_vector; |
5008 frame_vector.push_back(frame); | 4988 frame_vector.push_back(frame); |
5009 if (params.all_frames) | 4989 if (params.all_frames) |
5010 GetAllChildFrames(frame, &frame_vector); | 4990 GetAllChildFrames(frame, &frame_vector); |
5011 | 4991 |
5012 for (std::vector<WebFrame*>::iterator frame_it = frame_vector.begin(); | 4992 for (std::vector<WebFrame*>::iterator frame_it = frame_vector.begin(); |
5013 frame_it != frame_vector.end(); ++frame_it) { | 4993 frame_it != frame_vector.end(); ++frame_it) { |
5014 WebFrame* frame = *frame_it; | 4994 WebFrame* frame = *frame_it; |
5015 if (params.is_javascript) { | 4995 if (params.is_javascript) { |
5016 const Extension* extension = | 4996 const Extension* extension = |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5394 const webkit_glue::CustomContextMenuContext& custom_context) { | 5374 const webkit_glue::CustomContextMenuContext& custom_context) { |
5395 if (custom_context.is_pepper_menu) | 5375 if (custom_context.is_pepper_menu) |
5396 pepper_delegate_.OnContextMenuClosed(custom_context); | 5376 pepper_delegate_.OnContextMenuClosed(custom_context); |
5397 else | 5377 else |
5398 context_menu_node_.reset(); | 5378 context_menu_node_.reset(); |
5399 } | 5379 } |
5400 | 5380 |
5401 void RenderView::OnNetworkStateChanged(bool online) { | 5381 void RenderView::OnNetworkStateChanged(bool online) { |
5402 WebNetworkStateNotifier::setOnLine(online); | 5382 WebNetworkStateNotifier::setOnLine(online); |
5403 } | 5383 } |
OLD | NEW |