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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1013 void RenderView::OnScrollFocusedEditableNodeIntoView() { | 1013 void RenderView::OnScrollFocusedEditableNodeIntoView() { |
1014 WebKit::WebNode node = GetFocusedNode(); | 1014 WebKit::WebNode node = GetFocusedNode(); |
1015 if (!node.isNull()) { | 1015 if (!node.isNull()) { |
1016 if (IsEditableNode(node)) | 1016 if (IsEditableNode(node)) |
1017 // TODO(varunjain): Change webkit API to scroll a particular node into | 1017 // TODO(varunjain): Change webkit API to scroll a particular node into |
1018 // view and use that API here instead. | 1018 // view and use that API here instead. |
1019 webview()->scrollFocusedNodeIntoView(); | 1019 webview()->scrollFocusedNodeIntoView(); |
1020 } | 1020 } |
1021 } | 1021 } |
1022 | 1022 |
1023 void RenderView::OnSetHistoryLengthAndClear(int history_length) { | 1023 void RenderView::OnSetHistoryLengthAndClear(int history_length, int32 page_id) { |
1024 DCHECK(history_length >= 0); | 1024 DCHECK(history_length >= 0); |
1025 | 1025 |
1026 if (page_id >= 0) { | |
1027 // It's possible that the underlying page could have done navigation | |
1028 // at this point, which this isn't prepared for. | |
1029 // TODO(cbentzel): Send a message to the browser? There will be a | |
1030 // mismatch between NavigationController and RenderView here. | |
1031 if (page_id_ != page_id) { | |
Charlie Reis
2011/08/11 20:49:24
Dropping this message doesn't seem like the right
| |
1032 return; | |
1033 } | |
1034 } else { | |
1035 // The prerendered page could have been swapped after the initial Navigate | |
1036 // message is sent but prior to the commit of the provisional load being | |
1037 // done, and sent to the browser. In that case, we can't validate so | |
1038 // use the current one. | |
1039 DCHECK(page_id == -1); | |
Charlie Reis
2011/08/11 20:49:24
I'm wondering if this whole block would be clearer
| |
1040 } | |
1041 | |
1026 // history_list_length_ may be 0 if this is called between | 1042 // history_list_length_ may be 0 if this is called between |
1027 // a navigate and a commit of the provisional load. Otherwise, | 1043 // a navigate and a commit of the provisional load. Otherwise, |
1028 // only add one entry, regardless of how long the current history is. | 1044 // only add one entry, regardless of how long the current history is. |
1029 // TODO(cbentzel): Investigate what happens if a prerendered page | 1045 // TODO(cbentzel): Investigate what happens if a prerendered page |
1030 // navigates to several entries before it is swapped in. Cropping | 1046 // navigates to several entries before it is swapped in. Cropping |
1031 // those may be a bad idea. | 1047 // those may be a bad idea. |
1032 int new_history_list_length = history_length; | 1048 int new_history_list_length = history_length; |
1033 if (history_list_length_ > 0) | 1049 if (history_list_length_ > 0) |
1034 ++new_history_list_length; | 1050 ++new_history_list_length; |
1035 | 1051 |
(...skipping 3448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4484 } | 4500 } |
4485 #endif | 4501 #endif |
4486 | 4502 |
4487 void RenderView::OnContextMenuClosed( | 4503 void RenderView::OnContextMenuClosed( |
4488 const webkit_glue::CustomContextMenuContext& custom_context) { | 4504 const webkit_glue::CustomContextMenuContext& custom_context) { |
4489 if (custom_context.is_pepper_menu) | 4505 if (custom_context.is_pepper_menu) |
4490 pepper_delegate_.OnContextMenuClosed(custom_context); | 4506 pepper_delegate_.OnContextMenuClosed(custom_context); |
4491 else | 4507 else |
4492 context_menu_node_.reset(); | 4508 context_menu_node_.reset(); |
4493 } | 4509 } |
OLD | NEW |