Chromium Code Reviews| 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_SetHistoryLengthAndClear, | |
| 707 OnSetHistoryLengthAndClear) | |
| 706 // Have the super handle all other messages. | 708 // Have the super handle all other messages. |
| 707 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 709 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 708 IPC_END_MESSAGE_MAP() | 710 IPC_END_MESSAGE_MAP() |
| 709 return handled; | 711 return handled; |
| 710 } | 712 } |
| 711 | 713 |
| 712 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { | 714 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| 713 if (!webview()) | 715 if (!webview()) |
| 714 return; | 716 return; |
| 715 | 717 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1010 void RenderView::OnScrollFocusedEditableNodeIntoView() { | 1012 void RenderView::OnScrollFocusedEditableNodeIntoView() { |
| 1011 WebKit::WebNode node = GetFocusedNode(); | 1013 WebKit::WebNode node = GetFocusedNode(); |
| 1012 if (!node.isNull()) { | 1014 if (!node.isNull()) { |
| 1013 if (IsEditableNode(node)) | 1015 if (IsEditableNode(node)) |
| 1014 // TODO(varunjain): Change webkit API to scroll a particular node into | 1016 // TODO(varunjain): Change webkit API to scroll a particular node into |
| 1015 // view and use that API here instead. | 1017 // view and use that API here instead. |
| 1016 webview()->scrollFocusedNodeIntoView(); | 1018 webview()->scrollFocusedNodeIntoView(); |
| 1017 } | 1019 } |
| 1018 } | 1020 } |
| 1019 | 1021 |
| 1022 void RenderView::OnSetHistoryLengthAndClear(int history_length) { | |
| 1023 DCHECK(history_length >= 0); | |
| 1024 DCHECK(history_list_length_ == 0 || history_list_length_ == 1); | |
|
Charlie Reis
2011/08/09 20:59:31
Should we return early if this isn't the case? Re
cbentzel
2011/08/09 21:21:12
Yes. Changed to returning early.
| |
| 1025 int current_page_id = -1; | |
|
Charlie Reis
2011/08/09 20:59:31
I think the page_id_ field should be the same thin
| |
| 1026 if (history_list_offset_ >= 0) | |
| 1027 current_page_id = history_page_ids_[history_list_offset_]; | |
| 1028 int new_history_list_length = history_length + history_list_length_; | |
|
Charlie Reis
2011/08/09 20:59:31
Why are we adding the two? It sounds like we're s
cbentzel
2011/08/09 21:21:12
The prerendered page could be swapped in between t
| |
| 1029 std::vector<int32> new_history_page_ids_(new_history_list_length, -1); | |
| 1030 if (current_page_id != -1) | |
| 1031 new_history_page_ids_[new_history_list_length - 1] = current_page_id; | |
| 1032 new_history_page_ids_.swap(history_page_ids_); | |
| 1033 history_list_offset_ = new_history_list_length - 1; | |
| 1034 history_list_length_ = new_history_list_length; | |
| 1035 } | |
| 1036 | |
| 1020 /////////////////////////////////////////////////////////////////////////////// | 1037 /////////////////////////////////////////////////////////////////////////////// |
| 1021 | 1038 |
| 1022 // Tell the embedding application that the URL of the active page has changed | 1039 // Tell the embedding application that the URL of the active page has changed |
| 1023 void RenderView::UpdateURL(WebFrame* frame) { | 1040 void RenderView::UpdateURL(WebFrame* frame) { |
| 1024 WebDataSource* ds = frame->dataSource(); | 1041 WebDataSource* ds = frame->dataSource(); |
| 1025 DCHECK(ds); | 1042 DCHECK(ds); |
| 1026 | 1043 |
| 1027 const WebURLRequest& request = ds->request(); | 1044 const WebURLRequest& request = ds->request(); |
| 1028 const WebURLRequest& original_request = ds->originalRequest(); | 1045 const WebURLRequest& original_request = ds->originalRequest(); |
| 1029 const WebURLResponse& response = ds->response(); | 1046 const WebURLResponse& response = ds->response(); |
| (...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4462 } | 4479 } |
| 4463 #endif | 4480 #endif |
| 4464 | 4481 |
| 4465 void RenderView::OnContextMenuClosed( | 4482 void RenderView::OnContextMenuClosed( |
| 4466 const webkit_glue::CustomContextMenuContext& custom_context) { | 4483 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4467 if (custom_context.is_pepper_menu) | 4484 if (custom_context.is_pepper_menu) |
| 4468 pepper_delegate_.OnContextMenuClosed(custom_context); | 4485 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4469 else | 4486 else |
| 4470 context_menu_node_.reset(); | 4487 context_menu_node_.reset(); |
| 4471 } | 4488 } |
| OLD | NEW |