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

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

Issue 2455113003: MD Settings: Fix Client Navigations to Search Query URLs (Closed)
Patch Set: Fix implementation Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.cc ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 10 #include "base/logging.h"
(...skipping 26 matching lines...) Expand all
37 #include "extensions/common/constants.h" 37 #include "extensions/common/constants.h"
38 #include "google_apis/gaia/gaia_urls.h" 38 #include "google_apis/gaia/gaia_urls.h"
39 #include "net/base/url_util.h" 39 #include "net/base/url_util.h"
40 #include "ui/base/window_open_disposition.h" 40 #include "ui/base/window_open_disposition.h"
41 41
42 #if defined(OS_WIN) 42 #if defined(OS_WIN)
43 #include "chrome/browser/win/enumerate_modules_model.h" 43 #include "chrome/browser/win/enumerate_modules_model.h"
44 #endif 44 #endif
45 45
46 #if defined(OS_CHROMEOS) 46 #if defined(OS_CHROMEOS)
47 #include "base/feature_list.h"
47 #include "chrome/browser/chromeos/genius_app/app_id.h" 48 #include "chrome/browser/chromeos/genius_app/app_id.h"
49 #include "chrome/common/chrome_features.h"
50 #include "chrome/grit/generated_resources.h"
48 #include "extensions/browser/extension_registry.h" 51 #include "extensions/browser/extension_registry.h"
52 #include "ui/base/l10n/l10n_util.h"
49 #endif 53 #endif
50 54
51 #if !defined(OS_ANDROID) 55 #if !defined(OS_ANDROID)
52 #include "chrome/browser/signin/signin_manager_factory.h" 56 #include "chrome/browser/signin/signin_manager_factory.h"
53 #include "components/signin/core/browser/signin_manager.h" 57 #include "components/signin/core/browser/signin_manager.h"
54 #endif 58 #endif
55 59
56 using base::UserMetricsAction; 60 using base::UserMetricsAction;
57 61
58 namespace chrome { 62 namespace chrome {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 135 }
132 ShowSingletonTab(browser, url); 136 ShowSingletonTab(browser, url);
133 #endif 137 #endif
134 } 138 }
135 139
136 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { 140 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) {
137 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + 141 return kContentSettingsExceptionsSubPage + std::string(kHashMark) +
138 site_settings::ContentSettingsTypeToGroupName(type); 142 site_settings::ContentSettingsTypeToGroupName(type);
139 } 143 }
140 144
145 #if defined(OS_CHROMEOS)
146 std::string GenerateContentSettingsSearchQueryPath(int query_message_id) {
147 return std::string(chrome::kDeprecatedOptionsSearchSubPage) + kHashMark +
148 l10n_util::GetStringUTF8(query_message_id);
149 }
150 #endif
151
141 } // namespace 152 } // namespace
142 153
143 void ShowBookmarkManager(Browser* browser) { 154 void ShowBookmarkManager(Browser* browser) {
144 content::RecordAction(UserMetricsAction("ShowBookmarkManager")); 155 content::RecordAction(UserMetricsAction("ShowBookmarkManager"));
145 content::RecordAction(UserMetricsAction("ShowBookmarks")); 156 content::RecordAction(UserMetricsAction("ShowBookmarks"));
146 ShowSingletonTabOverwritingNTP( 157 ShowSingletonTabOverwritingNTP(
147 browser, 158 browser,
148 GetSingletonTabNavigateParams(browser, GURL(kChromeUIBookmarksURL))); 159 GetSingletonTabNavigateParams(browser, GURL(kChromeUIBookmarksURL)));
149 } 160 }
150 161
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void ShowSettingsSubPage(Browser* browser, const std::string& sub_page) { 272 void ShowSettingsSubPage(Browser* browser, const std::string& sub_page) {
262 if (::switches::SettingsWindowEnabled()) { 273 if (::switches::SettingsWindowEnabled()) {
263 ShowSettingsSubPageForProfile(browser->profile(), sub_page); 274 ShowSettingsSubPageForProfile(browser->profile(), sub_page);
264 return; 275 return;
265 } 276 }
266 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); 277 ShowSettingsSubPageInTabbedBrowser(browser, sub_page);
267 } 278 }
268 279
269 void ShowSettingsSubPageForProfile(Profile* profile, 280 void ShowSettingsSubPageForProfile(Profile* profile,
270 const std::string& sub_page) { 281 const std::string& sub_page) {
282 std::string sub_page_path = sub_page;
283
284 #if defined(OS_CHROMEOS)
285 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
286 if (sub_page == chrome::kAccessibilitySubPage) {
287 sub_page_path = GenerateContentSettingsSearchQueryPath(
288 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY);
289 } else if (sub_page == chrome::kBluetoothSubPage) {
290 sub_page_path = GenerateContentSettingsSearchQueryPath(
291 IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH);
292 } else if (sub_page == chrome::kDateTimeSubPage) {
293 sub_page_path = GenerateContentSettingsSearchQueryPath(
294 IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME);
295 }
296 }
297 #endif
298
271 if (::switches::SettingsWindowEnabled()) { 299 if (::switches::SettingsWindowEnabled()) {
272 content::RecordAction(base::UserMetricsAction("ShowOptions")); 300 content::RecordAction(base::UserMetricsAction("ShowOptions"));
273 SettingsWindowManager::GetInstance()->ShowChromePageForProfile( 301 SettingsWindowManager::GetInstance()->ShowChromePageForProfile(
274 profile, GetSettingsUrl(sub_page)); 302 profile, GetSettingsUrl(sub_page_path));
275 return; 303 return;
276 } 304 }
277 Browser* browser = chrome::FindTabbedBrowser(profile, false); 305 Browser* browser = chrome::FindTabbedBrowser(profile, false);
278 if (!browser) { 306 if (!browser) {
279 browser = new Browser(Browser::CreateParams(profile)); 307 browser = new Browser(Browser::CreateParams(profile));
280 } 308 }
281 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); 309 ShowSettingsSubPageInTabbedBrowser(browser, sub_page_path);
282 } 310 }
283 311
284 void ShowSettingsSubPageInTabbedBrowser(Browser* browser, 312 void ShowSettingsSubPageInTabbedBrowser(Browser* browser,
285 const std::string& sub_page) { 313 const std::string& sub_page) {
286 content::RecordAction(UserMetricsAction("ShowOptions")); 314 content::RecordAction(UserMetricsAction("ShowOptions"));
287 GURL gurl = GetSettingsUrl(sub_page); 315 GURL gurl = GetSettingsUrl(sub_page);
288 NavigateParams params(GetSingletonTabNavigateParams(browser, gurl)); 316 NavigateParams params(GetSingletonTabNavigateParams(browser, gurl));
289 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; 317 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE;
290 ShowSingletonTabOverwritingNTP(browser, params); 318 ShowSingletonTabOverwritingNTP(browser, params);
291 } 319 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 SigninManagerFactory::GetForProfile(original_profile); 424 SigninManagerFactory::GetForProfile(original_profile);
397 DCHECK(manager->IsSigninAllowed()); 425 DCHECK(manager->IsSigninAllowed());
398 if (manager->IsAuthenticated()) 426 if (manager->IsAuthenticated())
399 ShowSettings(browser); 427 ShowSettings(browser);
400 else 428 else
401 ShowBrowserSignin(browser, access_point); 429 ShowBrowserSignin(browser, access_point);
402 } 430 }
403 #endif 431 #endif
404 432
405 } // namespace chrome 433 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.cc ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698