OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // those types of Browser. | 77 // those types of Browser. |
78 bool WindowCanOpenTabs(Browser* browser) { | 78 bool WindowCanOpenTabs(Browser* browser) { |
79 return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) || | 79 return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) || |
80 browser->tab_strip_model()->empty(); | 80 browser->tab_strip_model()->empty(); |
81 } | 81 } |
82 | 82 |
83 // Finds an existing Browser compatible with |profile|, making a new one if no | 83 // Finds an existing Browser compatible with |profile|, making a new one if no |
84 // such Browser is located. | 84 // such Browser is located. |
85 Browser* GetOrCreateBrowser(Profile* profile, | 85 Browser* GetOrCreateBrowser(Profile* profile, |
86 chrome::HostDesktopType host_desktop_type) { | 86 chrome::HostDesktopType host_desktop_type) { |
87 Browser* browser = chrome::FindTabbedBrowser(profile, false, | 87 Browser* browser = chrome::FindTabbedBrowser(profile, false); |
88 host_desktop_type); | |
89 return browser ? browser : new Browser( | 88 return browser ? browser : new Browser( |
90 Browser::CreateParams(profile, host_desktop_type)); | 89 Browser::CreateParams(profile, host_desktop_type)); |
91 } | 90 } |
92 | 91 |
93 // Change some of the navigation parameters based on the particular URL. | 92 // Change some of the navigation parameters based on the particular URL. |
94 // Currently this applies to some chrome:// pages which we always want to open | 93 // Currently this applies to some chrome:// pages which we always want to open |
95 // in a non-incognito window. Note that even though a ChromeOS guest session is | 94 // in a non-incognito window. Note that even though a ChromeOS guest session is |
96 // technically an incognito window, these URLs are allowed. | 95 // technically an incognito window, these URLs are allowed. |
97 // Returns true on success. Otherwise, if changing params leads the browser into | 96 // Returns true on success. Otherwise, if changing params leads the browser into |
98 // an erroneous state, returns false. | 97 // an erroneous state, returns false. |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 bool reverse_on_redirect = false; | 654 bool reverse_on_redirect = false; |
656 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 655 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
657 &rewritten_url, browser_context, &reverse_on_redirect); | 656 &rewritten_url, browser_context, &reverse_on_redirect); |
658 | 657 |
659 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 658 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
660 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 659 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
661 rewritten_url.host() == chrome::kChromeUIUberHost); | 660 rewritten_url.host() == chrome::kChromeUIUberHost); |
662 } | 661 } |
663 | 662 |
664 } // namespace chrome | 663 } // namespace chrome |
OLD | NEW |