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_OffsetAndPruneHistory, | |
707 OnOffsetAndPruneHistory) | |
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::OnOffsetAndPruneHistory(int offset) { | |
1023 int current_page_id = -1; | |
tburkard
2011/08/09 17:36:03
I'd add a comment explaining what this does (eithe
cbentzel
2011/08/09 19:12:14
I did this at the ViewMsg declaration, which looke
| |
1024 if (history_list_offset_ >= 0) { | |
brettw
2011/08/09 18:14:40
No {} for single-line conditionals.
cbentzel
2011/08/09 19:12:14
Done.
| |
1025 current_page_id = history_page_ids_[history_list_offset_]; | |
1026 } | |
1027 | |
1028 history_list_offset_ = offset; | |
1029 history_list_length_ = offset + 1; | |
1030 if (history_list_length_ >= 0) | |
brettw
2011/08/09 18:14:40
What case will the history_list_length_ be negativ
cbentzel
2011/08/09 19:12:14
That would be suspicious. Removed during the migra
| |
1031 history_page_ids_.resize(history_list_length_, -1); | |
1032 // Older entries also need to be invalidated. | |
1033 for (int i = 0; i < history_list_offset_; ++i) | |
brettw
2011/08/09 18:14:40
I think this version is a bit easier to follow:
/
cbentzel
2011/08/09 19:12:14
Yes, that's cleaner. Moved to that.
| |
1034 history_page_ids_[i] = -1; | |
1035 history_page_ids_[history_list_offset_] = current_page_id; | |
1036 } | |
1037 | |
1020 /////////////////////////////////////////////////////////////////////////////// | 1038 /////////////////////////////////////////////////////////////////////////////// |
1021 | 1039 |
1022 // Tell the embedding application that the URL of the active page has changed | 1040 // Tell the embedding application that the URL of the active page has changed |
1023 void RenderView::UpdateURL(WebFrame* frame) { | 1041 void RenderView::UpdateURL(WebFrame* frame) { |
1024 WebDataSource* ds = frame->dataSource(); | 1042 WebDataSource* ds = frame->dataSource(); |
1025 DCHECK(ds); | 1043 DCHECK(ds); |
1026 | 1044 |
1027 const WebURLRequest& request = ds->request(); | 1045 const WebURLRequest& request = ds->request(); |
1028 const WebURLRequest& original_request = ds->originalRequest(); | 1046 const WebURLRequest& original_request = ds->originalRequest(); |
1029 const WebURLResponse& response = ds->response(); | 1047 const WebURLResponse& response = ds->response(); |
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4462 } | 4480 } |
4463 #endif | 4481 #endif |
4464 | 4482 |
4465 void RenderView::OnContextMenuClosed( | 4483 void RenderView::OnContextMenuClosed( |
4466 const webkit_glue::CustomContextMenuContext& custom_context) { | 4484 const webkit_glue::CustomContextMenuContext& custom_context) { |
4467 if (custom_context.is_pepper_menu) | 4485 if (custom_context.is_pepper_menu) |
4468 pepper_delegate_.OnContextMenuClosed(custom_context); | 4486 pepper_delegate_.OnContextMenuClosed(custom_context); |
4469 else | 4487 else |
4470 context_menu_node_.reset(); | 4488 context_menu_node_.reset(); |
4471 } | 4489 } |
OLD | NEW |