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

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

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; 1305 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN;
1306 } else { 1306 } else {
1307 NOTREACHED(); 1307 NOTREACHED();
1308 return; 1308 return;
1309 } 1309 }
1310 1310
1311 SetDefaultBrowserUIString(status_string_id); 1311 SetDefaultBrowserUIString(status_string_id);
1312 } 1312 }
1313 1313
1314 void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) { 1314 void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) {
1315 base::StringValue status_string( 1315 base::Value status_string(l10n_util::GetStringFUTF16(
1316 l10n_util::GetStringFUTF16(status_string_id, 1316 status_string_id, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
1317 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
1318 1317
1319 base::Value is_default(status_string_id == 1318 base::Value is_default(status_string_id ==
1320 IDS_OPTIONS_DEFAULTBROWSER_DEFAULT); 1319 IDS_OPTIONS_DEFAULTBROWSER_DEFAULT);
1321 1320
1322 base::Value can_be_default( 1321 base::Value can_be_default(
1323 !IsDisabledByPolicy(default_browser_policy_) && 1322 !IsDisabledByPolicy(default_browser_policy_) &&
1324 (status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT || 1323 (status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT ||
1325 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT)); 1324 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT));
1326 1325
1327 web_ui()->CallJavascriptFunctionUnsafe( 1326 web_ui()->CallJavascriptFunctionUnsafe(
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 1551
1553 #if defined(OS_CHROMEOS) 1552 #if defined(OS_CHROMEOS)
1554 void BrowserOptionsHandler::UpdateAccountPicture() { 1553 void BrowserOptionsHandler::UpdateAccountPicture() {
1555 std::string email = user_manager::UserManager::Get() 1554 std::string email = user_manager::UserManager::Get()
1556 ->GetActiveUser() 1555 ->GetActiveUser()
1557 ->GetAccountId() 1556 ->GetAccountId()
1558 .GetUserEmail(); 1557 .GetUserEmail();
1559 if (!email.empty()) { 1558 if (!email.empty()) {
1560 web_ui()->CallJavascriptFunctionUnsafe( 1559 web_ui()->CallJavascriptFunctionUnsafe(
1561 "BrowserOptions.updateAccountPicture"); 1560 "BrowserOptions.updateAccountPicture");
1562 base::StringValue email_value(email); 1561 base::Value email_value(email);
1563 web_ui()->CallJavascriptFunctionUnsafe( 1562 web_ui()->CallJavascriptFunctionUnsafe(
1564 "BrowserOptions.updateAccountPicture", email_value); 1563 "BrowserOptions.updateAccountPicture", email_value);
1565 web_ui()->CallJavascriptFunctionUnsafe( 1564 web_ui()->CallJavascriptFunctionUnsafe(
1566 "AccountsOptions.getInstance().updateAccountPicture", email_value); 1565 "AccountsOptions.getInstance().updateAccountPicture", email_value);
1567 } 1566 }
1568 } 1567 }
1569 1568
1570 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) { 1569 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) {
1571 web_ui()->CallJavascriptFunctionUnsafe( 1570 web_ui()->CallJavascriptFunctionUnsafe(
1572 "BrowserOptions.setAccountPictureManaged", base::Value(managed)); 1571 "BrowserOptions.setAccountPictureManaged", base::Value(managed));
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 web_ui()->GetWebContents()->OpenURL(params); 1819 web_ui()->GetWebContents()->OpenURL(params);
1821 } 1820 }
1822 #endif 1821 #endif
1823 1822
1824 void BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible( 1823 void BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible(
1825 const base::string16& audio_history_state, 1824 const base::string16& audio_history_state,
1826 bool success, bool logging_enabled) { 1825 bool success, bool logging_enabled) {
1827 bool visible = logging_enabled && success; 1826 bool visible = logging_enabled && success;
1828 web_ui()->CallJavascriptFunctionUnsafe( 1827 web_ui()->CallJavascriptFunctionUnsafe(
1829 "BrowserOptions.setAudioHistorySectionVisible", base::Value(visible), 1828 "BrowserOptions.setAudioHistorySectionVisible", base::Value(visible),
1830 base::StringValue(audio_history_state)); 1829 base::Value(audio_history_state));
1831 } 1830 }
1832 1831
1833 void BrowserOptionsHandler::HandleRequestGoogleNowAvailable( 1832 void BrowserOptionsHandler::HandleRequestGoogleNowAvailable(
1834 const base::ListValue* args) { 1833 const base::ListValue* args) {
1835 bool is_search_provider_google = false; 1834 bool is_search_provider_google = false;
1836 if (template_url_service_ && template_url_service_->loaded()) { 1835 if (template_url_service_ && template_url_service_->loaded()) {
1837 const TemplateURL* default_url = 1836 const TemplateURL* default_url =
1838 template_url_service_->GetDefaultSearchProvider(); 1837 template_url_service_->GetDefaultSearchProvider();
1839 if (default_url && default_url->HasGoogleBaseURLs( 1838 if (default_url && default_url->HasGoogleBaseURLs(
1840 template_url_service_->search_terms_data())) { 1839 template_url_service_->search_terms_data())) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 weak_ptr_factory_.GetWeakPtr(), 1926 weak_ptr_factory_.GetWeakPtr(),
1928 audio_history_state)); 1927 audio_history_state));
1929 } 1928 }
1930 } 1929 }
1931 1930
1932 if (!error) { 1931 if (!error) {
1933 web_ui()->CallJavascriptFunctionUnsafe(function_name); 1932 web_ui()->CallJavascriptFunctionUnsafe(function_name);
1934 } else { 1933 } else {
1935 base::string16 hotword_help_url = 1934 base::string16 hotword_help_url =
1936 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL); 1935 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL);
1937 base::StringValue error_message(l10n_util::GetStringUTF16(error)); 1936 base::Value error_message(l10n_util::GetStringUTF16(error));
1938 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) { 1937 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) {
1939 error_message = base::StringValue( 1938 error_message =
1940 l10n_util::GetStringFUTF16(error, hotword_help_url)); 1939 base::Value(l10n_util::GetStringFUTF16(error, hotword_help_url));
1941 } 1940 }
1942 web_ui()->CallJavascriptFunctionUnsafe(function_name, error_message); 1941 web_ui()->CallJavascriptFunctionUnsafe(function_name, error_message);
1943 } 1942 }
1944 } 1943 }
1945 } 1944 }
1946 1945
1947 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp( 1946 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
1948 const base::ListValue* args) { 1947 const base::ListValue* args) {
1949 Profile* profile = Profile::FromWebUI(web_ui()); 1948 Profile* profile = Profile::FromWebUI(web_ui());
1950 1949
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2354 2353
2355 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2354 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2356 #if defined(OS_CHROMEOS) 2355 #if defined(OS_CHROMEOS)
2357 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2356 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2358 #else 2357 #else
2359 return true; 2358 return true;
2360 #endif 2359 #endif
2361 } 2360 }
2362 2361
2363 } // namespace options 2362 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698