| 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" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/download/download_shelf.h" | 14 #include "chrome/browser/download/download_shelf.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 19 #include "chrome/browser/ui/browser_navigator_params.h" | 19 #include "chrome/browser/ui/browser_navigator_params.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
| 21 #include "chrome/browser/ui/extensions/app_launch_params.h" | 21 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 22 #include "chrome/browser/ui/extensions/application_launch.h" | 22 #include "chrome/browser/ui/extensions/application_launch.h" |
| 23 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 23 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 24 #include "chrome/browser/ui/settings_window_manager.h" | 24 #include "chrome/browser/ui/settings_window_manager.h" |
| 25 #include "chrome/browser/ui/singleton_tabs.h" | 25 #include "chrome/browser/ui/singleton_tabs.h" |
| 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 27 #include "chrome/browser/ui/webui/options/content_settings_handler.h" | 27 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 28 #include "chrome/browser/ui/webui/site_settings_helper.h" |
| 28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 30 #include "components/signin/core/browser/signin_header_helper.h" | 31 #include "components/signin/core/browser/signin_header_helper.h" |
| 31 #include "components/signin/core/common/profile_management_switches.h" | 32 #include "components/signin/core/common/profile_management_switches.h" |
| 32 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
| 33 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 34 #include "extensions/common/constants.h" | 35 #include "extensions/common/constants.h" |
| 35 #include "google_apis/gaia/gaia_urls.h" | 36 #include "google_apis/gaia/gaia_urls.h" |
| 36 #include "net/base/url_util.h" | 37 #include "net/base/url_util.h" |
| 37 #include "ui/base/window_open_disposition.h" | 38 #include "ui/base/window_open_disposition.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (!browser) { | 123 if (!browser) { |
| 123 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); | 124 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); |
| 124 browser = displayer->browser(); | 125 browser = displayer->browser(); |
| 125 } | 126 } |
| 126 ShowSingletonTab(browser, url); | 127 ShowSingletonTab(browser, url); |
| 127 #endif | 128 #endif |
| 128 } | 129 } |
| 129 | 130 |
| 130 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { | 131 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { |
| 131 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + | 132 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + |
| 132 options::ContentSettingsHandler::ContentSettingsTypeToGroupName(type); | 133 site_settings::ContentSettingsTypeToGroupName(type); |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace | 136 } // namespace |
| 136 | 137 |
| 137 void ShowBookmarkManager(Browser* browser) { | 138 void ShowBookmarkManager(Browser* browser) { |
| 138 content::RecordAction(UserMetricsAction("ShowBookmarkManager")); | 139 content::RecordAction(UserMetricsAction("ShowBookmarkManager")); |
| 139 content::RecordAction(UserMetricsAction("ShowBookmarks")); | 140 content::RecordAction(UserMetricsAction("ShowBookmarks")); |
| 140 ShowSingletonTabOverwritingNTP( | 141 ShowSingletonTabOverwritingNTP( |
| 141 browser, | 142 browser, |
| 142 GetSingletonTabNavigateParams(browser, GURL(kChromeUIBookmarksURL))); | 143 GetSingletonTabNavigateParams(browser, GURL(kChromeUIBookmarksURL))); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 DCHECK(switches::SettingsWindowEnabled()); | 299 DCHECK(switches::SettingsWindowEnabled()); |
| 299 ShowSettingsSubPageForProfile( | 300 ShowSettingsSubPageForProfile( |
| 300 profile, GenerateContentSettingsExceptionsSubPage(content_settings_type)); | 301 profile, GenerateContentSettingsExceptionsSubPage(content_settings_type)); |
| 301 } | 302 } |
| 302 | 303 |
| 303 void ShowContentSettings(Browser* browser, | 304 void ShowContentSettings(Browser* browser, |
| 304 ContentSettingsType content_settings_type) { | 305 ContentSettingsType content_settings_type) { |
| 305 ShowSettingsSubPage( | 306 ShowSettingsSubPage( |
| 306 browser, | 307 browser, |
| 307 kContentSettingsSubPage + std::string(kHashMark) + | 308 kContentSettingsSubPage + std::string(kHashMark) + |
| 308 options::ContentSettingsHandler::ContentSettingsTypeToGroupName( | 309 site_settings::ContentSettingsTypeToGroupName(content_settings_type)); |
| 309 content_settings_type)); | |
| 310 } | 310 } |
| 311 | 311 |
| 312 void ShowClearBrowsingDataDialog(Browser* browser) { | 312 void ShowClearBrowsingDataDialog(Browser* browser) { |
| 313 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShowDlg")); | 313 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShowDlg")); |
| 314 ShowSettingsSubPage(browser, kClearBrowserDataSubPage); | 314 ShowSettingsSubPage(browser, kClearBrowserDataSubPage); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void ShowPasswordManager(Browser* browser) { | 317 void ShowPasswordManager(Browser* browser) { |
| 318 content::RecordAction(UserMetricsAction("Options_ShowPasswordManager")); | 318 content::RecordAction(UserMetricsAction("Options_ShowPasswordManager")); |
| 319 ShowSettingsSubPage(browser, kPasswordManagerSubPage); | 319 ShowSettingsSubPage(browser, kPasswordManagerSubPage); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 SigninManagerFactory::GetForProfile(original_profile); | 393 SigninManagerFactory::GetForProfile(original_profile); |
| 394 DCHECK(manager->IsSigninAllowed()); | 394 DCHECK(manager->IsSigninAllowed()); |
| 395 if (manager->IsAuthenticated()) | 395 if (manager->IsAuthenticated()) |
| 396 ShowSettings(browser); | 396 ShowSettings(browser); |
| 397 else | 397 else |
| 398 ShowBrowserSignin(browser, access_point); | 398 ShowBrowserSignin(browser, access_point); |
| 399 } | 399 } |
| 400 #endif | 400 #endif |
| 401 | 401 |
| 402 } // namespace chrome | 402 } // namespace chrome |
| OLD | NEW |