OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 bool handled = true; | 1066 bool handled = true; |
1067 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1067 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
1068 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1068 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1069 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1069 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
1070 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1070 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
1071 OnScrollFocusedEditableNodeIntoRect) | 1071 OnScrollFocusedEditableNodeIntoRect) |
1072 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1072 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
1073 OnSetEditCommandsForNextKeyEvent) | 1073 OnSetEditCommandsForNextKeyEvent) |
1074 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 1074 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
1075 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 1075 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
1076 IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName) | |
1077 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1076 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
1078 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | 1077 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) |
1079 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 1078 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
1080 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 1079 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
1081 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1080 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
1082 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 1081 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
1083 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1082 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
1084 OnSetZoomLevelForLoadingURL) | 1083 OnSetZoomLevelForLoadingURL) |
1085 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1084 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1086 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1085 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 has_scrolled_focused_editable_node_into_rect_ = true; | 1267 has_scrolled_focused_editable_node_into_rect_ = true; |
1269 webview()->scrollFocusedNodeIntoRect(rect); | 1268 webview()->scrollFocusedNodeIntoRect(rect); |
1270 } | 1269 } |
1271 } | 1270 } |
1272 | 1271 |
1273 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( | 1272 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( |
1274 const EditCommands& edit_commands) { | 1273 const EditCommands& edit_commands) { |
1275 edit_commands_ = edit_commands; | 1274 edit_commands_ = edit_commands; |
1276 } | 1275 } |
1277 | 1276 |
1278 void RenderViewImpl::OnSetName(const std::string& name) { | |
1279 if (!webview()) | |
1280 return; | |
1281 | |
1282 webview()->mainFrame()->setName(WebString::fromUTF8(name)); | |
1283 } | |
1284 | |
1285 void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length, | 1277 void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length, |
1286 int32 minimum_page_id) { | 1278 int32 minimum_page_id) { |
1287 DCHECK_GE(history_length, 0); | 1279 DCHECK_GE(history_length, 0); |
1288 DCHECK(history_list_offset_ == history_list_length_ - 1); | 1280 DCHECK(history_list_offset_ == history_list_length_ - 1); |
1289 DCHECK_GE(minimum_page_id, -1); | 1281 DCHECK_GE(minimum_page_id, -1); |
1290 | 1282 |
1291 // Generate the new list. | 1283 // Generate the new list. |
1292 std::vector<int32> new_history_page_ids(history_length, -1); | 1284 std::vector<int32> new_history_page_ids(history_length, -1); |
1293 for (size_t i = 0; i < history_page_ids_.size(); ++i) { | 1285 for (size_t i = 0; i < history_page_ids_.size(); ++i) { |
1294 if (minimum_page_id >= 0 && history_page_ids_[i] < minimum_page_id) | 1286 if (minimum_page_id >= 0 && history_page_ids_[i] < minimum_page_id) |
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4087 std::vector<gfx::Size> sizes; | 4079 std::vector<gfx::Size> sizes; |
4088 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4080 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4089 if (!url.isEmpty()) | 4081 if (!url.isEmpty()) |
4090 urls.push_back( | 4082 urls.push_back( |
4091 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4083 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4092 } | 4084 } |
4093 SendUpdateFaviconURL(urls); | 4085 SendUpdateFaviconURL(urls); |
4094 } | 4086 } |
4095 | 4087 |
4096 } // namespace content | 4088 } // namespace content |
OLD | NEW |