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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) | 1018 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) |
1019 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 1019 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
1020 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoView, | 1020 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoView, |
1021 OnScrollFocusedEditableNodeIntoView) | 1021 OnScrollFocusedEditableNodeIntoView) |
1022 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 1022 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
1023 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 1023 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
1024 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) | 1024 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) |
1025 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) | 1025 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
1026 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, | 1026 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, |
1027 OnDisplayPrerenderedPage) | 1027 OnDisplayPrerenderedPage) |
| 1028 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, |
| 1029 OnEnumerateDirectoryResponse) |
1028 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) | 1030 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
1029 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1031 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1030 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 1032 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
1031 OnGetAllSavableResourceLinksForCurrentPage) | 1033 OnGetAllSavableResourceLinksForCurrentPage) |
1032 IPC_MESSAGE_HANDLER( | 1034 IPC_MESSAGE_HANDLER( |
1033 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1035 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1034 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1036 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1035 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo) | 1037 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo) |
1036 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) | 1038 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) |
1037 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 1039 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2306 else | 2308 else |
2307 ipc_params.mode = ViewHostMsg_RunFileChooser_Mode::Open; | 2309 ipc_params.mode = ViewHostMsg_RunFileChooser_Mode::Open; |
2308 ipc_params.title = params.title; | 2310 ipc_params.title = params.title; |
2309 ipc_params.default_file_name = | 2311 ipc_params.default_file_name = |
2310 webkit_glue::WebStringToFilePath(params.initialValue); | 2312 webkit_glue::WebStringToFilePath(params.initialValue); |
2311 ipc_params.accept_types = params.acceptTypes; | 2313 ipc_params.accept_types = params.acceptTypes; |
2312 | 2314 |
2313 return ScheduleFileChooser(ipc_params, chooser_completion); | 2315 return ScheduleFileChooser(ipc_params, chooser_completion); |
2314 } | 2316 } |
2315 | 2317 |
| 2318 bool RenderView::enumerateDirectory( |
| 2319 const WebString& path, |
| 2320 WebFileChooserCompletion* chooser_completion) { |
| 2321 int id = enumeration_completion_id_++; |
| 2322 enumeration_completions_[id] = chooser_completion; |
| 2323 return Send(new ViewHostMsg_EnumerateDirectory( |
| 2324 routing_id_, |
| 2325 id, |
| 2326 webkit_glue::WebStringToFilePath(path))); |
| 2327 } |
| 2328 |
2316 void RenderView::runModalAlertDialog( | 2329 void RenderView::runModalAlertDialog( |
2317 WebFrame* frame, const WebString& message) { | 2330 WebFrame* frame, const WebString& message) { |
2318 RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, | 2331 RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, |
2319 UTF16ToWideHack(message), | 2332 UTF16ToWideHack(message), |
2320 std::wstring(), | 2333 std::wstring(), |
2321 frame->url(), | 2334 frame->url(), |
2322 NULL); | 2335 NULL); |
2323 } | 2336 } |
2324 | 2337 |
2325 bool RenderView::runModalConfirmDialog( | 2338 bool RenderView::runModalConfirmDialog( |
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4450 if (provisional_ds) { | 4463 if (provisional_ds) { |
4451 NavigationState* provisional_navigation_state = | 4464 NavigationState* provisional_navigation_state = |
4452 NavigationState::FromDataSource(provisional_ds); | 4465 NavigationState::FromDataSource(provisional_ds); |
4453 if (provisional_navigation_state) { | 4466 if (provisional_navigation_state) { |
4454 provisional_navigation_state->set_prerendered_page_display_time( | 4467 provisional_navigation_state->set_prerendered_page_display_time( |
4455 Time::Now()); | 4468 Time::Now()); |
4456 } | 4469 } |
4457 } | 4470 } |
4458 } | 4471 } |
4459 | 4472 |
| 4473 void RenderView::OnEnumerateDirectoryResponse( |
| 4474 int id, |
| 4475 const std::vector<FilePath>& paths) { |
| 4476 if (!enumeration_completions_[id]) |
| 4477 return; |
| 4478 |
| 4479 WebVector<WebString> ws_file_names(paths.size()); |
| 4480 for (size_t i = 0; i < paths.size(); ++i) |
| 4481 ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]); |
| 4482 |
| 4483 enumeration_completions_[id]->didChooseFile(ws_file_names); |
| 4484 enumeration_completions_.erase(id); |
| 4485 } |
| 4486 |
4460 void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) { | 4487 void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) { |
4461 // This could happen if we navigated to a different page before the user | 4488 // This could happen if we navigated to a different page before the user |
4462 // closed the chooser. | 4489 // closed the chooser. |
4463 if (file_chooser_completions_.empty()) | 4490 if (file_chooser_completions_.empty()) |
4464 return; | 4491 return; |
4465 | 4492 |
4466 WebVector<WebString> ws_file_names(paths.size()); | 4493 WebVector<WebString> ws_file_names(paths.size()); |
4467 for (size_t i = 0; i < paths.size(); ++i) | 4494 for (size_t i = 0; i < paths.size(); ++i) |
4468 ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]); | 4495 ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]); |
4469 | 4496 |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5368 const webkit_glue::CustomContextMenuContext& custom_context) { | 5395 const webkit_glue::CustomContextMenuContext& custom_context) { |
5369 if (custom_context.is_pepper_menu) | 5396 if (custom_context.is_pepper_menu) |
5370 pepper_delegate_.OnContextMenuClosed(custom_context); | 5397 pepper_delegate_.OnContextMenuClosed(custom_context); |
5371 else | 5398 else |
5372 context_menu_node_.reset(); | 5399 context_menu_node_.reset(); |
5373 } | 5400 } |
5374 | 5401 |
5375 void RenderView::OnNetworkStateChanged(bool online) { | 5402 void RenderView::OnNetworkStateChanged(bool online) { |
5376 WebNetworkStateNotifier::setOnLine(online); | 5403 WebNetworkStateNotifier::setOnLine(online); |
5377 } | 5404 } |
OLD | NEW |