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

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 6708114: Revert 79691 - Move WebUIFactory to chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/ui/browser_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
11 #include "chrome/browser/browser_url_handler.h" 11 #include "chrome/browser/browser_url_handler.h"
12 #include "chrome/browser/browser_window.h" 12 #include "chrome/browser/browser_window.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/tabs/tab_strip_model.h" 14 #include "chrome/browser/tabs/tab_strip_model.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/status_bubble.h" 16 #include "chrome/browser/ui/status_bubble.h"
17 #include "chrome/browser/ui/omnibox/location_bar.h" 17 #include "chrome/browser/ui/omnibox/location_bar.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
19 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
20 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
22 #include "content/browser/site_instance.h" 21 #include "content/browser/site_instance.h"
23 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
24 23
25 namespace { 24 namespace {
26 25
27 // Returns an appropriate SiteInstance for WebUI URLs, or the SiteInstance for 26 // Returns an appropriate SiteInstance for WebUI URLs, or the SiteInstance for
28 // |source_contents| if it represents the same website as |url|. Returns NULL 27 // |source_contents| if it represents the same website as |url|. Returns NULL
29 // otherwise. 28 // otherwise.
30 SiteInstance* GetSiteInstance(TabContents* source_contents, Profile* profile, 29 SiteInstance* GetSiteInstance(TabContents* source_contents, Profile* profile,
31 const GURL& url) { 30 const GURL& url) {
32 // If url is a WebUI or extension, we need to be sure to use the right type 31 // If url is a WebUI or extension, we need to be sure to use the right type
33 // of renderer process up front. Otherwise, we create a normal SiteInstance 32 // of renderer process up front. Otherwise, we create a normal SiteInstance
34 // as part of creating the tab. 33 // as part of creating the tab.
35 if (ChromeWebUIFactory::GetInstance()->UseWebUIForURL(profile, url)) 34 if (WebUIFactory::UseWebUIForURL(profile, url))
36 return SiteInstance::CreateSiteInstanceForURL(profile, url); 35 return SiteInstance::CreateSiteInstanceForURL(profile, url);
37 36
38 if (!source_contents) 37 if (!source_contents)
39 return NULL; 38 return NULL;
40 39
41 // Don't use this logic when "--process-per-tab" is specified. 40 // Don't use this logic when "--process-per-tab" is specified.
42 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab) && 41 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab) &&
43 SiteInstance::IsSameWebSite(source_contents->profile(), 42 SiteInstance::IsSameWebSite(source_contents->profile(),
44 source_contents->GetURL(), 43 source_contents->GetURL(),
45 url)) { 44 url)) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 params->url, params->referrer, params->transition); 485 params->url, params->referrer, params->transition);
487 } 486 }
488 487
489 // If the singleton tab isn't already selected, select it. 488 // If the singleton tab isn't already selected, select it.
490 if (params->source_contents != params->target_contents) 489 if (params->source_contents != params->target_contents)
491 params->browser->SelectTabContentsAt(singleton_index, user_initiated); 490 params->browser->SelectTabContentsAt(singleton_index, user_initiated);
492 } 491 }
493 } 492 }
494 493
495 } // namespace browser 494 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_delegate_helper.cc ('k') | chrome/browser/ui/webui/chrome_web_ui_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698