Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 { "accessibilitySelectToSpeak", | 423 { "accessibilitySelectToSpeak", |
| 424 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION }, | 424 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION }, |
| 425 { "accessibilitySettings", | 425 { "accessibilitySettings", |
| 426 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SETTINGS }, | 426 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SETTINGS }, |
| 427 { "accessibilitySpokenFeedback", | 427 { "accessibilitySpokenFeedback", |
| 428 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SPOKEN_FEEDBACK_DESCRIPTION }, | 428 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SPOKEN_FEEDBACK_DESCRIPTION }, |
| 429 { "accessibilityStickyKeys", | 429 { "accessibilityStickyKeys", |
| 430 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_STICKY_KEYS_DESCRIPTION }, | 430 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_STICKY_KEYS_DESCRIPTION }, |
| 431 { "accessibilitySwitchAccess", | 431 { "accessibilitySwitchAccess", |
| 432 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SWITCH_ACCESS_DESCRIPTION }, | 432 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SWITCH_ACCESS_DESCRIPTION }, |
| 433 { "accessibilityTalkBackSettings", | |
| 434 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_TALKBACK_SETTINGS }, | |
| 433 { "accessibilityTapDragging", | 435 { "accessibilityTapDragging", |
| 434 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_TOUCHPAD_TAP_DRAGGING_DESCRIPTION }, | 436 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_TOUCHPAD_TAP_DRAGGING_DESCRIPTION }, |
| 435 { "accessibilityVirtualKeyboard", | 437 { "accessibilityVirtualKeyboard", |
| 436 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION }, | 438 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION }, |
| 437 { "accessibilityMonoAudio", | 439 { "accessibilityMonoAudio", |
| 438 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_MONO_AUDIO_DESCRIPTION}, | 440 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_MONO_AUDIO_DESCRIPTION}, |
| 439 { "androidAppsTitle", IDS_OPTIONS_ARC_TITLE }, | 441 { "androidAppsTitle", IDS_OPTIONS_ARC_TITLE }, |
| 440 { "androidAppsEnabled", IDS_OPTIONS_ARC_ENABLE }, | 442 { "androidAppsEnabled", IDS_OPTIONS_ARC_ENABLE }, |
| 441 { "androidAppsSettingsLabel", IDS_OPTIONS_ARC_MANAGE_APPS }, | 443 { "androidAppsSettingsLabel", IDS_OPTIONS_ARC_MANAGE_APPS }, |
| 442 { "arcOptOutConfirmOverlayTabTitle", IDS_ARC_OPT_OUT_TAB_TITLE }, | 444 { "arcOptOutConfirmOverlayTabTitle", IDS_ARC_OPT_OUT_TAB_TITLE }, |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 base::Bind(&BrowserOptionsHandler::OnPowerwashDialogShow, | 795 base::Bind(&BrowserOptionsHandler::OnPowerwashDialogShow, |
| 794 base::Unretained(this))); | 796 base::Unretained(this))); |
| 795 web_ui()->RegisterMessageCallback( | 797 web_ui()->RegisterMessageCallback( |
| 796 "performFactoryResetRestart", | 798 "performFactoryResetRestart", |
| 797 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, | 799 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, |
| 798 base::Unretained(this))); | 800 base::Unretained(this))); |
| 799 web_ui()->RegisterMessageCallback( | 801 web_ui()->RegisterMessageCallback( |
| 800 "showAndroidAppsSettings", | 802 "showAndroidAppsSettings", |
| 801 base::Bind(&BrowserOptionsHandler::ShowAndroidAppsSettings, | 803 base::Bind(&BrowserOptionsHandler::ShowAndroidAppsSettings, |
| 802 base::Unretained(this))); | 804 base::Unretained(this))); |
| 805 web_ui()->RegisterMessageCallback( | |
| 806 "showAccessibilityTalkBackSettings", | |
| 807 base::Bind(&BrowserOptionsHandler::ShowAccessibilityTalkBackSettings, | |
| 808 base::Unretained(this))); | |
| 803 #else | 809 #else |
| 804 web_ui()->RegisterMessageCallback( | 810 web_ui()->RegisterMessageCallback( |
| 805 "becomeDefaultBrowser", | 811 "becomeDefaultBrowser", |
| 806 base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser, | 812 base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser, |
| 807 base::Unretained(this))); | 813 base::Unretained(this))); |
| 808 web_ui()->RegisterMessageCallback( | 814 web_ui()->RegisterMessageCallback( |
| 809 "restartBrowser", | 815 "restartBrowser", |
| 810 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, | 816 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, |
| 811 base::Unretained(this))); | 817 base::Unretained(this))); |
| 812 web_ui()->RegisterMessageCallback( | 818 web_ui()->RegisterMessageCallback( |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1927 Profile* profile = Profile::FromWebUI(web_ui()); | 1933 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1928 // Settings in secondary profile cannot access ARC. | 1934 // Settings in secondary profile cannot access ARC. |
| 1929 if (!arc::ArcAuthService::IsAllowedForProfile(profile)) { | 1935 if (!arc::ArcAuthService::IsAllowedForProfile(profile)) { |
| 1930 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; | 1936 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; |
| 1931 return; | 1937 return; |
| 1932 } | 1938 } |
| 1933 | 1939 |
| 1934 arc::LaunchAndroidSettingsApp(profile); | 1940 arc::LaunchAndroidSettingsApp(profile); |
| 1935 } | 1941 } |
| 1936 | 1942 |
| 1943 void BrowserOptionsHandler::ShowAccessibilityTalkBackSettings( | |
| 1944 const base::ListValue *args) { | |
| 1945 Profile* profile = Profile::FromWebUI(web_ui()); | |
| 1946 // Settings in secondary profile cannot access ARC. | |
| 1947 if (!arc::ArcAuthService::IsAllowedForProfile(profile)) { | |
| 1948 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; | |
|
stevenjb
2016/08/08 22:41:03
Can this legitimately happen? If so it should just
yhanada
2016/08/09 06:29:40
I changed it to LOG(WARNING). Done.
| |
| 1949 return; | |
| 1950 } | |
| 1951 | |
| 1952 arc::ShowTalkBackSettings(); | |
| 1953 } | |
| 1954 | |
| 1937 void BrowserOptionsHandler::SetupAccessibilityFeatures() { | 1955 void BrowserOptionsHandler::SetupAccessibilityFeatures() { |
| 1938 PrefService* pref_service = g_browser_process->local_state(); | 1956 PrefService* pref_service = g_browser_process->local_state(); |
| 1939 base::FundamentalValue virtual_keyboard_enabled( | 1957 base::FundamentalValue virtual_keyboard_enabled( |
| 1940 pref_service->GetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled)); | 1958 pref_service->GetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled)); |
| 1941 web_ui()->CallJavascriptFunctionUnsafe( | 1959 web_ui()->CallJavascriptFunctionUnsafe( |
| 1942 "BrowserOptions.setVirtualKeyboardCheckboxState", | 1960 "BrowserOptions.setVirtualKeyboardCheckboxState", |
| 1943 virtual_keyboard_enabled); | 1961 virtual_keyboard_enabled); |
| 1944 } | 1962 } |
| 1945 #endif | 1963 #endif |
| 1946 | 1964 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2200 | 2218 |
| 2201 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2219 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2202 #if defined(OS_CHROMEOS) | 2220 #if defined(OS_CHROMEOS) |
| 2203 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2221 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2204 #else | 2222 #else |
| 2205 return true; | 2223 return true; |
| 2206 #endif | 2224 #endif |
| 2207 } | 2225 } |
| 2208 | 2226 |
| 2209 } // namespace options | 2227 } // namespace options |
| OLD | NEW |