| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_iterator.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
| 21 #include "chrome/browser/ui/settings_window_manager_observer.h" | 21 #include "chrome/browser/ui/settings_window_manager_observer.h" |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 24 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
| 25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/test/test_utils.h" | 26 #include "content/public/test/test_utils.h" |
| 27 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 28 | 28 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void ShowSettingsForProfile(Profile* profile) { | 96 void ShowSettingsForProfile(Profile* profile) { |
| 97 settings_manager_->ShowChromePageForProfile( | 97 settings_manager_->ShowChromePageForProfile( |
| 98 profile, GURL(chrome::kChromeUISettingsURL)); | 98 profile, GURL(chrome::kChromeUISettingsURL)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void CloseNonDefaultBrowsers() { | 101 void CloseNonDefaultBrowsers() { |
| 102 std::list<Browser*> browsers_to_close; | 102 std::list<Browser*> browsers_to_close; |
| 103 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 103 for (auto& b : *BrowserList::GetInstance()) { |
| 104 if (*it != browser()) | 104 if (b != browser()) |
| 105 browsers_to_close.push_back(*it); | 105 browsers_to_close.push_back(b); |
| 106 } | 106 } |
| 107 for (std::list<Browser*>::iterator iter = browsers_to_close.begin(); | 107 for (std::list<Browser*>::iterator iter = browsers_to_close.begin(); |
| 108 iter != browsers_to_close.end(); ++iter) { | 108 iter != browsers_to_close.end(); ++iter) { |
| 109 CloseBrowserSynchronously(*iter); | 109 CloseBrowserSynchronously(*iter); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 protected: | 113 protected: |
| 114 chrome::SettingsWindowManager* settings_manager_; | 114 chrome::SettingsWindowManager* settings_manager_; |
| 115 SettingsWindowTestObserver observer_; | 115 SettingsWindowTestObserver observer_; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 201 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 202 | 202 |
| 203 // Downloads should open in an existing browser window. | 203 // Downloads should open in an existing browser window. |
| 204 chrome::ShowDownloads(browser()); | 204 chrome::ShowDownloads(browser()); |
| 205 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 205 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 206 | 206 |
| 207 // About should open a new browser window. | 207 // About should open a new browser window. |
| 208 chrome::ShowAboutChrome(browser()); | 208 chrome::ShowAboutChrome(browser()); |
| 209 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 209 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 210 } | 210 } |
| OLD | NEW |