| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/settings_window_manager.h" | 5 #include "chrome/browser/ui/settings_window_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 observers_.AddObserver(observer); | 28 observers_.AddObserver(observer); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void SettingsWindowManager::RemoveObserver( | 31 void SettingsWindowManager::RemoveObserver( |
| 32 SettingsWindowManagerObserver* observer) { | 32 SettingsWindowManagerObserver* observer) { |
| 33 observers_.RemoveObserver(observer); | 33 observers_.RemoveObserver(observer); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void SettingsWindowManager::ShowChromePageForProfile(Profile* profile, | 36 void SettingsWindowManager::ShowChromePageForProfile(Profile* profile, |
| 37 const GURL& gurl) { | 37 const GURL& gurl) { |
| 38 // Use the original (non off-the-record) profile for settings. | 38 // Use the original (non off-the-record) profile for settings unless |
| 39 profile = profile->GetOriginalProfile(); | 39 // this is a guest session. |
| 40 if (!profile->IsGuestSession() && profile->IsOffTheRecord()) |
| 41 profile = profile->GetOriginalProfile(); |
| 42 |
| 40 // Look for an existing browser window. | 43 // Look for an existing browser window. |
| 41 Browser* browser = FindBrowserForProfile(profile); | 44 Browser* browser = FindBrowserForProfile(profile); |
| 42 if (browser) { | 45 if (browser) { |
| 43 DCHECK(browser->profile() == profile); | 46 DCHECK(browser->profile() == profile); |
| 44 const content::WebContents* web_contents = | 47 const content::WebContents* web_contents = |
| 45 browser->tab_strip_model()->GetWebContentsAt(0); | 48 browser->tab_strip_model()->GetWebContentsAt(0); |
| 46 if (web_contents && web_contents->GetURL() == gurl) { | 49 if (web_contents && web_contents->GetURL() == gurl) { |
| 47 browser->window()->Show(); | 50 browser->window()->Show(); |
| 48 return; | 51 return; |
| 49 } | 52 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 iter->second == browser->session_id().id()); | 87 iter->second == browser->session_id().id()); |
| 85 } | 88 } |
| 86 | 89 |
| 87 SettingsWindowManager::SettingsWindowManager() { | 90 SettingsWindowManager::SettingsWindowManager() { |
| 88 } | 91 } |
| 89 | 92 |
| 90 SettingsWindowManager::~SettingsWindowManager() { | 93 SettingsWindowManager::~SettingsWindowManager() { |
| 91 } | 94 } |
| 92 | 95 |
| 93 } // namespace chrome | 96 } // namespace chrome |
| OLD | NEW |