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

Side by Side Diff: chrome/browser/renderer_host/render_view_host_manager.cc

Issue 126137: Part 1 of merging Extensions and DOMUI (Closed)
Patch Set: add test and rebase Created 11 years, 5 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
OLDNEW
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_manager.h" 5 #include "chrome/browser/renderer_host/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/dom_ui/dom_ui.h" 9 #include "chrome/browser/dom_ui/dom_ui.h"
10 #include "chrome/browser/dom_ui/dom_ui_factory.h" 10 #include "chrome/browser/dom_ui/dom_ui_factory.h"
11 #include "chrome/browser/renderer_host/render_view_host.h" 11 #include "chrome/browser/renderer_host/render_view_host.h"
12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 12 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
13 #include "chrome/browser/renderer_host/render_view_host_factory.h" 13 #include "chrome/browser/renderer_host/render_view_host_factory.h"
14 #include "chrome/browser/renderer_host/render_widget_host_view.h" 14 #include "chrome/browser/renderer_host/render_widget_host_view.h"
15 #include "chrome/browser/renderer_host/site_instance.h" 15 #include "chrome/browser/renderer_host/site_instance.h"
16 #include "chrome/browser/tab_contents/navigation_controller.h" 16 #include "chrome/browser/tab_contents/navigation_controller.h"
17 #include "chrome/browser/tab_contents/navigation_entry.h" 17 #include "chrome/browser/tab_contents/navigation_entry.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/notification_service.h" 19 #include "chrome/common/notification_service.h"
20 #include "chrome/common/notification_type.h" 20 #include "chrome/common/notification_type.h"
21 #include "chrome/common/render_messages.h" 21 #include "chrome/common/render_messages.h"
22 #include "chrome/common/url_constants.h"
22 23
23 namespace base { 24 namespace base {
24 class WaitableEvent; 25 class WaitableEvent;
25 } 26 }
26 27
27 RenderViewHostManager::RenderViewHostManager( 28 RenderViewHostManager::RenderViewHostManager(
28 RenderViewHostDelegate* render_view_delegate, 29 RenderViewHostDelegate* render_view_delegate,
29 Delegate* delegate) 30 Delegate* delegate)
30 : delegate_(delegate), 31 : delegate_(delegate),
31 cross_navigation_pending_(false), 32 cross_navigation_pending_(false),
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // it as a new navigation). So require a view switch. 288 // it as a new navigation). So require a view switch.
288 if (cur_entry->IsViewSourceMode() != new_entry->IsViewSourceMode()) 289 if (cur_entry->IsViewSourceMode() != new_entry->IsViewSourceMode())
289 return true; 290 return true;
290 291
291 // For security, we should transition between processes when one is a DOM UI 292 // For security, we should transition between processes when one is a DOM UI
292 // page and one isn't. 293 // page and one isn't.
293 if (DOMUIFactory::HasDOMUIScheme(cur_entry->url()) != 294 if (DOMUIFactory::HasDOMUIScheme(cur_entry->url()) !=
294 DOMUIFactory::HasDOMUIScheme(new_entry->url())) 295 DOMUIFactory::HasDOMUIScheme(new_entry->url()))
295 return true; 296 return true;
296 297
298 // Also, we must switch if one is an extension and the other is not the exact
299 // same extension.
300 if (cur_entry->url().SchemeIs(chrome::kExtensionScheme) ||
301 new_entry->url().SchemeIs(chrome::kExtensionScheme))
302 if (cur_entry->url().GetOrigin() != new_entry->url().GetOrigin())
303 return true;
304
305
297 return false; 306 return false;
298 } 307 }
299 308
300 SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( 309 SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
301 const NavigationEntry& entry, 310 const NavigationEntry& entry,
302 SiteInstance* curr_instance) { 311 SiteInstance* curr_instance) {
303 // NOTE: This is only called when ShouldTransitionCrossSite is true. 312 // NOTE: This is only called when ShouldTransitionCrossSite is true.
304 313
305 // If the entry has an instance already, we should use it. 314 // If the entry has an instance already, we should use it.
306 if (entry.site_instance()) 315 if (entry.site_instance())
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 592
584 pending_dom_ui_.reset(); 593 pending_dom_ui_.reset();
585 } 594 }
586 595
587 void RenderViewHostManager::CrossSiteNavigationCanceled() { 596 void RenderViewHostManager::CrossSiteNavigationCanceled() {
588 DCHECK(cross_navigation_pending_); 597 DCHECK(cross_navigation_pending_);
589 cross_navigation_pending_ = false; 598 cross_navigation_pending_ = false;
590 if (pending_render_view_host_) 599 if (pending_render_view_host_)
591 CancelPending(); 600 CancelPending();
592 } 601 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host_delegate.h ('k') | chrome/browser/tab_contents/interstitial_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698