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

Side by Side Diff: webkit/tools/test_shell/test_webview_delegate.cc

Issue 1036003: Add chromium-side support for history.{push,replace}State. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | « webkit/tools/test_shell/test_webview_delegate.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This file contains the implementation of TestWebViewDelegate, which serves 5 // This file contains the implementation of TestWebViewDelegate, which serves
6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to
7 // have initialized a MessageLoop before these methods are called. 7 // have initialized a MessageLoop before these methods are called.
8 8
9 #include "webkit/tools/test_shell/test_webview_delegate.h" 9 #include "webkit/tools/test_shell/test_webview_delegate.h"
10 10
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 void TestWebViewDelegate::didFinishLoad(WebFrame* frame) { 870 void TestWebViewDelegate::didFinishLoad(WebFrame* frame) {
871 TRACE_EVENT_END("frame.load", this, frame->url().spec()); 871 TRACE_EVENT_END("frame.load", this, frame->url().spec());
872 if (shell_->ShouldDumpFrameLoadCallbacks()) { 872 if (shell_->ShouldDumpFrameLoadCallbacks()) {
873 printf("%S - didFinishLoadForFrame\n", 873 printf("%S - didFinishLoadForFrame\n",
874 GetFrameDescription(frame).c_str()); 874 GetFrameDescription(frame).c_str());
875 } 875 }
876 UpdateAddressBar(frame->view()); 876 UpdateAddressBar(frame->view());
877 LocationChangeDone(frame); 877 LocationChangeDone(frame);
878 } 878 }
879 879
880 void TestWebViewDelegate::didChangeLocationWithinPage( 880 void TestWebViewDelegate::didNavigateWithinPage(
881 WebFrame* frame, bool is_new_navigation) { 881 WebFrame* frame, bool is_new_navigation) {
882 frame->dataSource()->setExtraData(pending_extra_data_.release()); 882 frame->dataSource()->setExtraData(pending_extra_data_.release());
883 883
884 UpdateForCommittedLoad(frame, is_new_navigation);
885 }
886
887 void TestWebViewDelegate::didChangeLocationWithinPage(WebFrame* frame) {
884 if (shell_->ShouldDumpFrameLoadCallbacks()) { 888 if (shell_->ShouldDumpFrameLoadCallbacks()) {
885 printf("%S - didChangeLocationWithinPageForFrame\n", 889 printf("%S - didChangeLocationWithinPageForFrame\n",
886 GetFrameDescription(frame).c_str()); 890 GetFrameDescription(frame).c_str());
887 } 891 }
888
889 UpdateForCommittedLoad(frame, is_new_navigation);
890 } 892 }
891 893
892 void TestWebViewDelegate::assignIdentifierToRequest( 894 void TestWebViewDelegate::assignIdentifierToRequest(
893 WebFrame* frame, unsigned identifier, const WebURLRequest& request) { 895 WebFrame* frame, unsigned identifier, const WebURLRequest& request) {
894 if (shell_->ShouldDumpResourceLoadCallbacks()) { 896 if (shell_->ShouldDumpResourceLoadCallbacks()) {
895 resource_identifier_map_[identifier] = 897 resource_identifier_map_[identifier] =
896 DescriptionSuitableForTestResult(request.url().spec()); 898 DescriptionSuitableForTestResult(request.url().spec());
897 } 899 }
898 } 900 }
899 901
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1082
1081 void TestWebViewDelegate::UpdateAddressBar(WebView* webView) { 1083 void TestWebViewDelegate::UpdateAddressBar(WebView* webView) {
1082 WebFrame* main_frame = webView->mainFrame(); 1084 WebFrame* main_frame = webView->mainFrame();
1083 1085
1084 WebDataSource* data_source = main_frame->dataSource(); 1086 WebDataSource* data_source = main_frame->dataSource();
1085 if (!data_source) 1087 if (!data_source)
1086 data_source = main_frame->provisionalDataSource(); 1088 data_source = main_frame->provisionalDataSource();
1087 if (!data_source) 1089 if (!data_source)
1088 return; 1090 return;
1089 1091
1090 // TODO(abarth): This is wrong! 1092 SetAddressBarURL(data_source->request().url());
1091 SetAddressBarURL(data_source->request().firstPartyForCookies());
1092 } 1093 }
1093 1094
1094 void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) { 1095 void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) {
1095 if (frame == top_loading_frame_) { 1096 if (frame == top_loading_frame_) {
1096 top_loading_frame_ = NULL; 1097 top_loading_frame_ = NULL;
1097 1098
1098 if (shell_->layout_test_mode()) 1099 if (shell_->layout_test_mode())
1099 shell_->layout_test_controller()->LocationChangeDone(); 1100 shell_->layout_test_controller()->LocationChangeDone();
1100 } 1101 }
1101 } 1102 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 } else { 1150 } else {
1150 entry->SetURL(request.url()); 1151 entry->SetURL(request.url());
1151 } 1152 }
1152 1153
1153 const WebHistoryItem& history_item = frame->currentHistoryItem(); 1154 const WebHistoryItem& history_item = frame->currentHistoryItem();
1154 if (!history_item.isNull()) 1155 if (!history_item.isNull())
1155 entry->SetContentState(webkit_glue::HistoryItemToString(history_item)); 1156 entry->SetContentState(webkit_glue::HistoryItemToString(history_item));
1156 1157
1157 shell_->navigation_controller()->DidNavigateToEntry(entry.release()); 1158 shell_->navigation_controller()->DidNavigateToEntry(entry.release());
1158 shell_->UpdateNavigationControls(); 1159 shell_->UpdateNavigationControls();
1160 UpdateAddressBar(frame->view());
1159 1161
1160 last_page_id_updated_ = std::max(last_page_id_updated_, page_id_); 1162 last_page_id_updated_ = std::max(last_page_id_updated_, page_id_);
1161 } 1163 }
1162 1164
1163 void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) { 1165 void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) {
1164 // If we have a valid page ID at this point, then it corresponds to the page 1166 // If we have a valid page ID at this point, then it corresponds to the page
1165 // we are navigating away from. Otherwise, this is the first navigation, so 1167 // we are navigating away from. Otherwise, this is the first navigation, so
1166 // there is no past session history to record. 1168 // there is no past session history to record.
1167 if (page_id_ == -1) 1169 if (page_id_ == -1)
1168 return; 1170 return;
(...skipping 28 matching lines...) Expand all
1197 } 1199 }
1198 1200
1199 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { 1201 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) {
1200 fake_rect_ = rect; 1202 fake_rect_ = rect;
1201 using_fake_rect_ = true; 1203 using_fake_rect_ = true;
1202 } 1204 }
1203 1205
1204 WebRect TestWebViewDelegate::fake_window_rect() { 1206 WebRect TestWebViewDelegate::fake_window_rect() {
1205 return fake_rect_; 1207 return fake_rect_;
1206 } 1208 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698