| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 696 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 697 // TODO(viettrungluu): Move to a separate message filter. | 697 // TODO(viettrungluu): Move to a separate message filter. |
| 698 #if defined(ENABLE_FLAPPER_HACKS) | 698 #if defined(ENABLE_FLAPPER_HACKS) |
| 699 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) | 699 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) |
| 700 #endif | 700 #endif |
| 701 #if defined(OS_MACOSX) | 701 #if defined(OS_MACOSX) |
| 702 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 702 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 703 #endif | 703 #endif |
| 704 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRemoteAccessClientFirewallTraversal, | 704 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRemoteAccessClientFirewallTraversal, |
| 705 OnUpdateRemoteAccessClientFirewallTraversal) | 705 OnUpdateRemoteAccessClientFirewallTraversal) |
| 706 IPC_MESSAGE_HANDLER(ViewMsg_ShiftHistory, OnShiftHistory) |
| 706 // Have the super handle all other messages. | 707 // Have the super handle all other messages. |
| 707 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 708 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 708 IPC_END_MESSAGE_MAP() | 709 IPC_END_MESSAGE_MAP() |
| 709 return handled; | 710 return handled; |
| 710 } | 711 } |
| 711 | 712 |
| 712 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { | 713 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| 713 if (!webview()) | 714 if (!webview()) |
| 714 return; | 715 return; |
| 715 | 716 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 void RenderView::OnScrollFocusedEditableNodeIntoView() { | 1011 void RenderView::OnScrollFocusedEditableNodeIntoView() { |
| 1011 WebKit::WebNode node = GetFocusedNode(); | 1012 WebKit::WebNode node = GetFocusedNode(); |
| 1012 if (!node.isNull()) { | 1013 if (!node.isNull()) { |
| 1013 if (IsEditableNode(node)) | 1014 if (IsEditableNode(node)) |
| 1014 // TODO(varunjain): Change webkit API to scroll a particular node into | 1015 // TODO(varunjain): Change webkit API to scroll a particular node into |
| 1015 // view and use that API here instead. | 1016 // view and use that API here instead. |
| 1016 webview()->scrollFocusedNodeIntoView(); | 1017 webview()->scrollFocusedNodeIntoView(); |
| 1017 } | 1018 } |
| 1018 } | 1019 } |
| 1019 | 1020 |
| 1021 void RenderView::OnShiftHistory(int history_length) { |
| 1022 DCHECK(history_length >= 0); |
| 1023 DCHECK(history_list_length_ == 0 || history_list_length_ == 1); |
| 1024 int current_page_id = -1; |
| 1025 if (history_list_offset_ >= 0) |
| 1026 current_page_id = history_page_ids_[history_list_offset_]; |
| 1027 int new_history_list_length = history_length + history_list_length_; |
| 1028 std::vector<int32> new_history_page_ids_(new_history_list_length, -1); |
| 1029 if (current_page_id != -1) |
| 1030 new_history_page_ids_[new_history_list_length - 1] = current_page_id; |
| 1031 new_history_page_ids_.swap(history_page_ids_); |
| 1032 history_list_offset_ = new_history_list_length - 1; |
| 1033 history_list_length_ = new_history_list_length; |
| 1034 } |
| 1035 |
| 1020 /////////////////////////////////////////////////////////////////////////////// | 1036 /////////////////////////////////////////////////////////////////////////////// |
| 1021 | 1037 |
| 1022 // Tell the embedding application that the URL of the active page has changed | 1038 // Tell the embedding application that the URL of the active page has changed |
| 1023 void RenderView::UpdateURL(WebFrame* frame) { | 1039 void RenderView::UpdateURL(WebFrame* frame) { |
| 1024 WebDataSource* ds = frame->dataSource(); | 1040 WebDataSource* ds = frame->dataSource(); |
| 1025 DCHECK(ds); | 1041 DCHECK(ds); |
| 1026 | 1042 |
| 1027 const WebURLRequest& request = ds->request(); | 1043 const WebURLRequest& request = ds->request(); |
| 1028 const WebURLRequest& original_request = ds->originalRequest(); | 1044 const WebURLRequest& original_request = ds->originalRequest(); |
| 1029 const WebURLResponse& response = ds->response(); | 1045 const WebURLResponse& response = ds->response(); |
| (...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4462 } | 4478 } |
| 4463 #endif | 4479 #endif |
| 4464 | 4480 |
| 4465 void RenderView::OnContextMenuClosed( | 4481 void RenderView::OnContextMenuClosed( |
| 4466 const webkit_glue::CustomContextMenuContext& custom_context) { | 4482 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4467 if (custom_context.is_pepper_menu) | 4483 if (custom_context.is_pepper_menu) |
| 4468 pepper_delegate_.OnContextMenuClosed(custom_context); | 4484 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4469 else | 4485 else |
| 4470 context_menu_node_.reset(); | 4486 context_menu_node_.reset(); |
| 4471 } | 4487 } |
| OLD | NEW |