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

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

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on ToT (solved merging conflict). Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/system_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/system_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/json/json_value_serializer.h" 13 #include "base/json/json_value_serializer.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chromeos/accessibility_util.h" 19 #include "chrome/browser/chromeos/accessibility_util.h"
20 #include "chrome/browser/chromeos/cros_settings.h"
20 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 21 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
21 #include "chrome/browser/chromeos/dbus/power_manager_client.h" 22 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
22 #include "chrome/browser/chromeos/language_preferences.h" 23 #include "chrome/browser/chromeos/language_preferences.h"
23 #include "chrome/browser/chromeos/system/touchpad_settings.h" 24 #include "chrome/browser/chromeos/system/touchpad_settings.h"
24 #include "chrome/browser/extensions/extension_service.h" 25 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/prefs/pref_service.h" 26 #include "chrome/browser/prefs/pref_service.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h" 28 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
30 #include "chrome/common/extensions/extension.h" 31 #include "chrome/common/extensions/extension.h"
31 #include "grit/browser_resources.h" 32 #include "grit/browser_resources.h"
32 #include "grit/chromium_strings.h" 33 #include "grit/chromium_strings.h"
33 #include "grit/generated_resources.h" 34 #include "grit/generated_resources.h"
34 #include "grit/locale_settings.h" 35 #include "grit/locale_settings.h"
35 #include "grit/theme_resources.h" 36 #include "grit/theme_resources.h"
36 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/resource/resource_bundle.h" 38 #include "ui/base/resource/resource_bundle.h"
38 39
39 using content::BrowserThread; 40 using content::BrowserThread;
40 41
41 namespace { 42 namespace {
42 43
43 void TouchpadExistsFileThread(bool* exists) { 44 void TouchpadExistsFileThread(bool* exists) {
44 *exists = chromeos::system::touchpad_settings::TouchpadExists(); 45 *exists = chromeos::system::touchpad_settings::TouchpadExists();
45 } 46 }
46 47
47 } 48 }
48 49
49 SystemOptionsHandler::SystemOptionsHandler() 50 SystemOptionsHandler::SystemOptionsHandler() {
50 : chromeos::CrosOptionsPageUIHandler(
51 new chromeos::SystemSettingsProvider()) {
52 } 51 }
53 52
54 SystemOptionsHandler::~SystemOptionsHandler() { 53 SystemOptionsHandler::~SystemOptionsHandler() {
55 } 54 }
56 55
57 void SystemOptionsHandler::GetLocalizedValues( 56 void SystemOptionsHandler::GetLocalizedValues(
58 DictionaryValue* localized_strings) { 57 DictionaryValue* localized_strings) {
59 DCHECK(localized_strings); 58 DCHECK(localized_strings);
60 59
61 RegisterTitle(localized_strings, "systemPage", IDS_OPTIONS_SYSTEM_TAB_LABEL); 60 RegisterTitle(localized_strings, "systemPage", IDS_OPTIONS_SYSTEM_TAB_LABEL);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 l10n_util::GetStringUTF16( 97 l10n_util::GetStringUTF16(
99 IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE)); 98 IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE));
100 99
101 localized_strings->SetString("accessibilityTitle", 100 localized_strings->SetString("accessibilityTitle",
102 l10n_util::GetStringUTF16( 101 l10n_util::GetStringUTF16(
103 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); 102 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY));
104 localized_strings->SetString("accessibility", 103 localized_strings->SetString("accessibility",
105 l10n_util::GetStringUTF16( 104 l10n_util::GetStringUTF16(
106 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); 105 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION));
107 106
107 // TODO(pastarmovj): replace this with a call to the CrosSettings list
108 // handling functionality to come.
108 localized_strings->Set("timezoneList", 109 localized_strings->Set("timezoneList",
109 reinterpret_cast<chromeos::SystemSettingsProvider*>( 110 static_cast<chromeos::SystemSettingsProvider*>(
110 settings_provider_.get())->GetTimezoneList()); 111 chromeos::CrosSettings::Get()->GetProvider(
112 chromeos::kSystemTimezone))->GetTimezoneList());
111 } 113 }
112 114
113 void SystemOptionsHandler::Initialize() { 115 void SystemOptionsHandler::Initialize() {
114 DCHECK(web_ui_); 116 DCHECK(web_ui_);
115 PrefService* pref_service = g_browser_process->local_state(); 117 PrefService* pref_service = g_browser_process->local_state();
116 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled); 118 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled);
117 base::FundamentalValue checked(acc_enabled); 119 base::FundamentalValue checked(acc_enabled);
118 web_ui_->CallJavascriptFunction( 120 web_ui_->CallJavascriptFunction(
119 "options.SystemOptions.SetAccessibilityCheckboxState", checked); 121 "options.SystemOptions.SetAccessibilityCheckboxState", checked);
120 122
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // can make it very difficult to see the increase brightness button. 161 // can make it very difficult to see the increase brightness button.
160 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 162 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
161 DecreaseScreenBrightness(false); 163 DecreaseScreenBrightness(false);
162 } 164 }
163 165
164 void SystemOptionsHandler::IncreaseScreenBrightnessCallback( 166 void SystemOptionsHandler::IncreaseScreenBrightnessCallback(
165 const ListValue* args) { 167 const ListValue* args) {
166 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 168 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
167 IncreaseScreenBrightness(); 169 IncreaseScreenBrightness();
168 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698