Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: content/renderer/render_view.cc

Issue 7491096: Fix regression with back-button not working on prerendered and instant pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A few fixes for multiple history entries at swap in Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
1025 // history_list_length_ may be 0 if this is called between
1026 // a navigate and a commit of the provisional load. Otherwise,
1027 // only add one entry, regardless of how long the current history is.
Charlie Reis 2011/08/09 22:51:42 Please add a TODO about investigating what happens
cbentzel 2011/08/09 23:14:23 This does match what the NavigationController does
1028 int new_history_list_length = history_length;
1029 if (history_list_length_ > 0) {
Charlie Reis 2011/08/09 22:51:42 Nit: no braces on a one-liner.
cbentzel 2011/08/09 23:14:23 I always mismatch the style guide here [perhaps du
1030 ++new_history_list_length;
1031 }
1032
1033 // Remember the current page id for the end of the list.
1034 int current_page_id = -1;
Charlie Reis 2011/08/09 22:51:42 Is this needed, or is page_id_ sufficient?
cbentzel 2011/08/09 23:14:23 page_id_ does look sufficient. I'm wondering if th
1035 if (history_list_offset_ >= 0)
1036 current_page_id = history_page_ids_[history_list_offset_];
1037
1038 // Generate the new list.
1039 std::vector<int32> new_history_page_ids_(new_history_list_length, -1);
Charlie Reis 2011/08/09 22:51:42 Nit: local variable shouldn't have an underscore,
cbentzel 2011/08/09 23:14:23 Done.
1040 if (current_page_id != -1)
1041 new_history_page_ids_[new_history_list_length - 1] = current_page_id;
1042 new_history_page_ids_.swap(history_page_ids_);
1043 history_list_offset_ = new_history_list_length - 1;
1044 history_list_length_ = new_history_list_length;
1045 }
1046
1020 /////////////////////////////////////////////////////////////////////////////// 1047 ///////////////////////////////////////////////////////////////////////////////
1021 1048
1022 // Tell the embedding application that the URL of the active page has changed 1049 // Tell the embedding application that the URL of the active page has changed
1023 void RenderView::UpdateURL(WebFrame* frame) { 1050 void RenderView::UpdateURL(WebFrame* frame) {
1024 WebDataSource* ds = frame->dataSource(); 1051 WebDataSource* ds = frame->dataSource();
1025 DCHECK(ds); 1052 DCHECK(ds);
1026 1053
1027 const WebURLRequest& request = ds->request(); 1054 const WebURLRequest& request = ds->request();
1028 const WebURLRequest& original_request = ds->originalRequest(); 1055 const WebURLRequest& original_request = ds->originalRequest();
1029 const WebURLResponse& response = ds->response(); 1056 const WebURLResponse& response = ds->response();
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after
4462 } 4489 }
4463 #endif 4490 #endif
4464 4491
4465 void RenderView::OnContextMenuClosed( 4492 void RenderView::OnContextMenuClosed(
4466 const webkit_glue::CustomContextMenuContext& custom_context) { 4493 const webkit_glue::CustomContextMenuContext& custom_context) {
4467 if (custom_context.is_pepper_menu) 4494 if (custom_context.is_pepper_menu)
4468 pepper_delegate_.OnContextMenuClosed(custom_context); 4495 pepper_delegate_.OnContextMenuClosed(custom_context);
4469 else 4496 else
4470 context_menu_node_.reset(); 4497 context_menu_node_.reset();
4471 } 4498 }
OLDNEW
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698