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/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/net/predictor_api.h" | |
19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
21 #include "content/browser/browser_message_filter.h" | 20 #include "content/browser/browser_message_filter.h" |
22 #include "content/browser/child_process_security_policy.h" | 21 #include "content/browser/child_process_security_policy.h" |
23 #include "content/browser/content_browser_client.h" | 22 #include "content/browser/content_browser_client.h" |
24 #include "content/browser/cross_site_request_manager.h" | 23 #include "content/browser/cross_site_request_manager.h" |
25 #include "content/browser/host_zoom_map.h" | 24 #include "content/browser/host_zoom_map.h" |
26 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 25 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
27 #include "content/browser/renderer_host/render_process_host.h" | 26 #include "content/browser/renderer_host/render_process_host.h" |
28 #include "content/browser/renderer_host/render_view_host_delegate.h" | 27 #include "content/browser/renderer_host/render_view_host_delegate.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 params.parent_window = GetNativeViewId(); | 163 params.parent_window = GetNativeViewId(); |
165 params.compositing_surface = GetCompositingSurface(); | 164 params.compositing_surface = GetCompositingSurface(); |
166 params.renderer_preferences = | 165 params.renderer_preferences = |
167 delegate_->GetRendererPrefs(process()->profile()); | 166 delegate_->GetRendererPrefs(process()->profile()); |
168 params.web_preferences = delegate_->GetWebkitPrefs(); | 167 params.web_preferences = delegate_->GetWebkitPrefs(); |
169 params.view_id = routing_id(); | 168 params.view_id = routing_id(); |
170 params.session_storage_namespace_id = session_storage_namespace_->id(); | 169 params.session_storage_namespace_id = session_storage_namespace_->id(); |
171 params.frame_name = frame_name; | 170 params.frame_name = frame_name; |
172 Send(new ViewMsg_New(params)); | 171 Send(new ViewMsg_New(params)); |
173 | 172 |
174 // Set the alternate error page, which is profile specific, in the renderer. | |
175 GURL url = delegate_->GetAlternateErrorPageURL(); | |
176 Send(new ViewMsg_SetAltErrorPageURL(routing_id(), url)); | |
177 | |
178 // If it's enabled, tell the renderer to set up the Javascript bindings for | 173 // If it's enabled, tell the renderer to set up the Javascript bindings for |
179 // sending messages back to the browser. | 174 // sending messages back to the browser. |
180 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); | 175 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); |
181 // Let our delegate know that we created a RenderView. | 176 // Let our delegate know that we created a RenderView. |
182 delegate_->RenderViewCreated(this); | 177 delegate_->RenderViewCreated(this); |
183 | 178 |
184 FOR_EACH_OBSERVER( | 179 FOR_EACH_OBSERVER( |
185 RenderViewHostObserver, observers_, RenderViewHostInitialized()); | 180 RenderViewHostObserver, observers_, RenderViewHostInitialized()); |
186 | 181 |
187 return true; | 182 return true; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // user naivgates even if the renderer is delayed. There is also an issue | 221 // user naivgates even if the renderer is delayed. There is also an issue |
227 // with the throbber starting because the WebUI (which controls whether the | 222 // with the throbber starting because the WebUI (which controls whether the |
228 // favicon is displayed) happens synchronously. If the start loading | 223 // favicon is displayed) happens synchronously. If the start loading |
229 // messages was asynchronous, then the default favicon would flash in. | 224 // messages was asynchronous, then the default favicon would flash in. |
230 // | 225 // |
231 // WebKit doesn't send throb notifications for JavaScript URLs, so we | 226 // WebKit doesn't send throb notifications for JavaScript URLs, so we |
232 // don't want to either. | 227 // don't want to either. |
233 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) | 228 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) |
234 delegate_->DidStartLoading(); | 229 delegate_->DidStartLoading(); |
235 } | 230 } |
236 const GURL& url = params.url; | 231 |
237 if (!delegate_->IsExternalTabContainer() && | 232 FOR_EACH_OBSERVER( |
238 (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme))) | 233 RenderViewHostObserver, observers_, Navigate(params)); |
239 chrome_browser_net::PreconnectUrlAndSubresources(url); | |
240 } | 234 } |
241 | 235 |
242 void RenderViewHost::NavigateToURL(const GURL& url) { | 236 void RenderViewHost::NavigateToURL(const GURL& url) { |
243 ViewMsg_Navigate_Params params; | 237 ViewMsg_Navigate_Params params; |
244 params.page_id = -1; | 238 params.page_id = -1; |
245 params.pending_history_list_offset = -1; | 239 params.pending_history_list_offset = -1; |
246 params.current_history_list_offset = -1; | 240 params.current_history_list_offset = -1; |
247 params.current_history_list_length = 0; | 241 params.current_history_list_length = 0; |
248 params.url = url; | 242 params.url = url; |
249 params.transition = PageTransition::LINK; | 243 params.transition = PageTransition::LINK; |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 if (view) { | 1279 if (view) { |
1286 view->ShowPopupMenu(params.bounds, | 1280 view->ShowPopupMenu(params.bounds, |
1287 params.item_height, | 1281 params.item_height, |
1288 params.item_font_size, | 1282 params.item_font_size, |
1289 params.selected_item, | 1283 params.selected_item, |
1290 params.popup_items, | 1284 params.popup_items, |
1291 params.right_aligned); | 1285 params.right_aligned); |
1292 } | 1286 } |
1293 } | 1287 } |
1294 #endif | 1288 #endif |
OLD | NEW |