| 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/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // those types of Browser. | 60 // those types of Browser. |
| 61 bool WindowCanOpenTabs(Browser* browser) { | 61 bool WindowCanOpenTabs(Browser* browser) { |
| 62 return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) || | 62 return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) || |
| 63 browser->tab_strip_model()->empty(); | 63 browser->tab_strip_model()->empty(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Finds an existing Browser compatible with |profile|, making a new one if no | 66 // Finds an existing Browser compatible with |profile|, making a new one if no |
| 67 // such Browser is located. | 67 // such Browser is located. |
| 68 Browser* GetOrCreateBrowser(Profile* profile, | 68 Browser* GetOrCreateBrowser(Profile* profile, |
| 69 chrome::HostDesktopType host_desktop_type) { | 69 chrome::HostDesktopType host_desktop_type) { |
| 70 Browser* browser = | 70 Browser* browser = chrome::FindTabbedBrowser(profile, false, |
| 71 browser::FindTabbedBrowser(profile, false, host_desktop_type); | 71 host_desktop_type); |
| 72 return browser ? browser : new Browser( | 72 return browser ? browser : new Browser( |
| 73 Browser::CreateParams(profile, host_desktop_type)); | 73 Browser::CreateParams(profile, host_desktop_type)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Change some of the navigation parameters based on the particular URL. | 76 // Change some of the navigation parameters based on the particular URL. |
| 77 // Currently this applies to some chrome:// pages which we always want to open | 77 // Currently this applies to some chrome:// pages which we always want to open |
| 78 // in a non-incognito window. Note that even though a ChromeOS guest session is | 78 // in a non-incognito window. Note that even though a ChromeOS guest session is |
| 79 // technically an incognito window, these URLs are allowed. | 79 // technically an incognito window, these URLs are allowed. |
| 80 // Returns true on success. Otherwise, if changing params leads the browser into | 80 // Returns true on success. Otherwise, if changing params leads the browser into |
| 81 // an erroneous state, returns false. | 81 // an erroneous state, returns false. |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 bool reverse_on_redirect = false; | 616 bool reverse_on_redirect = false; |
| 617 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 617 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
| 618 &rewritten_url, browser_context, &reverse_on_redirect); | 618 &rewritten_url, browser_context, &reverse_on_redirect); |
| 619 | 619 |
| 620 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 620 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
| 621 return !(rewritten_url.scheme() == chrome::kChromeUIScheme && | 621 return !(rewritten_url.scheme() == chrome::kChromeUIScheme && |
| 622 rewritten_url.host() == chrome::kChromeUIUberHost); | 622 rewritten_url.host() == chrome::kChromeUIUberHost); |
| 623 } | 623 } |
| 624 | 624 |
| 625 } // namespace chrome | 625 } // namespace chrome |
| OLD | NEW |