| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // request. | 219 // request. |
| 220 if (navigations_suspended_) { | 220 if (navigations_suspended_) { |
| 221 // Shouldn't be possible to have a second navigation while suspended, since | 221 // Shouldn't be possible to have a second navigation while suspended, since |
| 222 // navigations will only be suspended during a cross-site request. If a | 222 // navigations will only be suspended during a cross-site request. If a |
| 223 // second navigation occurs, WebContents will cancel this pending RVH | 223 // second navigation occurs, WebContents will cancel this pending RVH |
| 224 // create a new pending RVH. | 224 // create a new pending RVH. |
| 225 DCHECK(!suspended_nav_message_.get()); | 225 DCHECK(!suspended_nav_message_.get()); |
| 226 suspended_nav_message_.reset(nav_message); | 226 suspended_nav_message_.reset(nav_message); |
| 227 } else { | 227 } else { |
| 228 Send(nav_message); | 228 Send(nav_message); |
| 229 |
| 230 // Force the throbber to start. We do this because WebKit's "started |
| 231 // loading" message will be received asynchronously from the UI of the |
| 232 // browser. But we want to keep the throbber in sync with what's happening |
| 233 // in the UI. For example, we want to start throbbing immediately when the |
| 234 // user naivgates even if the renderer is delayed. There is also an issue |
| 235 // with the throbber starting because the DOMUI (which controls whether the |
| 236 // favicon is displayed) happens synchronously. If the start loading |
| 237 // messages was asynchronous, then the default favicon would flash in. |
| 238 delegate_->DidStartLoading(this); |
| 229 } | 239 } |
| 230 } | 240 } |
| 231 | 241 |
| 232 void RenderViewHost::LoadAlternateHTMLString(const std::string& html_text, | 242 void RenderViewHost::LoadAlternateHTMLString(const std::string& html_text, |
| 233 bool new_navigation, | 243 bool new_navigation, |
| 234 const GURL& display_url, | 244 const GURL& display_url, |
| 235 const std::string& security_info) { | 245 const std::string& security_info) { |
| 236 Send(new ViewMsg_LoadAlternateHTMLText(routing_id(), html_text, | 246 Send(new ViewMsg_LoadAlternateHTMLText(routing_id(), html_text, |
| 237 new_navigation, display_url, | 247 new_navigation, display_url, |
| 238 security_info)); | 248 security_info)); |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { | 950 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { |
| 941 delegate_->RequestMove(pos); | 951 delegate_->RequestMove(pos); |
| 942 } | 952 } |
| 943 | 953 |
| 944 void RenderViewHost::OnMsgDidRedirectProvisionalLoad(int32 page_id, | 954 void RenderViewHost::OnMsgDidRedirectProvisionalLoad(int32 page_id, |
| 945 const GURL& source_url, | 955 const GURL& source_url, |
| 946 const GURL& target_url) { | 956 const GURL& target_url) { |
| 947 delegate_->DidRedirectProvisionalLoad(page_id, source_url, target_url); | 957 delegate_->DidRedirectProvisionalLoad(page_id, source_url, target_url); |
| 948 } | 958 } |
| 949 | 959 |
| 950 void RenderViewHost::OnMsgDidStartLoading(int32 page_id) { | 960 void RenderViewHost::OnMsgDidStartLoading() { |
| 951 delegate_->DidStartLoading(this, page_id); | 961 delegate_->DidStartLoading(this); |
| 952 } | 962 } |
| 953 | 963 |
| 954 void RenderViewHost::OnMsgDidStopLoading(int32 page_id) { | 964 void RenderViewHost::OnMsgDidStopLoading() { |
| 955 delegate_->DidStopLoading(this, page_id); | 965 delegate_->DidStopLoading(this); |
| 956 } | 966 } |
| 957 | 967 |
| 958 void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache( | 968 void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache( |
| 959 const GURL& url, | 969 const GURL& url, |
| 960 const std::string& frame_origin, | 970 const std::string& frame_origin, |
| 961 const std::string& main_frame_origin, | 971 const std::string& main_frame_origin, |
| 962 const std::string& security_info) { | 972 const std::string& security_info) { |
| 963 delegate_->DidLoadResourceFromMemoryCache( | 973 delegate_->DidLoadResourceFromMemoryCache( |
| 964 url, frame_origin, main_frame_origin, security_info); | 974 url, frame_origin, main_frame_origin, security_info); |
| 965 } | 975 } |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 int callback_id) { | 1362 int callback_id) { |
| 1353 // TODO(aa): Here is where we can check that this renderer was supposed to be | 1363 // TODO(aa): Here is where we can check that this renderer was supposed to be |
| 1354 // able to call extension APIs. | 1364 // able to call extension APIs. |
| 1355 extension_function_dispatcher_->HandleRequest(name, args, callback_id); | 1365 extension_function_dispatcher_->HandleRequest(name, args, callback_id); |
| 1356 } | 1366 } |
| 1357 | 1367 |
| 1358 void RenderViewHost::SendExtensionResponse(int callback_id, | 1368 void RenderViewHost::SendExtensionResponse(int callback_id, |
| 1359 const std::string& response) { | 1369 const std::string& response) { |
| 1360 Send(new ViewMsg_ExtensionResponse(routing_id(), callback_id, response)); | 1370 Send(new ViewMsg_ExtensionResponse(routing_id(), callback_id, response)); |
| 1361 } | 1371 } |
| OLD | NEW |