| 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_navigator.h" | 9 #include "chrome/browser/ui/browser_navigator.h" |
| 10 #include "chrome/browser/ui/browser_navigator_params.h" | 10 #include "chrome/browser/ui/browser_navigator_params.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 NavigateParams params(profile, gurl, ui::PAGE_TRANSITION_AUTO_BOOKMARK); | 62 NavigateParams params(profile, gurl, ui::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 63 params.disposition = WindowOpenDisposition::NEW_POPUP; | 63 params.disposition = WindowOpenDisposition::NEW_POPUP; |
| 64 params.trusted_source = true; | 64 params.trusted_source = true; |
| 65 params.window_action = NavigateParams::SHOW_WINDOW; | 65 params.window_action = NavigateParams::SHOW_WINDOW; |
| 66 params.user_gesture = true; | 66 params.user_gesture = true; |
| 67 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; | 67 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; |
| 68 chrome::Navigate(¶ms); | 68 chrome::Navigate(¶ms); |
| 69 settings_session_map_[profile] = params.browser->session_id().id(); | 69 settings_session_map_[profile] = params.browser->session_id().id(); |
| 70 DCHECK(params.browser->is_trusted_source()); | 70 DCHECK(params.browser->is_trusted_source()); |
| 71 | 71 |
| 72 FOR_EACH_OBSERVER(SettingsWindowManagerObserver, | 72 for (SettingsWindowManagerObserver& observer : observers_) |
| 73 observers_, OnNewSettingsWindow(params.browser)); | 73 observer.OnNewSettingsWindow(params.browser); |
| 74 } | 74 } |
| 75 | 75 |
| 76 Browser* SettingsWindowManager::FindBrowserForProfile(Profile* profile) { | 76 Browser* SettingsWindowManager::FindBrowserForProfile(Profile* profile) { |
| 77 ProfileSessionMap::iterator iter = settings_session_map_.find(profile); | 77 ProfileSessionMap::iterator iter = settings_session_map_.find(profile); |
| 78 if (iter != settings_session_map_.end()) | 78 if (iter != settings_session_map_.end()) |
| 79 return chrome::FindBrowserWithID(iter->second); | 79 return chrome::FindBrowserWithID(iter->second); |
| 80 return NULL; | 80 return NULL; |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool SettingsWindowManager::IsSettingsBrowser(Browser* browser) const { | 83 bool SettingsWindowManager::IsSettingsBrowser(Browser* browser) const { |
| 84 ProfileSessionMap::const_iterator iter = | 84 ProfileSessionMap::const_iterator iter = |
| 85 settings_session_map_.find(browser->profile()); | 85 settings_session_map_.find(browser->profile()); |
| 86 return (iter != settings_session_map_.end() && | 86 return (iter != settings_session_map_.end() && |
| 87 iter->second == browser->session_id().id()); | 87 iter->second == browser->session_id().id()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 SettingsWindowManager::SettingsWindowManager() { | 90 SettingsWindowManager::SettingsWindowManager() { |
| 91 } | 91 } |
| 92 | 92 |
| 93 SettingsWindowManager::~SettingsWindowManager() { | 93 SettingsWindowManager::~SettingsWindowManager() { |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace chrome | 96 } // namespace chrome |
| OLD | NEW |