| 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/feature_list.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" |
| 11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 13 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 14 #include "chrome/browser/download/download_shelf.h" | 16 #include "chrome/browser/download/download_shelf.h" |
| 15 #include "chrome/browser/extensions/launch_util.h" | 17 #include "chrome/browser/extensions/launch_util.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/browser_navigator_params.h" | 22 #include "chrome/browser/ui/browser_navigator_params.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 22 #include "chrome/browser/ui/extensions/app_launch_params.h" | 24 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 23 #include "chrome/browser/ui/extensions/application_launch.h" | 25 #include "chrome/browser/ui/extensions/application_launch.h" |
| 24 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 26 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 25 #include "chrome/browser/ui/settings_window_manager.h" | 27 #include "chrome/browser/ui/settings_window_manager.h" |
| 26 #include "chrome/browser/ui/singleton_tabs.h" | 28 #include "chrome/browser/ui/singleton_tabs.h" |
| 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 28 #include "chrome/browser/ui/webui/options/content_settings_handler.h" | 30 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 29 #include "chrome/browser/ui/webui/site_settings_helper.h" | 31 #include "chrome/browser/ui/webui/site_settings_helper.h" |
| 32 #include "chrome/common/chrome_features.h" |
| 30 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 32 #include "components/signin/core/browser/signin_header_helper.h" | 35 #include "components/signin/core/browser/signin_header_helper.h" |
| 33 #include "components/signin/core/common/profile_management_switches.h" | 36 #include "components/signin/core/common/profile_management_switches.h" |
| 34 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
| 35 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 36 #include "extensions/browser/extension_prefs.h" | 39 #include "extensions/browser/extension_prefs.h" |
| 37 #include "extensions/common/constants.h" | 40 #include "extensions/common/constants.h" |
| 38 #include "google_apis/gaia/gaia_urls.h" | 41 #include "google_apis/gaia/gaia_urls.h" |
| 39 #include "net/base/url_util.h" | 42 #include "net/base/url_util.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 std::unique_ptr<ScopedTabbedBrowserDisplayer> displayer; | 134 std::unique_ptr<ScopedTabbedBrowserDisplayer> displayer; |
| 132 if (!browser) { | 135 if (!browser) { |
| 133 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); | 136 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); |
| 134 browser = displayer->browser(); | 137 browser = displayer->browser(); |
| 135 } | 138 } |
| 136 ShowSingletonTab(browser, url); | 139 ShowSingletonTab(browser, url); |
| 137 #endif | 140 #endif |
| 138 } | 141 } |
| 139 | 142 |
| 140 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { | 143 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { |
| 141 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + | 144 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { |
| 142 site_settings::ContentSettingsTypeToGroupName(type); | 145 return kDeprecatedOptionsContentSettingsExceptionsSubPage + |
| 146 std::string(kHashMark) + |
| 147 site_settings::ContentSettingsTypeToGroupName(type); |
| 148 } |
| 149 |
| 150 // In MD Settings, the exceptions no longer have a separate subpage. |
| 151 // This list overrides the group names defined in site_settings_helper for the |
| 152 // purposes of URL generation for MD Settings only. We need this because some |
| 153 // of the old group names are no longer appropriate: i.e. "plugins" => |
| 154 // "flash". |
| 155 // |
| 156 // TODO(tommycli): Update the group names defined in site_settings_helper once |
| 157 // Options is removed from Chrome. Then this list will no longer be needed. |
| 158 typedef std::map<ContentSettingsType, std::string> ContentSettingPathMap; |
| 159 CR_DEFINE_STATIC_LOCAL( |
| 160 ContentSettingPathMap, kSettingsPathOverrides, |
| 161 ({{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automaticDownloads"}, |
| 162 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, "backgroundSync"}, |
| 163 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "microphone"}, |
| 164 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "camera"}, |
| 165 {CONTENT_SETTINGS_TYPE_PLUGINS, "flash"}, |
| 166 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "unsandboxedPlugins"}})); |
| 167 const auto it = kSettingsPathOverrides.find(type); |
| 168 const std::string content_type_path = |
| 169 (it == kSettingsPathOverrides.end()) |
| 170 ? site_settings::ContentSettingsTypeToGroupName(type) |
| 171 : it->second; |
| 172 |
| 173 return std::string(kContentSettingsSubPage) + "/" + content_type_path; |
| 143 } | 174 } |
| 144 | 175 |
| 145 #if defined(OS_CHROMEOS) | 176 #if defined(OS_CHROMEOS) |
| 146 std::string GenerateContentSettingsSearchQueryPath(int query_message_id) { | 177 std::string GenerateContentSettingsSearchQueryPath(int query_message_id) { |
| 147 return std::string(chrome::kDeprecatedOptionsSearchSubPage) + kHashMark + | 178 return std::string(chrome::kDeprecatedOptionsSearchSubPage) + kHashMark + |
| 148 l10n_util::GetStringUTF8(query_message_id); | 179 l10n_util::GetStringUTF8(query_message_id); |
| 149 } | 180 } |
| 150 #endif | 181 #endif |
| 151 | 182 |
| 152 } // namespace | 183 } // namespace |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 SigninManagerFactory::GetForProfile(original_profile); | 455 SigninManagerFactory::GetForProfile(original_profile); |
| 425 DCHECK(manager->IsSigninAllowed()); | 456 DCHECK(manager->IsSigninAllowed()); |
| 426 if (manager->IsAuthenticated()) | 457 if (manager->IsAuthenticated()) |
| 427 ShowSettings(browser); | 458 ShowSettings(browser); |
| 428 else | 459 else |
| 429 ShowBrowserSignin(browser, access_point); | 460 ShowBrowserSignin(browser, access_point); |
| 430 } | 461 } |
| 431 #endif | 462 #endif |
| 432 | 463 |
| 433 } // namespace chrome | 464 } // namespace chrome |
| OLD | NEW |