| 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/chrome_pages.h" | 5 #include "chrome/browser/ui/chrome_pages.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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void ShowHistory(Browser* browser) { | 151 void ShowHistory(Browser* browser) { |
| 152 content::RecordAction(UserMetricsAction("ShowHistory")); | 152 content::RecordAction(UserMetricsAction("ShowHistory")); |
| 153 NavigateParams params( | 153 NavigateParams params( |
| 154 GetSingletonTabNavigateParams(browser, GURL(kChromeUIHistoryURL))); | 154 GetSingletonTabNavigateParams(browser, GURL(kChromeUIHistoryURL))); |
| 155 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; | 155 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; |
| 156 ShowSingletonTabOverwritingNTP(browser, params); | 156 ShowSingletonTabOverwritingNTP(browser, params); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void ShowDownloads(Browser* browser) { | 159 void ShowDownloads(Browser* browser) { |
| 160 content::RecordAction(UserMetricsAction("ShowDownloads")); | 160 content::RecordAction(UserMetricsAction("ShowDownloads")); |
| 161 if (browser->window()) { | 161 if (browser->window() && browser->window()->IsDownloadShelfVisible()) |
| 162 DownloadShelf* shelf = browser->window()->GetDownloadShelf(); | 162 browser->window()->GetDownloadShelf()->Close(DownloadShelf::USER_ACTION); |
| 163 // The downloads page is always shown in response to a user action. | 163 |
| 164 if (shelf->IsShowing()) | |
| 165 shelf->Close(DownloadShelf::USER_ACTION); | |
| 166 } | |
| 167 ShowSingletonTabOverwritingNTP( | 164 ShowSingletonTabOverwritingNTP( |
| 168 browser, | 165 browser, |
| 169 GetSingletonTabNavigateParams(browser, GURL(kChromeUIDownloadsURL))); | 166 GetSingletonTabNavigateParams(browser, GURL(kChromeUIDownloadsURL))); |
| 170 } | 167 } |
| 171 | 168 |
| 172 void ShowExtensions(Browser* browser, | 169 void ShowExtensions(Browser* browser, |
| 173 const std::string& extension_to_highlight) { | 170 const std::string& extension_to_highlight) { |
| 174 content::RecordAction(UserMetricsAction("ShowExtensions")); | 171 content::RecordAction(UserMetricsAction("ShowExtensions")); |
| 175 NavigateParams params( | 172 NavigateParams params( |
| 176 GetSingletonTabNavigateParams(browser, GURL(kChromeUIExtensionsURL))); | 173 GetSingletonTabNavigateParams(browser, GURL(kChromeUIExtensionsURL))); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 SigninManagerFactory::GetForProfile(original_profile); | 399 SigninManagerFactory::GetForProfile(original_profile); |
| 403 DCHECK(manager->IsSigninAllowed()); | 400 DCHECK(manager->IsSigninAllowed()); |
| 404 if (manager->IsAuthenticated()) | 401 if (manager->IsAuthenticated()) |
| 405 ShowSettings(browser); | 402 ShowSettings(browser); |
| 406 else | 403 else |
| 407 ShowBrowserSignin(browser, access_point); | 404 ShowBrowserSignin(browser, access_point); |
| 408 } | 405 } |
| 409 #endif | 406 #endif |
| 410 | 407 |
| 411 } // namespace chrome | 408 } // namespace chrome |
| OLD | NEW |