| 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 DCHECK_EQ(static_cast<int>(history_page_ids_.size()), history_list_length_); | 847 DCHECK_EQ(static_cast<int>(history_page_ids_.size()), history_list_length_); |
| 848 | 848 |
| 849 // Check for whether the forward history has been cropped due to a recent | 849 // Check for whether the forward history has been cropped due to a recent |
| 850 // navigation the browser didn't know about. | 850 // navigation the browser didn't know about. |
| 851 if (params.pending_history_list_offset >= history_list_length_) | 851 if (params.pending_history_list_offset >= history_list_length_) |
| 852 return true; | 852 return true; |
| 853 | 853 |
| 854 // Check for whether this entry has been replaced with a new one. | 854 // Check for whether this entry has been replaced with a new one. |
| 855 int expected_page_id = | 855 int expected_page_id = |
| 856 history_page_ids_[params.pending_history_list_offset]; | 856 history_page_ids_[params.pending_history_list_offset]; |
| 857 if (expected_page_id > 0 && params.page_id != expected_page_id) | 857 if (expected_page_id > 0 && params.page_id != expected_page_id) { |
| 858 return true; | 858 if (params.page_id < expected_page_id) |
| 859 return true; |
| 860 |
| 861 // Otherwise we've removed an earlier entry and should have shifted all |
| 862 // entries left. For now, it's ok to lazily update the list. |
| 863 // TODO(creis): Notify all live renderers when we remove entries from |
| 864 // the front of the list, so that we don't hit this case. |
| 865 history_page_ids_[params.pending_history_list_offset] = params.page_id; |
| 866 } |
| 859 | 867 |
| 860 return false; | 868 return false; |
| 861 } | 869 } |
| 862 | 870 |
| 863 // Stop loading the current page | 871 // Stop loading the current page |
| 864 void RenderView::OnStop() { | 872 void RenderView::OnStop() { |
| 865 if (webview()) { | 873 if (webview()) { |
| 866 WebFrame* main_frame = webview()->mainFrame(); | 874 WebFrame* main_frame = webview()->mainFrame(); |
| 867 // Stop the alt error page fetcher. If we let it continue it may complete | 875 // Stop the alt error page fetcher. If we let it continue it may complete |
| 868 // and cause RenderViewHostManager to swap to this RenderView, even though | 876 // and cause RenderViewHostManager to swap to this RenderView, even though |
| (...skipping 3615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4484 } | 4492 } |
| 4485 #endif | 4493 #endif |
| 4486 | 4494 |
| 4487 void RenderView::OnContextMenuClosed( | 4495 void RenderView::OnContextMenuClosed( |
| 4488 const webkit_glue::CustomContextMenuContext& custom_context) { | 4496 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4489 if (custom_context.is_pepper_menu) | 4497 if (custom_context.is_pepper_menu) |
| 4490 pepper_delegate_.OnContextMenuClosed(custom_context); | 4498 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4491 else | 4499 else |
| 4492 context_menu_node_.reset(); | 4500 context_menu_node_.reset(); |
| 4493 } | 4501 } |
| OLD | NEW |