| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/test/render_view_test.h" | 5 #include "content/public/test/render_view_test.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/common/dom_storage/dom_storage_types.h" | 8 #include "content/common/dom_storage/dom_storage_types.h" |
| 9 #include "content/common/input_messages.h" | 9 #include "content/common/input_messages.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 21 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 22 #include "third_party/WebKit/public/web/WebInputEvent.h" | 22 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 23 #include "third_party/WebKit/public/web/WebKit.h" | 23 #include "third_party/WebKit/public/web/WebKit.h" |
| 24 #include "third_party/WebKit/public/web/WebScreenInfo.h" | 24 #include "third_party/WebKit/public/web/WebScreenInfo.h" |
| 25 #include "third_party/WebKit/public/web/WebScriptController.h" | 25 #include "third_party/WebKit/public/web/WebScriptController.h" |
| 26 #include "third_party/WebKit/public/web/WebScriptSource.h" | 26 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 27 #include "third_party/WebKit/public/web/WebView.h" | 27 #include "third_party/WebKit/public/web/WebView.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
| 30 | 30 |
| 31 using WebKit::WebFrame; | 31 using blink::WebFrame; |
| 32 using WebKit::WebInputEvent; | 32 using blink::WebInputEvent; |
| 33 using WebKit::WebMouseEvent; | 33 using blink::WebMouseEvent; |
| 34 using WebKit::WebScriptController; | 34 using blink::WebScriptController; |
| 35 using WebKit::WebScriptSource; | 35 using blink::WebScriptSource; |
| 36 using WebKit::WebString; | 36 using blink::WebString; |
| 37 using WebKit::WebURLRequest; | 37 using blink::WebURLRequest; |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 const int32 kOpenerId = -2; | 40 const int32 kOpenerId = -2; |
| 41 const int32 kRouteId = 5; | 41 const int32 kRouteId = 5; |
| 42 const int32 kMainFrameRouteId = 6; | 42 const int32 kMainFrameRouteId = 6; |
| 43 const int32 kNewWindowRouteId = 7; | 43 const int32 kNewWindowRouteId = 7; |
| 44 const int32 kSurfaceId = 42; | 44 const int32 kSurfaceId = 42; |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 namespace content { | 48 namespace content { |
| 49 | 49 |
| 50 class RendererWebKitPlatformSupportImplNoSandboxImpl | 50 class RendererWebKitPlatformSupportImplNoSandboxImpl |
| 51 : public RendererWebKitPlatformSupportImpl { | 51 : public RendererWebKitPlatformSupportImpl { |
| 52 public: | 52 public: |
| 53 virtual WebKit::WebSandboxSupport* sandboxSupport() { | 53 virtual blink::WebSandboxSupport* sandboxSupport() { |
| 54 return NULL; | 54 return NULL; |
| 55 } | 55 } |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 RenderViewTest::RendererWebKitPlatformSupportImplNoSandbox:: | 58 RenderViewTest::RendererWebKitPlatformSupportImplNoSandbox:: |
| 59 RendererWebKitPlatformSupportImplNoSandbox() { | 59 RendererWebKitPlatformSupportImplNoSandbox() { |
| 60 webkit_platform_support_.reset( | 60 webkit_platform_support_.reset( |
| 61 new RendererWebKitPlatformSupportImplNoSandboxImpl()); | 61 new RendererWebKitPlatformSupportImplNoSandboxImpl()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 RenderViewTest::RendererWebKitPlatformSupportImplNoSandbox:: | 64 RenderViewTest::RendererWebKitPlatformSupportImplNoSandbox:: |
| 65 ~RendererWebKitPlatformSupportImplNoSandbox() { | 65 ~RendererWebKitPlatformSupportImplNoSandbox() { |
| 66 } | 66 } |
| 67 | 67 |
| 68 WebKit::Platform* | 68 blink::Platform* |
| 69 RenderViewTest::RendererWebKitPlatformSupportImplNoSandbox::Get() { | 69 RenderViewTest::RendererWebKitPlatformSupportImplNoSandbox::Get() { |
| 70 return webkit_platform_support_.get(); | 70 return webkit_platform_support_.get(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 RenderViewTest::RenderViewTest() | 73 RenderViewTest::RenderViewTest() |
| 74 : view_(NULL) { | 74 : view_(NULL) { |
| 75 } | 75 } |
| 76 | 76 |
| 77 RenderViewTest::~RenderViewTest() { | 77 RenderViewTest::~RenderViewTest() { |
| 78 } | 78 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 url_str.append(html); | 110 url_str.append(html); |
| 111 GURL url(url_str); | 111 GURL url(url_str); |
| 112 | 112 |
| 113 GetMainFrame()->loadRequest(WebURLRequest(url)); | 113 GetMainFrame()->loadRequest(WebURLRequest(url)); |
| 114 | 114 |
| 115 // The load actually happens asynchronously, so we pump messages to process | 115 // The load actually happens asynchronously, so we pump messages to process |
| 116 // the pending continuation. | 116 // the pending continuation. |
| 117 ProcessPendingMessages(); | 117 ProcessPendingMessages(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void RenderViewTest::GoBack(const WebKit::WebHistoryItem& item) { | 120 void RenderViewTest::GoBack(const blink::WebHistoryItem& item) { |
| 121 GoToOffset(-1, item); | 121 GoToOffset(-1, item); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void RenderViewTest::GoForward(const WebKit::WebHistoryItem& item) { | 124 void RenderViewTest::GoForward(const blink::WebHistoryItem& item) { |
| 125 GoToOffset(1, item); | 125 GoToOffset(1, item); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void RenderViewTest::SetUp() { | 128 void RenderViewTest::SetUp() { |
| 129 // Subclasses can set the ContentClient's renderer before calling | 129 // Subclasses can set the ContentClient's renderer before calling |
| 130 // RenderViewTest::SetUp(). | 130 // RenderViewTest::SetUp(). |
| 131 ContentRendererClient* old_client = | 131 ContentRendererClient* old_client = |
| 132 SetRendererClientForTesting(&content_renderer_client_); | 132 SetRendererClientForTesting(&content_renderer_client_); |
| 133 if (old_client) | 133 if (old_client) |
| 134 SetRendererClientForTesting(old_client); | 134 SetRendererClientForTesting(old_client); |
| 135 | 135 |
| 136 // Subclasses can set render_thread_ with their own implementation before | 136 // Subclasses can set render_thread_ with their own implementation before |
| 137 // calling RenderViewTest::SetUp(). | 137 // calling RenderViewTest::SetUp(). |
| 138 if (!render_thread_) | 138 if (!render_thread_) |
| 139 render_thread_.reset(new MockRenderThread()); | 139 render_thread_.reset(new MockRenderThread()); |
| 140 render_thread_->set_routing_id(kRouteId); | 140 render_thread_->set_routing_id(kRouteId); |
| 141 render_thread_->set_surface_id(kSurfaceId); | 141 render_thread_->set_surface_id(kSurfaceId); |
| 142 render_thread_->set_new_window_routing_id(kNewWindowRouteId); | 142 render_thread_->set_new_window_routing_id(kNewWindowRouteId); |
| 143 | 143 |
| 144 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); | 144 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); |
| 145 params_.reset(new MainFunctionParams(*command_line_)); | 145 params_.reset(new MainFunctionParams(*command_line_)); |
| 146 platform_.reset(new RendererMainPlatformDelegate(*params_)); | 146 platform_.reset(new RendererMainPlatformDelegate(*params_)); |
| 147 platform_->PlatformInitialize(); | 147 platform_->PlatformInitialize(); |
| 148 | 148 |
| 149 // Setting flags and really doing anything with WebKit is fairly fragile and | 149 // Setting flags and really doing anything with WebKit is fairly fragile and |
| 150 // hacky, but this is the world we live in... | 150 // hacky, but this is the world we live in... |
| 151 webkit_glue::SetJavaScriptFlags(" --expose-gc"); | 151 webkit_glue::SetJavaScriptFlags(" --expose-gc"); |
| 152 WebKit::initialize(webkit_platform_support_.Get()); | 152 blink::initialize(webkit_platform_support_.Get()); |
| 153 | 153 |
| 154 // Ensure that we register any necessary schemes when initializing WebKit, | 154 // Ensure that we register any necessary schemes when initializing WebKit, |
| 155 // since we are using a MockRenderThread. | 155 // since we are using a MockRenderThread. |
| 156 RenderThreadImpl::RegisterSchemes(); | 156 RenderThreadImpl::RegisterSchemes(); |
| 157 | 157 |
| 158 // This check is needed because when run under content_browsertests, | 158 // This check is needed because when run under content_browsertests, |
| 159 // ResourceBundle isn't initialized (since we have to use a diferent test | 159 // ResourceBundle isn't initialized (since we have to use a diferent test |
| 160 // suite implementation than for content_unittests). For browser_tests, this | 160 // suite implementation than for content_unittests). For browser_tests, this |
| 161 // is already initialized. | 161 // is already initialized. |
| 162 if (!ResourceBundle::HasSharedInstance()) | 162 if (!ResourceBundle::HasSharedInstance()) |
| 163 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 163 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
| 164 | 164 |
| 165 mock_process_.reset(new MockRenderProcess); | 165 mock_process_.reset(new MockRenderProcess); |
| 166 | 166 |
| 167 // This needs to pass the mock render thread to the view. | 167 // This needs to pass the mock render thread to the view. |
| 168 RenderViewImpl* view = RenderViewImpl::Create( | 168 RenderViewImpl* view = RenderViewImpl::Create( |
| 169 kOpenerId, | 169 kOpenerId, |
| 170 RendererPreferences(), | 170 RendererPreferences(), |
| 171 WebPreferences(), | 171 WebPreferences(), |
| 172 kRouteId, | 172 kRouteId, |
| 173 kMainFrameRouteId, | 173 kMainFrameRouteId, |
| 174 kSurfaceId, | 174 kSurfaceId, |
| 175 kInvalidSessionStorageNamespaceId, | 175 kInvalidSessionStorageNamespaceId, |
| 176 string16(), | 176 string16(), |
| 177 false, // is_renderer_created | 177 false, // is_renderer_created |
| 178 false, // swapped_out | 178 false, // swapped_out |
| 179 false, // hidden | 179 false, // hidden |
| 180 1, // next_page_id | 180 1, // next_page_id |
| 181 WebKit::WebScreenInfo(), | 181 blink::WebScreenInfo(), |
| 182 AccessibilityModeOff, | 182 AccessibilityModeOff, |
| 183 true); | 183 true); |
| 184 view->AddRef(); | 184 view->AddRef(); |
| 185 view_ = view; | 185 view_ = view; |
| 186 } | 186 } |
| 187 | 187 |
| 188 void RenderViewTest::TearDown() { | 188 void RenderViewTest::TearDown() { |
| 189 // Try very hard to collect garbage before shutting down. | 189 // Try very hard to collect garbage before shutting down. |
| 190 // "5" was chosen following http://crbug.com/46571#c9 | 190 // "5" was chosen following http://crbug.com/46571#c9 |
| 191 const int kGCIterations = 5; | 191 const int kGCIterations = 5; |
| 192 for (int i = 0; i < kGCIterations; i++) | 192 for (int i = 0; i < kGCIterations; i++) |
| 193 GetMainFrame()->collectGarbage(); | 193 GetMainFrame()->collectGarbage(); |
| 194 | 194 |
| 195 // Run the loop so the release task from the renderwidget executes. | 195 // Run the loop so the release task from the renderwidget executes. |
| 196 ProcessPendingMessages(); | 196 ProcessPendingMessages(); |
| 197 | 197 |
| 198 for (int i = 0; i < kGCIterations; i++) | 198 for (int i = 0; i < kGCIterations; i++) |
| 199 GetMainFrame()->collectGarbage(); | 199 GetMainFrame()->collectGarbage(); |
| 200 | 200 |
| 201 render_thread_->SendCloseMessage(); | 201 render_thread_->SendCloseMessage(); |
| 202 view_ = NULL; | 202 view_ = NULL; |
| 203 mock_process_.reset(); | 203 mock_process_.reset(); |
| 204 | 204 |
| 205 // After telling the view to close and resetting mock_process_ we may get | 205 // After telling the view to close and resetting mock_process_ we may get |
| 206 // some new tasks which need to be processed before shutting down WebKit | 206 // some new tasks which need to be processed before shutting down WebKit |
| 207 // (http://crbug.com/21508). | 207 // (http://crbug.com/21508). |
| 208 base::RunLoop().RunUntilIdle(); | 208 base::RunLoop().RunUntilIdle(); |
| 209 | 209 |
| 210 WebKit::shutdown(); | 210 blink::shutdown(); |
| 211 | 211 |
| 212 platform_->PlatformUninitialize(); | 212 platform_->PlatformUninitialize(); |
| 213 platform_.reset(); | 213 platform_.reset(); |
| 214 params_.reset(); | 214 params_.reset(); |
| 215 command_line_.reset(); | 215 command_line_.reset(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void RenderViewTest::SendNativeKeyEvent( | 218 void RenderViewTest::SendNativeKeyEvent( |
| 219 const NativeWebKeyboardEvent& key_event) { | 219 const NativeWebKeyboardEvent& key_event) { |
| 220 SendWebKeyboardEvent(key_event); | 220 SendWebKeyboardEvent(key_event); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void RenderViewTest::SendWebKeyboardEvent( | 223 void RenderViewTest::SendWebKeyboardEvent( |
| 224 const WebKit::WebKeyboardEvent& key_event) { | 224 const blink::WebKeyboardEvent& key_event) { |
| 225 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 225 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 226 impl->OnMessageReceived( | 226 impl->OnMessageReceived( |
| 227 InputMsg_HandleInputEvent(0, &key_event, ui::LatencyInfo(), false)); | 227 InputMsg_HandleInputEvent(0, &key_event, ui::LatencyInfo(), false)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void RenderViewTest::SendWebMouseEvent( | 230 void RenderViewTest::SendWebMouseEvent( |
| 231 const WebKit::WebMouseEvent& mouse_event) { | 231 const blink::WebMouseEvent& mouse_event) { |
| 232 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 232 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 233 impl->OnMessageReceived( | 233 impl->OnMessageReceived( |
| 234 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); | 234 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 const char* const kGetCoordinatesScript = | 237 const char* const kGetCoordinatesScript = |
| 238 "(function() {" | 238 "(function() {" |
| 239 " function GetCoordinates(elem) {" | 239 " function GetCoordinates(elem) {" |
| 240 " if (!elem)" | 240 " if (!elem)" |
| 241 " return [ 0, 0];" | 241 " return [ 0, 0];" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 mouse_event.x = bounds.CenterPoint().x(); | 289 mouse_event.x = bounds.CenterPoint().x(); |
| 290 mouse_event.y = bounds.CenterPoint().y(); | 290 mouse_event.y = bounds.CenterPoint().y(); |
| 291 mouse_event.clickCount = 1; | 291 mouse_event.clickCount = 1; |
| 292 scoped_ptr<IPC::Message> input_message( | 292 scoped_ptr<IPC::Message> input_message( |
| 293 new InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); | 293 new InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
| 294 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 294 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 295 impl->OnMessageReceived(*input_message); | 295 impl->OnMessageReceived(*input_message); |
| 296 return true; | 296 return true; |
| 297 } | 297 } |
| 298 | 298 |
| 299 void RenderViewTest::SetFocused(const WebKit::WebNode& node) { | 299 void RenderViewTest::SetFocused(const blink::WebNode& node) { |
| 300 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 300 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 301 impl->focusedNodeChanged(node); | 301 impl->focusedNodeChanged(node); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void RenderViewTest::ClearHistory() { | 304 void RenderViewTest::ClearHistory() { |
| 305 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 305 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 306 impl->page_id_ = -1; | 306 impl->page_id_ = -1; |
| 307 impl->history_list_offset_ = -1; | 307 impl->history_list_offset_ = -1; |
| 308 impl->history_list_length_ = 0; | 308 impl->history_list_length_ = 0; |
| 309 impl->history_page_ids_.clear(); | 309 impl->history_page_ids_.clear(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void RenderViewTest::Reload(const GURL& url) { | 312 void RenderViewTest::Reload(const GURL& url) { |
| 313 ViewMsg_Navigate_Params params; | 313 ViewMsg_Navigate_Params params; |
| 314 params.url = url; | 314 params.url = url; |
| 315 params.navigation_type = ViewMsg_Navigate_Type::RELOAD; | 315 params.navigation_type = ViewMsg_Navigate_Type::RELOAD; |
| 316 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 316 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 317 impl->OnNavigate(params); | 317 impl->OnNavigate(params); |
| 318 } | 318 } |
| 319 | 319 |
| 320 uint32 RenderViewTest::GetNavigationIPCType() { | 320 uint32 RenderViewTest::GetNavigationIPCType() { |
| 321 return ViewHostMsg_FrameNavigate::ID; | 321 return ViewHostMsg_FrameNavigate::ID; |
| 322 } | 322 } |
| 323 | 323 |
| 324 void RenderViewTest::Resize(gfx::Size new_size, | 324 void RenderViewTest::Resize(gfx::Size new_size, |
| 325 gfx::Rect resizer_rect, | 325 gfx::Rect resizer_rect, |
| 326 bool is_fullscreen) { | 326 bool is_fullscreen) { |
| 327 ViewMsg_Resize_Params params; | 327 ViewMsg_Resize_Params params; |
| 328 params.screen_info = WebKit::WebScreenInfo(); | 328 params.screen_info = blink::WebScreenInfo(); |
| 329 params.new_size = new_size; | 329 params.new_size = new_size; |
| 330 params.physical_backing_size = new_size; | 330 params.physical_backing_size = new_size; |
| 331 params.overdraw_bottom_height = 0.f; | 331 params.overdraw_bottom_height = 0.f; |
| 332 params.resizer_rect = resizer_rect; | 332 params.resizer_rect = resizer_rect; |
| 333 params.is_fullscreen = is_fullscreen; | 333 params.is_fullscreen = is_fullscreen; |
| 334 scoped_ptr<IPC::Message> resize_message(new ViewMsg_Resize(0, params)); | 334 scoped_ptr<IPC::Message> resize_message(new ViewMsg_Resize(0, params)); |
| 335 OnMessageReceived(*resize_message); | 335 OnMessageReceived(*resize_message); |
| 336 } | 336 } |
| 337 | 337 |
| 338 bool RenderViewTest::OnMessageReceived(const IPC::Message& msg) { | 338 bool RenderViewTest::OnMessageReceived(const IPC::Message& msg) { |
| 339 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 339 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 340 return impl->OnMessageReceived(msg); | 340 return impl->OnMessageReceived(msg); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void RenderViewTest::DidNavigateWithinPage(WebKit::WebFrame* frame, | 343 void RenderViewTest::DidNavigateWithinPage(blink::WebFrame* frame, |
| 344 bool is_new_navigation) { | 344 bool is_new_navigation) { |
| 345 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 345 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 346 impl->didNavigateWithinPage(frame, is_new_navigation); | 346 impl->didNavigateWithinPage(frame, is_new_navigation); |
| 347 } | 347 } |
| 348 | 348 |
| 349 void RenderViewTest::SendContentStateImmediately() { | 349 void RenderViewTest::SendContentStateImmediately() { |
| 350 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 350 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 351 impl->set_send_content_state_immediately(true); | 351 impl->set_send_content_state_immediately(true); |
| 352 } | 352 } |
| 353 | 353 |
| 354 WebKit::WebWidget* RenderViewTest::GetWebWidget() { | 354 blink::WebWidget* RenderViewTest::GetWebWidget() { |
| 355 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 355 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 356 return impl->webwidget(); | 356 return impl->webwidget(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void RenderViewTest::GoToOffset(int offset, | 359 void RenderViewTest::GoToOffset(int offset, |
| 360 const WebKit::WebHistoryItem& history_item) { | 360 const blink::WebHistoryItem& history_item) { |
| 361 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 361 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 362 | 362 |
| 363 int history_list_length = impl->historyBackListCount() + | 363 int history_list_length = impl->historyBackListCount() + |
| 364 impl->historyForwardListCount() + 1; | 364 impl->historyForwardListCount() + 1; |
| 365 int pending_offset = offset + impl->history_list_offset(); | 365 int pending_offset = offset + impl->history_list_offset(); |
| 366 | 366 |
| 367 ViewMsg_Navigate_Params navigate_params; | 367 ViewMsg_Navigate_Params navigate_params; |
| 368 navigate_params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 368 navigate_params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
| 369 navigate_params.transition = PAGE_TRANSITION_FORWARD_BACK; | 369 navigate_params.transition = PAGE_TRANSITION_FORWARD_BACK; |
| 370 navigate_params.current_history_list_length = history_list_length; | 370 navigate_params.current_history_list_length = history_list_length; |
| 371 navigate_params.current_history_list_offset = impl->history_list_offset(); | 371 navigate_params.current_history_list_offset = impl->history_list_offset(); |
| 372 navigate_params.pending_history_list_offset = pending_offset; | 372 navigate_params.pending_history_list_offset = pending_offset; |
| 373 navigate_params.page_id = impl->GetPageId() + offset; | 373 navigate_params.page_id = impl->GetPageId() + offset; |
| 374 navigate_params.page_state = HistoryItemToPageState(history_item); | 374 navigate_params.page_state = HistoryItemToPageState(history_item); |
| 375 navigate_params.request_time = base::Time::Now(); | 375 navigate_params.request_time = base::Time::Now(); |
| 376 | 376 |
| 377 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); | 377 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); |
| 378 OnMessageReceived(navigate_message); | 378 OnMessageReceived(navigate_message); |
| 379 | 379 |
| 380 // The load actually happens asynchronously, so we pump messages to process | 380 // The load actually happens asynchronously, so we pump messages to process |
| 381 // the pending continuation. | 381 // the pending continuation. |
| 382 ProcessPendingMessages(); | 382 ProcessPendingMessages(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace content | 385 } // namespace content |
| OLD | NEW |