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

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: Fix preferences. Created 8 years, 3 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 using content::BrowserContext; 102 using content::BrowserContext;
103 using content::BrowserThread; 103 using content::BrowserThread;
104 using content::DownloadManager; 104 using content::DownloadManager;
105 using content::OpenURLParams; 105 using content::OpenURLParams;
106 using content::Referrer; 106 using content::Referrer;
107 using content::UserMetricsAction; 107 using content::UserMetricsAction;
108 108
109 namespace options { 109 namespace options {
110 110
111 namespace {
112 const char kScreenMagnifierOff[] = "off";
113 const char kScreenMagnifierFull[] = "full";
114 const char kScreenMagnifierPartial[] = "partial";
115 }
116
111 BrowserOptionsHandler::BrowserOptionsHandler() 117 BrowserOptionsHandler::BrowserOptionsHandler()
112 : template_url_service_(NULL), 118 : template_url_service_(NULL),
113 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_file_(this)), 119 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_file_(this)),
114 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_ui_(this)) { 120 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_ui_(this)) {
115 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled(); 121 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled();
116 #if !defined(OS_MACOSX) 122 #if !defined(OS_MACOSX)
117 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); 123 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this);
118 #endif 124 #endif
119 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) 125 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN))
120 // On Windows, we need the PDF plugin which is only guaranteed to exist on 126 // On Windows, we need the PDF plugin which is only guaranteed to exist on
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 { "themesSetClassic", IDS_THEMES_SET_CLASSIC }, 276 { "themesSetClassic", IDS_THEMES_SET_CLASSIC },
271 #else 277 #else
272 { "themes", IDS_THEMES_GROUP_NAME }, 278 { "themes", IDS_THEMES_GROUP_NAME },
273 { "themesReset", IDS_THEMES_RESET_BUTTON }, 279 { "themesReset", IDS_THEMES_RESET_BUTTON },
274 #endif 280 #endif
275 #if defined(OS_CHROMEOS) 281 #if defined(OS_CHROMEOS)
276 { "accessibilityHighContrast", 282 { "accessibilityHighContrast",
277 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_HIGH_CONTRAST_DESCRIPTION }, 283 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_HIGH_CONTRAST_DESCRIPTION },
278 { "accessibilityScreenMagnifier", 284 { "accessibilityScreenMagnifier",
279 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_DESCRIPTION }, 285 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_DESCRIPTION },
286 { "accessibilityScreenMagnifierOff",
287 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_OFF },
288 { "accessibilityScreenMagnifierFull",
289 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_FULL },
290 { "accessibilityScreenMagnifierPartial",
291 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_PARTIAL },
280 { "accessibilitySpokenFeedback", 292 { "accessibilitySpokenFeedback",
281 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION }, 293 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION },
282 { "accessibilityTitle", 294 { "accessibilityTitle",
283 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY }, 295 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY },
284 { "accessibilityVirtualKeyboard", 296 { "accessibilityVirtualKeyboard",
285 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION }, 297 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION },
286 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE_CAPTION }, 298 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE_CAPTION },
287 { "datetimeTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME }, 299 { "datetimeTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME },
288 { "deviceGroupDescription", IDS_OPTIONS_DEVICE_GROUP_DESCRIPTION }, 300 { "deviceGroupDescription", IDS_OPTIONS_DEVICE_GROUP_DESCRIPTION },
289 { "deviceGroupPointer", IDS_OPTIONS_DEVICE_GROUP_POINTER_SECTION }, 301 { "deviceGroupPointer", IDS_OPTIONS_DEVICE_GROUP_POINTER_SECTION },
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 1314
1303 void BrowserOptionsHandler::HighContrastChangeCallback(const ListValue* args) { 1315 void BrowserOptionsHandler::HighContrastChangeCallback(const ListValue* args) {
1304 bool enabled = false; 1316 bool enabled = false;
1305 args->GetBoolean(0, &enabled); 1317 args->GetBoolean(0, &enabled);
1306 1318
1307 chromeos::accessibility::EnableHighContrast(enabled); 1319 chromeos::accessibility::EnableHighContrast(enabled);
1308 } 1320 }
1309 1321
1310 void BrowserOptionsHandler::ScreenMagnifierChangeCallback( 1322 void BrowserOptionsHandler::ScreenMagnifierChangeCallback(
1311 const ListValue* args) { 1323 const ListValue* args) {
1312 bool enabled = false; 1324 std::string type_name;
1313 args->GetBoolean(0, &enabled); 1325 args->GetString(0, &type_name);
1314 1326
1315 chromeos::accessibility::EnableScreenMagnifier(enabled); 1327 chromeos::accessibility::ScreenMagnifierType type =
1328 chromeos::accessibility::MagnifierNone;
1329
1330 if (type_name == kScreenMagnifierFull)
1331 type = chromeos::accessibility::MagnifierFull;
1332 else if (type_name == kScreenMagnifierPartial)
1333 type = chromeos::accessibility::MagnifierPartial;
1334
1335 chromeos::accessibility::SetScreenMagnifier(type);
1316 } 1336 }
1317 1337
1318 void BrowserOptionsHandler::VirtualKeyboardChangeCallback( 1338 void BrowserOptionsHandler::VirtualKeyboardChangeCallback(
1319 const ListValue* args) { 1339 const ListValue* args) {
1320 bool enabled = false; 1340 bool enabled = false;
1321 args->GetBoolean(0, &enabled); 1341 args->GetBoolean(0, &enabled);
1322 1342
1323 chromeos::accessibility::EnableVirtualKeyboard(enabled); 1343 chromeos::accessibility::EnableVirtualKeyboard(enabled);
1324 } 1344 }
1325 1345
1326 void BrowserOptionsHandler::SetupAccessibilityFeatures() { 1346 void BrowserOptionsHandler::SetupAccessibilityFeatures() {
1327 PrefService* pref_service = g_browser_process->local_state(); 1347 PrefService* pref_service = g_browser_process->local_state();
1328 base::FundamentalValue spoken_feedback_enabled( 1348 base::FundamentalValue spoken_feedback_enabled(
1329 pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled)); 1349 pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled));
1330 web_ui()->CallJavascriptFunction( 1350 web_ui()->CallJavascriptFunction(
1331 "BrowserOptions.setSpokenFeedbackCheckboxState", 1351 "BrowserOptions.setSpokenFeedbackCheckboxState",
1332 spoken_feedback_enabled); 1352 spoken_feedback_enabled);
1333 base::FundamentalValue high_contrast_enabled( 1353 base::FundamentalValue high_contrast_enabled(
1334 pref_service->GetBoolean(prefs::kHighContrastEnabled)); 1354 pref_service->GetBoolean(prefs::kHighContrastEnabled));
1335 web_ui()->CallJavascriptFunction( 1355 web_ui()->CallJavascriptFunction(
1336 "BrowserOptions.setHighContrastCheckboxState", 1356 "BrowserOptions.setHighContrastCheckboxState",
1337 high_contrast_enabled); 1357 high_contrast_enabled);
1338 base::FundamentalValue screen_magnifier_enabled( 1358
1339 pref_service->GetBoolean(prefs::kScreenMagnifierEnabled)); 1359 std::string type(kScreenMagnifierOff);
1360 if (pref_service->GetBoolean(prefs::kScreenMagnifierEnabled))
1361 type = kScreenMagnifierFull;
1362 else if (pref_service->GetBoolean(prefs::kPartialScreenMagnifierEnabled))
1363 type = kScreenMagnifierPartial;
1364
1340 web_ui()->CallJavascriptFunction( 1365 web_ui()->CallJavascriptFunction(
1341 "BrowserOptions.setScreenMagnifierCheckboxState", 1366 "BrowserOptions.setScreenMagnifierTypeState",
1342 screen_magnifier_enabled); 1367 base::StringValue(type));
1368
1343 base::FundamentalValue virtual_keyboard_enabled( 1369 base::FundamentalValue virtual_keyboard_enabled(
1344 pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled)); 1370 pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled));
1345 web_ui()->CallJavascriptFunction( 1371 web_ui()->CallJavascriptFunction(
1346 "BrowserOptions.setVirtualKeyboardCheckboxState", 1372 "BrowserOptions.setVirtualKeyboardCheckboxState",
1347 virtual_keyboard_enabled); 1373 virtual_keyboard_enabled);
1348 } 1374 }
1349 #endif 1375 #endif
1350 1376
1351 void BrowserOptionsHandler::SetupMetricsReportingCheckbox() { 1377 void BrowserOptionsHandler::SetupMetricsReportingCheckbox() {
1352 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) 1378 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 } 1484 }
1459 1485
1460 void BrowserOptionsHandler::SetupSSLConfigSettings() { 1486 void BrowserOptionsHandler::SetupSSLConfigSettings() {
1461 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); 1487 base::FundamentalValue checked(rev_checking_enabled_.GetValue());
1462 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); 1488 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged());
1463 web_ui()->CallJavascriptFunction( 1489 web_ui()->CallJavascriptFunction(
1464 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); 1490 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled);
1465 } 1491 }
1466 1492
1467 } // namespace options 1493 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698