| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "webkit/api/public/WebRect.h" | 66 #include "webkit/api/public/WebRect.h" |
| 67 #include "webkit/api/public/WebScriptSource.h" | 67 #include "webkit/api/public/WebScriptSource.h" |
| 68 #include "webkit/api/public/WebSize.h" | 68 #include "webkit/api/public/WebSize.h" |
| 69 #include "webkit/api/public/WebURL.h" | 69 #include "webkit/api/public/WebURL.h" |
| 70 #include "webkit/api/public/WebURLError.h" | 70 #include "webkit/api/public/WebURLError.h" |
| 71 #include "webkit/api/public/WebURLRequest.h" | 71 #include "webkit/api/public/WebURLRequest.h" |
| 72 #include "webkit/api/public/WebURLResponse.h" | 72 #include "webkit/api/public/WebURLResponse.h" |
| 73 #include "webkit/api/public/WebVector.h" | 73 #include "webkit/api/public/WebVector.h" |
| 74 #include "webkit/default_plugin/default_plugin_shared.h" | 74 #include "webkit/default_plugin/default_plugin_shared.h" |
| 75 #include "webkit/glue/glue_serialize.h" | 75 #include "webkit/glue/glue_serialize.h" |
| 76 #include "webkit/glue/glue_util.h" |
| 76 #include "webkit/glue/dom_operations.h" | 77 #include "webkit/glue/dom_operations.h" |
| 77 #include "webkit/glue/dom_serializer.h" | 78 #include "webkit/glue/dom_serializer.h" |
| 78 #include "webkit/glue/image_decoder.h" | 79 #include "webkit/glue/image_decoder.h" |
| 79 #include "webkit/glue/media/buffered_data_source.h" | 80 #include "webkit/glue/media/buffered_data_source.h" |
| 80 #include "webkit/glue/media/simple_data_source.h" | 81 #include "webkit/glue/media/simple_data_source.h" |
| 81 #include "webkit/glue/password_form.h" | 82 #include "webkit/glue/password_form.h" |
| 82 #include "webkit/glue/plugins/plugin_list.h" | 83 #include "webkit/glue/plugins/plugin_list.h" |
| 83 #include "webkit/glue/searchable_form_data.h" | 84 #include "webkit/glue/searchable_form_data.h" |
| 84 #include "webkit/glue/webaccessibilitymanager_impl.h" | 85 #include "webkit/glue/webaccessibilitymanager_impl.h" |
| 85 #include "webkit/glue/webdevtoolsagent_delegate.h" | 86 #include "webkit/glue/webdevtoolsagent_delegate.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 OnDragSourceEndedOrMoved) | 394 OnDragSourceEndedOrMoved) |
| 394 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, | 395 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, |
| 395 OnDragSourceSystemDragEnded) | 396 OnDragSourceSystemDragEnded) |
| 396 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 397 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
| 397 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 398 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
| 398 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 399 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
| 399 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 400 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
| 400 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) | 401 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) |
| 401 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) | 402 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
| 402 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) | 403 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
| 404 IPC_MESSAGE_HANDLER(ViewMsg_ChooseGeolocationProviderResponse, |
| 405 OnChooseGeolocationProviderResponse) |
| 403 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 406 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 404 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBackForwardListCount, | 407 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBackForwardListCount, |
| 405 OnUpdateBackForwardListCount) | 408 OnUpdateBackForwardListCount) |
| 406 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 409 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
| 407 OnGetAllSavableResourceLinksForCurrentPage) | 410 OnGetAllSavableResourceLinksForCurrentPage) |
| 408 IPC_MESSAGE_HANDLER( | 411 IPC_MESSAGE_HANDLER( |
| 409 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 412 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
| 410 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 413 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
| 411 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) | 414 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) |
| 412 IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityInfo, OnGetAccessibilityInfo) | 415 IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityInfo, OnGetAccessibilityInfo) |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 // chooser request. WebKit doesn't do anything to expect the callback, so | 1836 // chooser request. WebKit doesn't do anything to expect the callback, so |
| 1834 // we can just ignore calling it. | 1837 // we can just ignore calling it. |
| 1835 delete file_chooser; | 1838 delete file_chooser; |
| 1836 return; | 1839 return; |
| 1837 } | 1840 } |
| 1838 file_chooser_.reset(file_chooser); | 1841 file_chooser_.reset(file_chooser); |
| 1839 Send(new ViewHostMsg_RunFileChooser(routing_id_, multi_select, title, | 1842 Send(new ViewHostMsg_RunFileChooser(routing_id_, multi_select, title, |
| 1840 default_filename)); | 1843 default_filename)); |
| 1841 } | 1844 } |
| 1842 | 1845 |
| 1846 void RenderView::chooseGeolocationProvider( |
| 1847 ChooseGeolocationProviderCallback *geolocation_provider_callback, |
| 1848 const WebCore::KURL &url) { |
| 1849 geolocation_provider_callback_.reset(geolocation_provider_callback); |
| 1850 Send(new ViewHostMsg_ChooseGeolocationProvider( |
| 1851 routing_id_, webkit_glue::KURLToGURL(url))); |
| 1852 } |
| 1853 |
| 1843 void RenderView::AddMessageToConsole(WebView* webview, | 1854 void RenderView::AddMessageToConsole(WebView* webview, |
| 1844 const std::wstring& message, | 1855 const std::wstring& message, |
| 1845 unsigned int line_no, | 1856 unsigned int line_no, |
| 1846 const std::wstring& source_id) { | 1857 const std::wstring& source_id) { |
| 1847 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, message, | 1858 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, message, |
| 1848 static_cast<int32>(line_no), | 1859 static_cast<int32>(line_no), |
| 1849 source_id)); | 1860 source_id)); |
| 1850 } | 1861 } |
| 1851 | 1862 |
| 1852 void RenderView::AddSearchProvider(const std::string& url) { | 1863 void RenderView::AddSearchProvider(const std::string& url) { |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2753 const std::vector<FilePath>& file_names) { | 2764 const std::vector<FilePath>& file_names) { |
| 2754 // This could happen if we navigated to a different page before the user | 2765 // This could happen if we navigated to a different page before the user |
| 2755 // closed the chooser. | 2766 // closed the chooser. |
| 2756 if (!file_chooser_.get()) | 2767 if (!file_chooser_.get()) |
| 2757 return; | 2768 return; |
| 2758 | 2769 |
| 2759 file_chooser_->OnFileChoose(file_names); | 2770 file_chooser_->OnFileChoose(file_names); |
| 2760 file_chooser_.reset(); | 2771 file_chooser_.reset(); |
| 2761 } | 2772 } |
| 2762 | 2773 |
| 2774 void RenderView::OnChooseGeolocationProviderResponse(int provider_id) { |
| 2775 // FIXME(benl): can this happen? |
| 2776 if (!geolocation_provider_callback_.get()) |
| 2777 return; |
| 2778 |
| 2779 geolocation_provider_callback_->OnProviderChosen( |
| 2780 (WebCore::GeolocationPowerbox::ProviderId)provider_id); |
| 2781 // We don't reset, because if the user asks us to re-choose, we need this agai
n. |
| 2782 // geolocation_provider_callback_.reset(); |
| 2783 } |
| 2784 |
| 2763 void RenderView::OnEnableViewSourceMode() { | 2785 void RenderView::OnEnableViewSourceMode() { |
| 2764 if (!webview()) | 2786 if (!webview()) |
| 2765 return; | 2787 return; |
| 2766 WebFrame* main_frame = webview()->GetMainFrame(); | 2788 WebFrame* main_frame = webview()->GetMainFrame(); |
| 2767 if (!main_frame) | 2789 if (!main_frame) |
| 2768 return; | 2790 return; |
| 2769 | 2791 |
| 2770 main_frame->enableViewSourceMode(true); | 2792 main_frame->enableViewSourceMode(true); |
| 2771 } | 2793 } |
| 2772 | 2794 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3318 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3340 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
| 3319 } | 3341 } |
| 3320 | 3342 |
| 3321 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3343 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
| 3322 DCHECK(frame); | 3344 DCHECK(frame); |
| 3323 if (print_helper_.get() == NULL) { | 3345 if (print_helper_.get() == NULL) { |
| 3324 print_helper_.reset(new PrintWebViewHelper(this)); | 3346 print_helper_.reset(new PrintWebViewHelper(this)); |
| 3325 } | 3347 } |
| 3326 print_helper_->Print(frame, script_initiated); | 3348 print_helper_->Print(frame, script_initiated); |
| 3327 } | 3349 } |
| OLD | NEW |