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

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

Issue 10915140: Add the partial screen magnifier to Chrome OS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove pure virtual interface Created 8 years, 2 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 "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 using content::BrowserContext; 107 using content::BrowserContext;
108 using content::BrowserThread; 108 using content::BrowserThread;
109 using content::DownloadManager; 109 using content::DownloadManager;
110 using content::OpenURLParams; 110 using content::OpenURLParams;
111 using content::Referrer; 111 using content::Referrer;
112 using content::UserMetricsAction; 112 using content::UserMetricsAction;
113 113
114 namespace options { 114 namespace options {
115 115
116 namespace {
117 const char kScreenMagnifierOff[] = "off";
118 const char kScreenMagnifierFull[] = "full";
119 const char kScreenMagnifierPartial[] = "partial";
120 }
121
116 BrowserOptionsHandler::BrowserOptionsHandler() 122 BrowserOptionsHandler::BrowserOptionsHandler()
117 : template_url_service_(NULL), 123 : template_url_service_(NULL),
118 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_file_(this)), 124 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_file_(this)),
119 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_ui_(this)) { 125 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_ui_(this)) {
120 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled(); 126 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled();
121 #if !defined(OS_MACOSX) 127 #if !defined(OS_MACOSX)
122 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); 128 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this);
123 #endif 129 #endif
124 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) 130 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN))
125 // On Windows, we need the PDF plugin which is only guaranteed to exist on 131 // On Windows, we need the PDF plugin which is only guaranteed to exist on
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 { "themesSetClassic", IDS_THEMES_SET_CLASSIC }, 282 { "themesSetClassic", IDS_THEMES_SET_CLASSIC },
277 #else 283 #else
278 { "themes", IDS_THEMES_GROUP_NAME }, 284 { "themes", IDS_THEMES_GROUP_NAME },
279 { "themesReset", IDS_THEMES_RESET_BUTTON }, 285 { "themesReset", IDS_THEMES_RESET_BUTTON },
280 #endif 286 #endif
281 #if defined(OS_CHROMEOS) 287 #if defined(OS_CHROMEOS)
282 { "accessibilityHighContrast", 288 { "accessibilityHighContrast",
283 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_HIGH_CONTRAST_DESCRIPTION }, 289 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_HIGH_CONTRAST_DESCRIPTION },
284 { "accessibilityScreenMagnifier", 290 { "accessibilityScreenMagnifier",
285 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_DESCRIPTION }, 291 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_DESCRIPTION },
292 { "accessibilityScreenMagnifierOff",
293 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_OFF },
294 { "accessibilityScreenMagnifierFull",
295 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_FULL },
296 { "accessibilityScreenMagnifierPartial",
297 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_PARTIAL },
286 { "accessibilitySpokenFeedback", 298 { "accessibilitySpokenFeedback",
287 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION }, 299 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION },
288 { "accessibilityTitle", 300 { "accessibilityTitle",
289 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY }, 301 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY },
290 { "accessibilityVirtualKeyboard", 302 { "accessibilityVirtualKeyboard",
291 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION }, 303 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION },
292 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, 304 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET },
293 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, 305 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON },
294 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, 306 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON },
295 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE_CAPTION }, 307 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE_CAPTION },
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 1256
1245 void BrowserOptionsHandler::HighContrastChangeCallback(const ListValue* args) { 1257 void BrowserOptionsHandler::HighContrastChangeCallback(const ListValue* args) {
1246 bool enabled = false; 1258 bool enabled = false;
1247 args->GetBoolean(0, &enabled); 1259 args->GetBoolean(0, &enabled);
1248 1260
1249 chromeos::accessibility::EnableHighContrast(enabled); 1261 chromeos::accessibility::EnableHighContrast(enabled);
1250 } 1262 }
1251 1263
1252 void BrowserOptionsHandler::ScreenMagnifierChangeCallback( 1264 void BrowserOptionsHandler::ScreenMagnifierChangeCallback(
1253 const ListValue* args) { 1265 const ListValue* args) {
1254 bool enabled = false; 1266 std::string type_name;
1255 args->GetBoolean(0, &enabled); 1267 args->GetString(0, &type_name);
1256 1268
1257 chromeos::accessibility::EnableScreenMagnifier(enabled); 1269 chromeos::accessibility::ScreenMagnifierType type =
1270 chromeos::accessibility::MagnifierNone;
1271
1272 if (type_name == kScreenMagnifierFull)
1273 type = chromeos::accessibility::MagnifierFull;
1274 else if (type_name == kScreenMagnifierPartial)
1275 type = chromeos::accessibility::MagnifierPartial;
1276
1277 chromeos::accessibility::SetScreenMagnifier(type);
1258 } 1278 }
1259 1279
1260 void BrowserOptionsHandler::VirtualKeyboardChangeCallback( 1280 void BrowserOptionsHandler::VirtualKeyboardChangeCallback(
1261 const ListValue* args) { 1281 const ListValue* args) {
1262 bool enabled = false; 1282 bool enabled = false;
1263 args->GetBoolean(0, &enabled); 1283 args->GetBoolean(0, &enabled);
1264 1284
1265 chromeos::accessibility::EnableVirtualKeyboard(enabled); 1285 chromeos::accessibility::EnableVirtualKeyboard(enabled);
1266 } 1286 }
1267 1287
(...skipping 19 matching lines...) Expand all
1287 base::FundamentalValue spoken_feedback_enabled( 1307 base::FundamentalValue spoken_feedback_enabled(
1288 pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled)); 1308 pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled));
1289 web_ui()->CallJavascriptFunction( 1309 web_ui()->CallJavascriptFunction(
1290 "BrowserOptions.setSpokenFeedbackCheckboxState", 1310 "BrowserOptions.setSpokenFeedbackCheckboxState",
1291 spoken_feedback_enabled); 1311 spoken_feedback_enabled);
1292 base::FundamentalValue high_contrast_enabled( 1312 base::FundamentalValue high_contrast_enabled(
1293 pref_service->GetBoolean(prefs::kHighContrastEnabled)); 1313 pref_service->GetBoolean(prefs::kHighContrastEnabled));
1294 web_ui()->CallJavascriptFunction( 1314 web_ui()->CallJavascriptFunction(
1295 "BrowserOptions.setHighContrastCheckboxState", 1315 "BrowserOptions.setHighContrastCheckboxState",
1296 high_contrast_enabled); 1316 high_contrast_enabled);
1297 base::FundamentalValue screen_magnifier_enabled( 1317
1298 pref_service->GetBoolean(prefs::kScreenMagnifierEnabled)); 1318 std::string type(kScreenMagnifierOff);
1319 if (pref_service->GetBoolean(prefs::kScreenMagnifierEnabled))
1320 type = kScreenMagnifierFull;
1321 else if (pref_service->GetBoolean(prefs::kPartialScreenMagnifierEnabled))
1322 type = kScreenMagnifierPartial;
1323
1324 base::StringValue magnifier_type(type);
1299 web_ui()->CallJavascriptFunction( 1325 web_ui()->CallJavascriptFunction(
1300 "BrowserOptions.setScreenMagnifierCheckboxState", 1326 "BrowserOptions.setScreenMagnifierTypeState",
1301 screen_magnifier_enabled); 1327 magnifier_type);
1328
1302 base::FundamentalValue virtual_keyboard_enabled( 1329 base::FundamentalValue virtual_keyboard_enabled(
1303 pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled)); 1330 pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled));
1304 web_ui()->CallJavascriptFunction( 1331 web_ui()->CallJavascriptFunction(
1305 "BrowserOptions.setVirtualKeyboardCheckboxState", 1332 "BrowserOptions.setVirtualKeyboardCheckboxState",
1306 virtual_keyboard_enabled); 1333 virtual_keyboard_enabled);
1307 } 1334 }
1308 #endif 1335 #endif
1309 1336
1310 void BrowserOptionsHandler::SetupMetricsReportingSettingVisibility() { 1337 void BrowserOptionsHandler::SetupMetricsReportingSettingVisibility() {
1311 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_CHROMEOS) 1338 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_CHROMEOS)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 1428 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
1402 } 1429 }
1403 StringValue label(label_str); 1430 StringValue label(label_str);
1404 1431
1405 web_ui()->CallJavascriptFunction( 1432 web_ui()->CallJavascriptFunction(
1406 "BrowserOptions.setupProxySettingsSection", disabled, label); 1433 "BrowserOptions.setupProxySettingsSection", disabled, label);
1407 #endif // !defined(OS_CHROMEOS) 1434 #endif // !defined(OS_CHROMEOS)
1408 } 1435 }
1409 1436
1410 } // namespace options 1437 } // namespace options
OLDNEW
« ash/shell.h ('K') | « chrome/browser/ui/ash/ash_init.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698