OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/render_view_host_manager.h" | 5 #include "chrome/browser/render_view_host_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/render_widget_host_view.h" | 9 #include "chrome/browser/render_widget_host_view.h" |
10 #include "chrome/browser/render_view_host.h" | 10 #include "chrome/browser/render_view_host.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 IPC::Message* reply_msg, | 225 IPC::Message* reply_msg, |
226 bool success, | 226 bool success, |
227 const std::wstring& prompt) { | 227 const std::wstring& prompt) { |
228 render_view_host_->JavaScriptMessageBoxClosed(reply_msg, success, prompt); | 228 render_view_host_->JavaScriptMessageBoxClosed(reply_msg, success, prompt); |
229 } | 229 } |
230 | 230 |
231 | 231 |
232 bool RenderViewHostManager::ShouldTransitionCrossSite() { | 232 bool RenderViewHostManager::ShouldTransitionCrossSite() { |
233 // True if we are using process-per-site-instance (default) or | 233 // True if we are using process-per-site-instance (default) or |
234 // process-per-site (kProcessPerSite). | 234 // process-per-site (kProcessPerSite). |
235 return !CommandLine().HasSwitch(switches::kProcessPerTab); | 235 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab); |
236 } | 236 } |
237 | 237 |
238 SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( | 238 SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( |
239 const NavigationEntry& entry, | 239 const NavigationEntry& entry, |
240 SiteInstance* curr_instance) { | 240 SiteInstance* curr_instance) { |
241 // NOTE: This is only called when ShouldTransitionCrossSite is true. | 241 // NOTE: This is only called when ShouldTransitionCrossSite is true. |
242 | 242 |
243 // If the entry has an instance already, we should use it. | 243 // If the entry has an instance already, we should use it. |
244 if (entry.site_instance()) | 244 if (entry.site_instance()) |
245 return entry.site_instance(); | 245 return entry.site_instance(); |
246 | 246 |
247 // (UGLY) HEURISTIC, process-per-site only: | 247 // (UGLY) HEURISTIC, process-per-site only: |
248 // | 248 // |
249 // If this navigation is generated, then it probably corresponds to a search | 249 // If this navigation is generated, then it probably corresponds to a search |
250 // query. Given that search results typically lead to users navigating to | 250 // query. Given that search results typically lead to users navigating to |
251 // other sites, we don't really want to use the search engine hostname to | 251 // other sites, we don't really want to use the search engine hostname to |
252 // determine the site instance for this navigation. | 252 // determine the site instance for this navigation. |
253 // | 253 // |
254 // NOTE: This can be removed once we have a way to transition between | 254 // NOTE: This can be removed once we have a way to transition between |
255 // RenderViews in response to a link click. | 255 // RenderViews in response to a link click. |
256 // | 256 // |
257 if (CommandLine().HasSwitch(switches::kProcessPerSite) && | 257 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && |
258 entry.transition_type() == PageTransition::GENERATED) | 258 entry.transition_type() == PageTransition::GENERATED) |
259 return curr_instance; | 259 return curr_instance; |
260 | 260 |
261 const GURL& dest_url = entry.url(); | 261 const GURL& dest_url = entry.url(); |
262 | 262 |
263 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it | 263 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it |
264 // for this entry. We won't commit the SiteInstance to this site until the | 264 // for this entry. We won't commit the SiteInstance to this site until the |
265 // navigation commits (in DidNavigate), unless the navigation entry was | 265 // navigation commits (in DidNavigate), unless the navigation entry was |
266 // restored. As session restore loads all the pages immediately we need to set | 266 // restored. As session restore loads all the pages immediately we need to set |
267 // the site first, otherwise after a restore none of the pages would share | 267 // the site first, otherwise after a restore none of the pages would share |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 pending_render_view_host_ = NULL; | 494 pending_render_view_host_ = NULL; |
495 } | 495 } |
496 | 496 |
497 void RenderViewHostManager::CrossSiteNavigationCanceled() { | 497 void RenderViewHostManager::CrossSiteNavigationCanceled() { |
498 DCHECK(cross_navigation_pending_); | 498 DCHECK(cross_navigation_pending_); |
499 cross_navigation_pending_ = false; | 499 cross_navigation_pending_ = false; |
500 if (pending_render_view_host_) | 500 if (pending_render_view_host_) |
501 CancelPendingRenderView(); | 501 CancelPendingRenderView(); |
502 } | 502 } |
503 | 503 |
OLD | NEW |