 Chromium Code Reviews
 Chromium Code Reviews Issue 136693013:
  [Hotword] Remove unneeded preferences. Cleaning up look of settings.  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master
    
  
    Issue 136693013:
  [Hotword] Remove unneeded preferences. Cleaning up look of settings.  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master| OLD | NEW | 
|---|---|
| 1 | |
| 
James Hawkins
2014/01/29 19:06:16
nit: Remove blank line.
 
rpetterson
2014/01/29 22:31:59
Done.
 | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // 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 | 3 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 4 // found in the LICENSE file. | 
| 4 | 5 | 
| 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" | 6 #include "chrome/browser/ui/webui/options/browser_options_handler.h" | 
| 6 | 7 | 
| 7 #include <string> | 8 #include <string> | 
| 8 #include <vector> | 9 #include <vector> | 
| 9 | 10 | 
| 10 #include "apps/shell_window.h" | 11 #include "apps/shell_window.h" | 
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" | 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" | 
| 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | 40 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | 
| 40 #include "chrome/browser/profiles/profile.h" | 41 #include "chrome/browser/profiles/profile.h" | 
| 41 #include "chrome/browser/profiles/profile_info_cache.h" | 42 #include "chrome/browser/profiles/profile_info_cache.h" | 
| 42 #include "chrome/browser/profiles/profile_info_util.h" | 43 #include "chrome/browser/profiles/profile_info_util.h" | 
| 43 #include "chrome/browser/profiles/profile_manager.h" | 44 #include "chrome/browser/profiles/profile_manager.h" | 
| 44 #include "chrome/browser/profiles/profile_metrics.h" | 45 #include "chrome/browser/profiles/profile_metrics.h" | 
| 45 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 46 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 
| 46 #include "chrome/browser/profiles/profile_window.h" | 47 #include "chrome/browser/profiles/profile_window.h" | 
| 47 #include "chrome/browser/profiles/profiles_state.h" | 48 #include "chrome/browser/profiles/profiles_state.h" | 
| 49 #include "chrome/browser/search/hotword_service.h" | |
| 50 #include "chrome/browser/search/hotword_service_factory.h" | |
| 48 #include "chrome/browser/search/search.h" | 51 #include "chrome/browser/search/search.h" | 
| 49 #include "chrome/browser/search_engines/template_url.h" | 52 #include "chrome/browser/search_engines/template_url.h" | 
| 50 #include "chrome/browser/search_engines/template_url_service.h" | 53 #include "chrome/browser/search_engines/template_url_service.h" | 
| 51 #include "chrome/browser/search_engines/template_url_service_factory.h" | 54 #include "chrome/browser/search_engines/template_url_service_factory.h" | 
| 52 #include "chrome/browser/signin/signin_manager.h" | 55 #include "chrome/browser/signin/signin_manager.h" | 
| 53 #include "chrome/browser/signin/signin_manager_factory.h" | 56 #include "chrome/browser/signin/signin_manager_factory.h" | 
| 54 #include "chrome/browser/sync/profile_sync_service.h" | 57 #include "chrome/browser/sync/profile_sync_service.h" | 
| 55 #include "chrome/browser/sync/profile_sync_service_factory.h" | 58 #include "chrome/browser/sync/profile_sync_service_factory.h" | 
| 56 #include "chrome/browser/sync/sync_ui_util.h" | 59 #include "chrome/browser/sync/sync_ui_util.h" | 
| 57 #include "chrome/browser/themes/theme_service.h" | 60 #include "chrome/browser/themes/theme_service.h" | 
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE }, | 254 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE }, | 
| 252 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, | 255 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, | 
| 253 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL }, | 256 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL }, | 
| 254 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE }, | 257 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE }, | 
| 255 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL }, | 258 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL }, | 
| 256 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS }, | 259 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS }, | 
| 257 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP }, | 260 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP }, | 
| 258 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, | 261 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, | 
| 259 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB }, | 262 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB }, | 
| 260 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL }, | 263 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL }, | 
| 261 { "hotwordSearchDescription", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION }, | 264 { "hotwordSearchEnable", IDS_HOTWORD_SEARCH_PREF_CHKBOX }, | 
| 262 { "hotwordSearchIncognito", IDS_HOTWORD_SEARCH_INCOGNITO_PREF_CHKBOX }, | 265 { "hotwordConfirmEnable", IDS_HOTWORD_CONFIRM_BUBBLE_ENABLE }, | 
| 263 { "hotwordSearchTimeout", IDS_HOTWORD_SEARCH_TIMEOUT_PREF_CHKBOX }, | 266 { "hotwordConfirmDisable", IDS_HOTWORD_CONFIRM_BUBBLE_DISABLE }, | 
| 264 { "hotwordSearchTimeoutDescription", | 267 { "hotwordConfirmMessage", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION }, | 
| 265 IDS_HOTWORD_SEARCH_TIMEOUT_PREF_DESCRIPTION }, | |
| 266 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON }, | 268 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON }, | 
| 267 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, | 269 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, | 
| 268 { "languageAndSpellCheckSettingsButton", | 270 { "languageAndSpellCheckSettingsButton", | 
| 269 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS }, | 271 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS }, | 
| 270 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF }, | 272 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF }, | 
| 271 { "manageAutofillSettings", IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK }, | 273 { "manageAutofillSettings", IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK }, | 
| 272 { "manageLanguages", IDS_OPTIONS_TRANSLATE_MANAGE_LANGUAGES }, | 274 { "manageLanguages", IDS_OPTIONS_TRANSLATE_MANAGE_LANGUAGES }, | 
| 273 { "managePasswords", IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK }, | 275 { "managePasswords", IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK }, | 
| 274 { "networkPredictionEnabledDescription", | 276 { "networkPredictionEnabledDescription", | 
| 275 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION }, | 277 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION }, | 
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); | 478 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); | 
| 477 #if defined(ENABLE_FULL_PRINTING) | 479 #if defined(ENABLE_FULL_PRINTING) | 
| 478 RegisterCloudPrintValues(values); | 480 RegisterCloudPrintValues(values); | 
| 479 #endif | 481 #endif | 
| 480 | 482 | 
| 481 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); | 483 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); | 
| 482 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); | 484 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); | 
| 483 values->SetString( | 485 values->SetString( | 
| 484 "defaultSearchGroupLabel", | 486 "defaultSearchGroupLabel", | 
| 485 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); | 487 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); | 
| 486 base::string16 hotword_url = base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL); | 488 values->SetString("hotwordLearnMoreURL", chrome::kHotwordLearnMoreURL); | 
| 487 values->SetString( | 489 RegisterTitle(values, "hotwordConfirmOverlay", | 
| 488 "hotwordSearchEnable", | 490 IDS_HOTWORD_SEARCH_PREF_CHKBOX); | 
| 489 l10n_util::GetStringFUTF16(IDS_HOTWORD_SEARCH_PREF_CHKBOX, hotword_url)); | |
| 490 | 491 | 
| 491 #if defined(OS_CHROMEOS) | 492 #if defined(OS_CHROMEOS) | 
| 492 Profile* profile = Profile::FromWebUI(web_ui()); | 493 Profile* profile = Profile::FromWebUI(web_ui()); | 
| 493 std::string username = profile->GetProfileName(); | 494 std::string username = profile->GetProfileName(); | 
| 494 if (username.empty()) { | 495 if (username.empty()) { | 
| 495 chromeos::User* user = | 496 chromeos::User* user = | 
| 496 chromeos::UserManager::Get()->GetUserByProfile(profile); | 497 chromeos::UserManager::Get()->GetUserByProfile(profile); | 
| 497 if (user && (user->GetType() != chromeos::User::USER_TYPE_GUEST)) | 498 if (user && (user->GetType() != chromeos::User::USER_TYPE_GUEST)) | 
| 498 username = user->email(); | 499 username = user->email(); | 
| 499 } | 500 } | 
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 | 
| OLD | NEW |