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/feature_list.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 std::unique_ptr<ScopedTabbedBrowserDisplayer> displayer; | 135 std::unique_ptr<ScopedTabbedBrowserDisplayer> displayer; |
136 if (!browser) { | 136 if (!browser) { |
137 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); | 137 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); |
138 browser = displayer->browser(); | 138 browser = displayer->browser(); |
139 } | 139 } |
140 ShowSingletonTab(browser, url); | 140 ShowSingletonTab(browser, url); |
141 #endif | 141 #endif |
142 } | 142 } |
143 | 143 |
144 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { | 144 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { |
145 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { | |
146 return kDeprecatedOptionsContentSettingsExceptionsSubPage + | |
147 std::string(kHashMark) + | |
148 site_settings::ContentSettingsTypeToGroupName(type); | |
149 } | |
150 | |
151 // In MD Settings, the exceptions no longer have a separate subpage. | 145 // In MD Settings, the exceptions no longer have a separate subpage. |
dpapad
2017/06/01 00:12:54
This comment contrasts old and new, but it seems a
Dan Beam
2017/06/03 00:11:02
Acknowledged.
| |
152 // This list overrides the group names defined in site_settings_helper for the | 146 // This list overrides the group names defined in site_settings_helper for the |
153 // purposes of URL generation for MD Settings only. We need this because some | 147 // purposes of URL generation for MD Settings only. We need this because some |
154 // of the old group names are no longer appropriate: i.e. "plugins" => | 148 // of the old group names are no longer appropriate: i.e. "plugins" => |
155 // "flash". | 149 // "flash". |
156 // | 150 // |
157 // TODO(tommycli): Update the group names defined in site_settings_helper once | 151 // TODO(tommycli): Update the group names defined in site_settings_helper once |
dpapad
2017/06/01 00:12:54
Maybe add a reference to crbug.com/728353 here, so
Dan Beam
2017/06/03 00:11:02
Done.
| |
158 // Options is removed from Chrome. Then this list will no longer be needed. | 152 // Options is removed from Chrome. Then this list will no longer be needed. |
159 typedef std::map<ContentSettingsType, std::string> ContentSettingPathMap; | 153 typedef std::map<ContentSettingsType, std::string> ContentSettingPathMap; |
160 CR_DEFINE_STATIC_LOCAL( | 154 CR_DEFINE_STATIC_LOCAL( |
161 ContentSettingPathMap, kSettingsPathOverrides, | 155 ContentSettingPathMap, kSettingsPathOverrides, |
162 ({{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automaticDownloads"}, | 156 ({{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automaticDownloads"}, |
163 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, "backgroundSync"}, | 157 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, "backgroundSync"}, |
164 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "microphone"}, | 158 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "microphone"}, |
165 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "camera"}, | 159 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "camera"}, |
166 {CONTENT_SETTINGS_TYPE_PLUGINS, "flash"}, | 160 {CONTENT_SETTINGS_TYPE_PLUGINS, "flash"}, |
167 {CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, "subresourceFilter"}, | 161 {CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, "subresourceFilter"}, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 ShowSettingsSubPageForProfile(browser->profile(), sub_page); | 304 ShowSettingsSubPageForProfile(browser->profile(), sub_page); |
311 return; | 305 return; |
312 } | 306 } |
313 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); | 307 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); |
314 } | 308 } |
315 | 309 |
316 void ShowSettingsSubPageForProfile(Profile* profile, | 310 void ShowSettingsSubPageForProfile(Profile* profile, |
317 const std::string& sub_page) { | 311 const std::string& sub_page) { |
318 std::string sub_page_path = sub_page; | 312 std::string sub_page_path = sub_page; |
319 | 313 |
320 #if defined(OS_CHROMEOS) | |
321 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { | |
322 if (sub_page == chrome::kAccessibilitySubPage) { | |
323 sub_page_path = GenerateContentSettingsSearchQueryPath( | |
324 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY); | |
325 } else if (sub_page == chrome::kBluetoothSubPage) { | |
326 sub_page_path = GenerateContentSettingsSearchQueryPath( | |
327 IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH); | |
328 } else if (sub_page == chrome::kDateTimeSubPage) { | |
329 sub_page_path = GenerateContentSettingsSearchQueryPath( | |
330 IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); | |
331 } else if (sub_page == chrome::kStylusSubPage || | |
332 sub_page == chrome::kPowerSubPage) { | |
333 sub_page_path += "-overlay"; | |
334 } | |
335 } | |
336 #endif | |
337 | |
338 if (::switches::SettingsWindowEnabled()) { | 314 if (::switches::SettingsWindowEnabled()) { |
339 base::RecordAction(base::UserMetricsAction("ShowOptions")); | 315 base::RecordAction(base::UserMetricsAction("ShowOptions")); |
340 SettingsWindowManager::GetInstance()->ShowChromePageForProfile( | 316 SettingsWindowManager::GetInstance()->ShowChromePageForProfile( |
341 profile, GetSettingsUrl(sub_page_path)); | 317 profile, GetSettingsUrl(sub_page_path)); |
342 return; | 318 return; |
343 } | 319 } |
344 Browser* browser = chrome::FindTabbedBrowser(profile, false); | 320 Browser* browser = chrome::FindTabbedBrowser(profile, false); |
345 if (!browser) { | 321 if (!browser) { |
346 browser = new Browser(Browser::CreateParams(profile, true)); | 322 browser = new Browser(Browser::CreateParams(profile, true)); |
347 } | 323 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 SigninManagerFactory::GetForProfile(original_profile); | 439 SigninManagerFactory::GetForProfile(original_profile); |
464 DCHECK(manager->IsSigninAllowed()); | 440 DCHECK(manager->IsSigninAllowed()); |
465 if (manager->IsAuthenticated()) | 441 if (manager->IsAuthenticated()) |
466 ShowSettings(browser); | 442 ShowSettings(browser); |
467 else | 443 else |
468 ShowBrowserSignin(browser, access_point); | 444 ShowBrowserSignin(browser, access_point); |
469 } | 445 } |
470 #endif | 446 #endif |
471 | 447 |
472 } // namespace chrome | 448 } // namespace chrome |
OLD | NEW |