| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 params->tabstrip_add_types |= TabStripModel::ADD_ACTIVE; | 241 params->tabstrip_add_types |= TabStripModel::ADD_ACTIVE; |
| 242 break; | 242 break; |
| 243 | 243 |
| 244 default: | 244 default: |
| 245 break; | 245 break; |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 // Obtain the profile used by the code that originated the Navigate() request. | 249 // Obtain the profile used by the code that originated the Navigate() request. |
| 250 Profile* GetSourceProfile(chrome::NavigateParams* params) { | 250 Profile* GetSourceProfile(chrome::NavigateParams* params) { |
| 251 // |source_site_instance| needs to be checked before |source_contents|. This |
| 252 // might matter when chrome.windows.create is used to open multiple URLs, |
| 253 // which would reuse |params| and modify |params->source_contents| across |
| 254 // navigations. |
| 251 if (params->source_site_instance) { | 255 if (params->source_site_instance) { |
| 252 return Profile::FromBrowserContext( | 256 return Profile::FromBrowserContext( |
| 253 params->source_site_instance->GetBrowserContext()); | 257 params->source_site_instance->GetBrowserContext()); |
| 254 } | 258 } |
| 255 | 259 |
| 256 if (params->source_contents) { | 260 if (params->source_contents) { |
| 257 return Profile::FromBrowserContext( | 261 return Profile::FromBrowserContext( |
| 258 params->source_contents->GetBrowserContext()); | 262 params->source_contents->GetBrowserContext()); |
| 259 } | 263 } |
| 260 | 264 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 bool reverse_on_redirect = false; | 674 bool reverse_on_redirect = false; |
| 671 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 675 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
| 672 &rewritten_url, browser_context, &reverse_on_redirect); | 676 &rewritten_url, browser_context, &reverse_on_redirect); |
| 673 | 677 |
| 674 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 678 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
| 675 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 679 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
| 676 rewritten_url.host() == chrome::kChromeUIUberHost); | 680 rewritten_url.host() == chrome::kChromeUIUberHost); |
| 677 } | 681 } |
| 678 | 682 |
| 679 } // namespace chrome | 683 } // namespace chrome |
| OLD | NEW |