Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: chrome/browser/ui/chrome_pages.cc

Issue 2913343002: Start removing deprecated Options UI code (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
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(crbug.com/728353): Update the group names defined in
158 // Options is removed from Chrome. Then this list will no longer be needed. 152 // site_settings_helper once Options is removed from Chrome. Then this list
153 // will no longer be needed.
159 typedef std::map<ContentSettingsType, std::string> ContentSettingPathMap; 154 typedef std::map<ContentSettingsType, std::string> ContentSettingPathMap;
160 CR_DEFINE_STATIC_LOCAL( 155 CR_DEFINE_STATIC_LOCAL(
161 ContentSettingPathMap, kSettingsPathOverrides, 156 ContentSettingPathMap, kSettingsPathOverrides,
162 ({{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automaticDownloads"}, 157 ({{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automaticDownloads"},
163 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, "backgroundSync"}, 158 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, "backgroundSync"},
164 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "microphone"}, 159 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "microphone"},
165 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "camera"}, 160 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "camera"},
166 {CONTENT_SETTINGS_TYPE_PLUGINS, "flash"}, 161 {CONTENT_SETTINGS_TYPE_PLUGINS, "flash"},
167 {CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, "subresourceFilter"}, 162 {CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER, "subresourceFilter"},
168 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "unsandboxedPlugins"}})); 163 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "unsandboxedPlugins"}}));
169 const auto it = kSettingsPathOverrides.find(type); 164 const auto it = kSettingsPathOverrides.find(type);
170 const std::string content_type_path = 165 const std::string content_type_path =
171 (it == kSettingsPathOverrides.end()) 166 (it == kSettingsPathOverrides.end())
172 ? site_settings::ContentSettingsTypeToGroupName(type) 167 ? site_settings::ContentSettingsTypeToGroupName(type)
173 : it->second; 168 : it->second;
174 169
175 return std::string(kContentSettingsSubPage) + "/" + content_type_path; 170 return std::string(kContentSettingsSubPage) + "/" + content_type_path;
176 } 171 }
177 172
178 #if defined(OS_CHROMEOS)
179 std::string GenerateContentSettingsSearchQueryPath(int query_message_id) {
180 return std::string(chrome::kDeprecatedOptionsSearchSubPage) + kHashMark +
181 l10n_util::GetStringUTF8(query_message_id);
182 }
183 #endif
184
185 } // namespace 173 } // namespace
186 174
187 void ShowBookmarkManager(Browser* browser) { 175 void ShowBookmarkManager(Browser* browser) {
188 base::RecordAction(UserMetricsAction("ShowBookmarkManager")); 176 base::RecordAction(UserMetricsAction("ShowBookmarkManager"));
189 if (MdBookmarksUI::IsEnabled()) { 177 if (MdBookmarksUI::IsEnabled()) {
190 const bookmarks::BookmarkNode* bookmark_bar_node = 178 const bookmarks::BookmarkNode* bookmark_bar_node =
191 BookmarkModelFactory::GetForBrowserContext(browser->profile()) 179 BookmarkModelFactory::GetForBrowserContext(browser->profile())
192 ->bookmark_bar_node(); 180 ->bookmark_bar_node();
193 OpenBookmarkManagerForNode(browser, bookmark_bar_node->id()); 181 OpenBookmarkManagerForNode(browser, bookmark_bar_node->id());
194 return; 182 return;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 ShowSettingsSubPageForProfile(browser->profile(), sub_page); 298 ShowSettingsSubPageForProfile(browser->profile(), sub_page);
311 return; 299 return;
312 } 300 }
313 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); 301 ShowSettingsSubPageInTabbedBrowser(browser, sub_page);
314 } 302 }
315 303
316 void ShowSettingsSubPageForProfile(Profile* profile, 304 void ShowSettingsSubPageForProfile(Profile* profile,
317 const std::string& sub_page) { 305 const std::string& sub_page) {
318 std::string sub_page_path = sub_page; 306 std::string sub_page_path = sub_page;
319 307
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()) { 308 if (::switches::SettingsWindowEnabled()) {
339 base::RecordAction(base::UserMetricsAction("ShowOptions")); 309 base::RecordAction(base::UserMetricsAction("ShowOptions"));
340 SettingsWindowManager::GetInstance()->ShowChromePageForProfile( 310 SettingsWindowManager::GetInstance()->ShowChromePageForProfile(
341 profile, GetSettingsUrl(sub_page_path)); 311 profile, GetSettingsUrl(sub_page_path));
342 return; 312 return;
343 } 313 }
344 Browser* browser = chrome::FindTabbedBrowser(profile, false); 314 Browser* browser = chrome::FindTabbedBrowser(profile, false);
345 if (!browser) { 315 if (!browser) {
346 browser = new Browser(Browser::CreateParams(profile, true)); 316 browser = new Browser(Browser::CreateParams(profile, true));
347 } 317 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 SigninManagerFactory::GetForProfile(original_profile); 433 SigninManagerFactory::GetForProfile(original_profile);
464 DCHECK(manager->IsSigninAllowed()); 434 DCHECK(manager->IsSigninAllowed());
465 if (manager->IsAuthenticated()) 435 if (manager->IsAuthenticated())
466 ShowSettings(browser); 436 ShowSettings(browser);
467 else 437 else
468 ShowBrowserSignin(browser, access_point); 438 ShowBrowserSignin(browser, access_point);
469 } 439 }
470 #endif 440 #endif
471 441
472 } // namespace chrome 442 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698