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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 136693013: [Hotword] Remove unneeded preferences. Cleaning up look of settings. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: wrong section name in test Created 6 years, 10 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/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/shell_window.h" 10 #include "apps/shell_window.h"
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" 38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h"
39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
40 #include "chrome/browser/profiles/profile.h" 40 #include "chrome/browser/profiles/profile.h"
41 #include "chrome/browser/profiles/profile_info_cache.h" 41 #include "chrome/browser/profiles/profile_info_cache.h"
42 #include "chrome/browser/profiles/profile_info_util.h" 42 #include "chrome/browser/profiles/profile_info_util.h"
43 #include "chrome/browser/profiles/profile_manager.h" 43 #include "chrome/browser/profiles/profile_manager.h"
44 #include "chrome/browser/profiles/profile_metrics.h" 44 #include "chrome/browser/profiles/profile_metrics.h"
45 #include "chrome/browser/profiles/profile_shortcut_manager.h" 45 #include "chrome/browser/profiles/profile_shortcut_manager.h"
46 #include "chrome/browser/profiles/profile_window.h" 46 #include "chrome/browser/profiles/profile_window.h"
47 #include "chrome/browser/profiles/profiles_state.h" 47 #include "chrome/browser/profiles/profiles_state.h"
48 #include "chrome/browser/search/hotword_service.h"
49 #include "chrome/browser/search/hotword_service_factory.h"
48 #include "chrome/browser/search/search.h" 50 #include "chrome/browser/search/search.h"
49 #include "chrome/browser/search_engines/template_url.h" 51 #include "chrome/browser/search_engines/template_url.h"
50 #include "chrome/browser/search_engines/template_url_service.h" 52 #include "chrome/browser/search_engines/template_url_service.h"
51 #include "chrome/browser/search_engines/template_url_service_factory.h" 53 #include "chrome/browser/search_engines/template_url_service_factory.h"
52 #include "chrome/browser/signin/signin_manager.h" 54 #include "chrome/browser/signin/signin_manager.h"
53 #include "chrome/browser/signin/signin_manager_factory.h" 55 #include "chrome/browser/signin/signin_manager_factory.h"
54 #include "chrome/browser/sync/profile_sync_service.h" 56 #include "chrome/browser/sync/profile_sync_service.h"
55 #include "chrome/browser/sync/profile_sync_service_factory.h" 57 #include "chrome/browser/sync/profile_sync_service_factory.h"
56 #include "chrome/browser/sync/sync_ui_util.h" 58 #include "chrome/browser/sync/sync_ui_util.h"
57 #include "chrome/browser/themes/theme_service.h" 59 #include "chrome/browser/themes/theme_service.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE }, 253 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE },
252 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, 254 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM },
253 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL }, 255 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL },
254 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE }, 256 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE },
255 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL }, 257 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL },
256 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS }, 258 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS },
257 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP }, 259 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP },
258 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, 260 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON },
259 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB }, 261 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB },
260 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL }, 262 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL },
261 { "hotwordSearchDescription", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION }, 263 { "hotwordSearchEnable", IDS_HOTWORD_SEARCH_PREF_CHKBOX },
262 { "hotwordSearchIncognito", IDS_HOTWORD_SEARCH_INCOGNITO_PREF_CHKBOX }, 264 { "hotwordConfirmEnable", IDS_HOTWORD_CONFIRM_BUBBLE_ENABLE },
263 { "hotwordSearchTimeout", IDS_HOTWORD_SEARCH_TIMEOUT_PREF_CHKBOX }, 265 { "hotwordConfirmDisable", IDS_HOTWORD_CONFIRM_BUBBLE_DISABLE },
264 { "hotwordSearchTimeoutDescription", 266 { "hotwordConfirmMessage", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION },
265 IDS_HOTWORD_SEARCH_TIMEOUT_PREF_DESCRIPTION },
266 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON }, 267 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON },
267 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, 268 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE },
268 { "languageAndSpellCheckSettingsButton", 269 { "languageAndSpellCheckSettingsButton",
269 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS }, 270 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS },
270 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF }, 271 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF },
271 { "manageAutofillSettings", IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK }, 272 { "manageAutofillSettings", IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK },
272 { "manageLanguages", IDS_OPTIONS_TRANSLATE_MANAGE_LANGUAGES }, 273 { "manageLanguages", IDS_OPTIONS_TRANSLATE_MANAGE_LANGUAGES },
273 { "managePasswords", IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK }, 274 { "managePasswords", IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK },
274 { "networkPredictionEnabledDescription", 275 { "networkPredictionEnabledDescription",
275 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION }, 276 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION },
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); 477 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE);
477 #if defined(ENABLE_FULL_PRINTING) 478 #if defined(ENABLE_FULL_PRINTING)
478 RegisterCloudPrintValues(values); 479 RegisterCloudPrintValues(values);
479 #endif 480 #endif
480 481
481 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); 482 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL);
482 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); 483 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL);
483 values->SetString( 484 values->SetString(
484 "defaultSearchGroupLabel", 485 "defaultSearchGroupLabel",
485 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); 486 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url));
486 base::string16 hotword_url = base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL); 487 values->SetString("hotwordLearnMoreURL", chrome::kHotwordLearnMoreURL);
487 values->SetString( 488 RegisterTitle(values, "hotwordConfirmOverlay",
488 "hotwordSearchEnable", 489 IDS_HOTWORD_SEARCH_PREF_CHKBOX);
489 l10n_util::GetStringFUTF16(IDS_HOTWORD_SEARCH_PREF_CHKBOX, hotword_url));
490 490
491 #if defined(OS_CHROMEOS) 491 #if defined(OS_CHROMEOS)
492 Profile* profile = Profile::FromWebUI(web_ui()); 492 Profile* profile = Profile::FromWebUI(web_ui());
493 std::string username = profile->GetProfileName(); 493 std::string username = profile->GetProfileName();
494 if (username.empty()) { 494 if (username.empty()) {
495 chromeos::User* user = 495 chromeos::User* user =
496 chromeos::UserManager::Get()->GetUserByProfile(profile); 496 chromeos::UserManager::Get()->GetUserByProfile(profile);
497 if (user && (user->GetType() != chromeos::User::USER_TYPE_GUEST)) 497 if (user && (user->GetType() != chromeos::User::USER_TYPE_GUEST))
498 username = user->email(); 498 username = user->email();
499
499 } 500 }
500 if (!username.empty()) 501 if (!username.empty())
501 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); 502 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username));
502 503
503 values->SetString("username", username); 504 values->SetString("username", username);
504 #endif 505 #endif
505 506
506 // Pass along sync status early so it will be available during page init. 507 // Pass along sync status early so it will be available during page init.
507 values->Set("syncData", GetSyncStateDictionary().release()); 508 values->Set("syncData", GetSyncStateDictionary().release());
508 509
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 allowed); 1520 allowed);
1520 } 1521 }
1521 1522
1522 void BrowserOptionsHandler::RemoveCloudPrintConnectorSection() { 1523 void BrowserOptionsHandler::RemoveCloudPrintConnectorSection() {
1523 web_ui()->CallJavascriptFunction( 1524 web_ui()->CallJavascriptFunction(
1524 "BrowserOptions.removeCloudPrintConnectorSection"); 1525 "BrowserOptions.removeCloudPrintConnectorSection");
1525 } 1526 }
1526 #endif // defined(OS_CHROMEOS) 1527 #endif // defined(OS_CHROMEOS)
1527 #endif // defined(ENABLE_FULL_PRINTING) 1528 #endif // defined(ENABLE_FULL_PRINTING)
1528 1529
1529 void BrowserOptionsHandler::SendHotwordAvailable() { 1530 void BrowserOptionsHandler::HandleRequestHotwordAvailable(
1531 const base::ListValue* args) {
1530 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger"); 1532 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger");
1531 if (group != "" && group != "Disabled") 1533 if (group != "" && group != "Disabled")
1532 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection"); 1534 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection");
1533 } 1535 }
1534 1536
1535 void BrowserOptionsHandler::HandleRequestHotwordAvailable(
1536 const base::ListValue* args) {
1537 SendHotwordAvailable();
1538 }
1539
1540 #if defined(OS_CHROMEOS) 1537 #if defined(OS_CHROMEOS)
1541 void BrowserOptionsHandler::HandleOpenWallpaperManager( 1538 void BrowserOptionsHandler::HandleOpenWallpaperManager(
1542 const base::ListValue* args) { 1539 const base::ListValue* args) {
1543 wallpaper_manager_util::OpenWallpaperManager(); 1540 wallpaper_manager_util::OpenWallpaperManager();
1544 } 1541 }
1545 1542
1546 void BrowserOptionsHandler::VirtualKeyboardChangeCallback( 1543 void BrowserOptionsHandler::VirtualKeyboardChangeCallback(
1547 const base::ListValue* args) { 1544 const base::ListValue* args) {
1548 bool enabled = false; 1545 bool enabled = false;
1549 args->GetBoolean(0, &enabled); 1546 args->GetBoolean(0, &enabled);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { 1714 void BrowserOptionsHandler::SetupManagingSupervisedUsers() {
1718 bool has_users = !Profile::FromWebUI(web_ui())-> 1715 bool has_users = !Profile::FromWebUI(web_ui())->
1719 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); 1716 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty();
1720 base::FundamentalValue has_users_value(has_users); 1717 base::FundamentalValue has_users_value(has_users);
1721 web_ui()->CallJavascriptFunction( 1718 web_ui()->CallJavascriptFunction(
1722 "BrowserOptions.updateManagesSupervisedUsers", 1719 "BrowserOptions.updateManagesSupervisedUsers",
1723 has_users_value); 1720 has_users_value);
1724 } 1721 }
1725 1722
1726 } // namespace options 1723 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/search/hotword_service_factory.cc ('k') | chrome/browser/ui/webui/options/settings_app_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698