OLD | NEW |
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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 return; // Still processing. | 774 return; // Still processing. |
775 | 775 |
776 SetDefaultBrowserUIString(status_string_id); | 776 SetDefaultBrowserUIString(status_string_id); |
777 } | 777 } |
778 | 778 |
779 bool BrowserOptionsHandler::IsInteractiveSetDefaultPermitted() { | 779 bool BrowserOptionsHandler::IsInteractiveSetDefaultPermitted() { |
780 return true; // This is UI so we can allow it. | 780 return true; // This is UI so we can allow it. |
781 } | 781 } |
782 | 782 |
783 void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) { | 783 void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) { |
784 scoped_ptr<Value> status_string(Value::CreateStringValue( | 784 scoped_ptr<Value> status_string(new base::StringValue( |
785 l10n_util::GetStringFUTF16(status_string_id, | 785 l10n_util::GetStringFUTF16(status_string_id, |
786 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); | 786 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); |
787 | 787 |
788 scoped_ptr<Value> is_default(Value::CreateBooleanValue( | 788 scoped_ptr<Value> is_default(Value::CreateBooleanValue( |
789 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT)); | 789 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT)); |
790 | 790 |
791 scoped_ptr<Value> can_be_default(Value::CreateBooleanValue( | 791 scoped_ptr<Value> can_be_default(Value::CreateBooleanValue( |
792 !default_browser_policy_.IsManaged() && | 792 !default_browser_policy_.IsManaged() && |
793 (status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT || | 793 (status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT || |
794 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT))); | 794 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT))); |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 // Each item in the list has the following parameters: | 1367 // Each item in the list has the following parameters: |
1368 // 1. Title (string). | 1368 // 1. Title (string). |
1369 // 2. Value (double). | 1369 // 2. Value (double). |
1370 // 3. Is selected? (bool). | 1370 // 3. Is selected? (bool). |
1371 ListValue zoom_factors_value; | 1371 ListValue zoom_factors_value; |
1372 for (std::vector<double>::const_iterator i = zoom_factors.begin(); | 1372 for (std::vector<double>::const_iterator i = zoom_factors.begin(); |
1373 i != zoom_factors.end(); ++i) { | 1373 i != zoom_factors.end(); ++i) { |
1374 ListValue* option = new ListValue(); | 1374 ListValue* option = new ListValue(); |
1375 double factor = *i; | 1375 double factor = *i; |
1376 int percent = static_cast<int>(factor * 100 + 0.5); | 1376 int percent = static_cast<int>(factor * 100 + 0.5); |
1377 option->Append(Value::CreateStringValue( | 1377 option->Append(new base::StringValue( |
1378 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, percent))); | 1378 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, percent))); |
1379 option->Append(Value::CreateDoubleValue(factor)); | 1379 option->Append(Value::CreateDoubleValue(factor)); |
1380 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); | 1380 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); |
1381 option->Append(Value::CreateBooleanValue(selected)); | 1381 option->Append(Value::CreateBooleanValue(selected)); |
1382 zoom_factors_value.Append(option); | 1382 zoom_factors_value.Append(option); |
1383 } | 1383 } |
1384 | 1384 |
1385 web_ui()->CallJavascriptFunction( | 1385 web_ui()->CallJavascriptFunction( |
1386 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); | 1386 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); |
1387 } | 1387 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 1420 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
1421 } | 1421 } |
1422 StringValue label(label_str); | 1422 StringValue label(label_str); |
1423 | 1423 |
1424 web_ui()->CallJavascriptFunction( | 1424 web_ui()->CallJavascriptFunction( |
1425 "BrowserOptions.setupProxySettingsSection", disabled, label); | 1425 "BrowserOptions.setupProxySettingsSection", disabled, label); |
1426 #endif // !defined(OS_CHROMEOS) | 1426 #endif // !defined(OS_CHROMEOS) |
1427 } | 1427 } |
1428 | 1428 |
1429 } // namespace options | 1429 } // namespace options |
OLD | NEW |