| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/browser_url_handler.h" | 9 #include "chrome/browser/browser_url_handler.h" |
| 10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 params->target_contents = tab; | 98 params->target_contents = tab; |
| 99 return i; | 99 return i; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 return -1; | 103 return -1; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Change some of the navigation parameters based on the particular URL. | 106 // Change some of the navigation parameters based on the particular URL. |
| 107 // Currently this applies to chrome://settings and the bookmark manager, | 107 // Currently this applies to chrome://settings and the bookmark manager, |
| 108 // which we always want to open in a normal (not incognito) window. | 108 // which we always want to open in a normal (not incognito) window. Guest |
| 109 // session is an exception. |
| 109 void AdjustNavigateParamsForURL(browser::NavigateParams* params) { | 110 void AdjustNavigateParamsForURL(browser::NavigateParams* params) { |
| 110 if (!params->target_contents && | 111 if (!params->target_contents && |
| 111 params->url.scheme() == chrome::kChromeUIScheme && | 112 params->url.scheme() == chrome::kChromeUIScheme && |
| 112 (params->url.host() == chrome::kChromeUISettingsHost || | 113 (params->url.host() == chrome::kChromeUISettingsHost || |
| 113 params->url.host() == chrome::kChromeUIBookmarksHost)) { | 114 params->url.host() == chrome::kChromeUIBookmarksHost)) { |
| 114 Profile* profile = | 115 Profile* profile = |
| 115 params->browser ? params->browser->profile() : params->profile; | 116 params->browser ? params->browser->profile() : params->profile; |
| 116 | 117 |
| 117 if (profile->IsOffTheRecord()) { | 118 if (profile->IsOffTheRecord() && !Profile::IsGuestSession()) { |
| 118 profile = profile->GetOriginalProfile(); | 119 profile = profile->GetOriginalProfile(); |
| 119 | 120 |
| 120 params->disposition = SINGLETON_TAB; | 121 params->disposition = SINGLETON_TAB; |
| 121 params->profile = profile; | 122 params->profile = profile; |
| 122 params->browser = Browser::GetOrCreateTabbedBrowser(profile); | 123 params->browser = Browser::GetOrCreateTabbedBrowser(profile); |
| 123 params->show_window = true; | 124 params->show_window = true; |
| 124 } | 125 } |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 | 128 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 params->url, params->referrer, params->transition); | 468 params->url, params->referrer, params->transition); |
| 468 } | 469 } |
| 469 | 470 |
| 470 // If the singleton tab isn't already selected, select it. | 471 // If the singleton tab isn't already selected, select it. |
| 471 if (params->source_contents != params->target_contents) | 472 if (params->source_contents != params->target_contents) |
| 472 params->browser->SelectTabContentsAt(singleton_index, user_initiated); | 473 params->browser->SelectTabContentsAt(singleton_index, user_initiated); |
| 473 } | 474 } |
| 474 } | 475 } |
| 475 | 476 |
| 476 } // namespace browser | 477 } // namespace browser |
| OLD | NEW |