| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 #include "chrome/browser/ui/webui/settings_utils.h" | 117 #include "chrome/browser/ui/webui/settings_utils.h" |
| 118 #endif | 118 #endif |
| 119 | 119 |
| 120 #if defined(OS_CHROMEOS) | 120 #if defined(OS_CHROMEOS) |
| 121 #include "ash/common/accessibility_types.h" // nogncheck | 121 #include "ash/common/accessibility_types.h" // nogncheck |
| 122 #include "ash/common/system/chromeos/devicetype_utils.h" // nogncheck | 122 #include "ash/common/system/chromeos/devicetype_utils.h" // nogncheck |
| 123 #include "ash/shell.h" // nogncheck | 123 #include "ash/shell.h" // nogncheck |
| 124 #include "chrome/browser/browser_process_platform_part.h" | 124 #include "chrome/browser/browser_process_platform_part.h" |
| 125 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 125 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 126 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 126 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 127 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 127 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" | 128 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" |
| 128 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 129 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 129 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" | 130 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" |
| 130 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 131 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 131 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 132 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 132 #include "chrome/browser/chromeos/reset/metrics.h" | 133 #include "chrome/browser/chromeos/reset/metrics.h" |
| 133 #include "chrome/browser/chromeos/settings/cros_settings.h" | 134 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 134 #include "chrome/browser/chromeos/system/timezone_util.h" | 135 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 135 #include "chrome/browser/policy/profile_policy_connector.h" | 136 #include "chrome/browser/policy/profile_policy_connector.h" |
| 136 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 137 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 137 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 138 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 138 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 139 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 139 #include "chrome/browser/ui/browser_window.h" | 140 #include "chrome/browser/ui/browser_window.h" |
| 140 #include "chromeos/chromeos_switches.h" | 141 #include "chromeos/chromeos_switches.h" |
| 141 #include "chromeos/dbus/dbus_thread_manager.h" | 142 #include "chromeos/dbus/dbus_thread_manager.h" |
| 142 #include "chromeos/dbus/power_manager_client.h" | 143 #include "chromeos/dbus/power_manager_client.h" |
| 143 #include "components/arc/arc_bridge_service.h" | 144 #include "components/arc/arc_util.h" |
| 144 #include "components/user_manager/user.h" | 145 #include "components/user_manager/user.h" |
| 145 #include "components/user_manager/user_manager.h" | 146 #include "components/user_manager/user_manager.h" |
| 146 #include "ui/gfx/image/image_skia.h" | 147 #include "ui/gfx/image/image_skia.h" |
| 147 #endif // defined(OS_CHROMEOS) | 148 #endif // defined(OS_CHROMEOS) |
| 148 | 149 |
| 149 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 150 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
| 150 #include "chrome/browser/printing/cloud_print/privet_notifications.h" | 151 #include "chrome/browser/printing/cloud_print/privet_notifications.h" |
| 151 #endif | 152 #endif |
| 152 | 153 |
| 153 #if defined(USE_ASH) | 154 #if defined(USE_ASH) |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | 1160 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 1160 ->policy_service() | 1161 ->policy_service() |
| 1161 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 1162 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
| 1162 std::string())) | 1163 std::string())) |
| 1163 .Get(policy::key::kUserAvatarImage)); | 1164 .Get(policy::key::kUserAvatarImage)); |
| 1164 | 1165 |
| 1165 OnWallpaperManagedChanged( | 1166 OnWallpaperManagedChanged( |
| 1166 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 1167 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
| 1167 user->GetAccountId())); | 1168 user->GetAccountId())); |
| 1168 | 1169 |
| 1169 if (arc::ArcSessionManager::IsAllowedForProfile(profile) && | 1170 if (arc::IsArcAllowedForProfile(profile) && |
| 1170 !arc::ArcSessionManager::IsOptInVerificationDisabled()) { | 1171 !arc::IsArcOptInVerificationDisabled()) { |
| 1171 base::FundamentalValue is_arc_enabled( | 1172 base::FundamentalValue is_arc_enabled( |
| 1172 arc::ArcSessionManager::Get()->IsArcEnabled()); | 1173 arc::ArcSessionManager::Get()->IsArcEnabled()); |
| 1173 web_ui()->CallJavascriptFunctionUnsafe( | 1174 web_ui()->CallJavascriptFunctionUnsafe( |
| 1174 "BrowserOptions.showAndroidAppsSection", | 1175 "BrowserOptions.showAndroidAppsSection", |
| 1175 is_arc_enabled); | 1176 is_arc_enabled); |
| 1176 // Get the initial state of Android Settings app readiness. | 1177 // Get the initial state of Android Settings app readiness. |
| 1177 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 1178 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 1178 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); | 1179 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); |
| 1179 if (app_info && app_info->ready) | 1180 if (app_info && app_info->ready) |
| 1180 UpdateAndroidSettingsAppState(app_info->ready); | 1181 UpdateAndroidSettingsAppState(app_info->ready); |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 void BrowserOptionsHandler::UpdateAndroidSettingsAppState(bool visible) { | 1999 void BrowserOptionsHandler::UpdateAndroidSettingsAppState(bool visible) { |
| 1999 base::FundamentalValue is_visible(visible); | 2000 base::FundamentalValue is_visible(visible); |
| 2000 web_ui()->CallJavascriptFunctionUnsafe( | 2001 web_ui()->CallJavascriptFunctionUnsafe( |
| 2001 "BrowserOptions.setAndroidAppsSettingsVisibility", is_visible); | 2002 "BrowserOptions.setAndroidAppsSettingsVisibility", is_visible); |
| 2002 } | 2003 } |
| 2003 | 2004 |
| 2004 void BrowserOptionsHandler::ShowAndroidAppsSettings( | 2005 void BrowserOptionsHandler::ShowAndroidAppsSettings( |
| 2005 const base::ListValue* args) { | 2006 const base::ListValue* args) { |
| 2006 Profile* profile = Profile::FromWebUI(web_ui()); | 2007 Profile* profile = Profile::FromWebUI(web_ui()); |
| 2007 // Settings in secondary profile cannot access ARC. | 2008 // Settings in secondary profile cannot access ARC. |
| 2008 if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { | 2009 if (!arc::IsArcAllowedForProfile(profile)) { |
| 2009 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; | 2010 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; |
| 2010 return; | 2011 return; |
| 2011 } | 2012 } |
| 2012 | 2013 |
| 2013 // We only care whether the event came from a keyboard or non-keyboard | 2014 // We only care whether the event came from a keyboard or non-keyboard |
| 2014 // (mouse/touch). Set the default flags in such a way that it would appear | 2015 // (mouse/touch). Set the default flags in such a way that it would appear |
| 2015 // that it came from a mouse by default. | 2016 // that it came from a mouse by default. |
| 2016 bool activated_from_keyboard = false; | 2017 bool activated_from_keyboard = false; |
| 2017 args->GetBoolean(0, &activated_from_keyboard); | 2018 args->GetBoolean(0, &activated_from_keyboard); |
| 2018 int flags = activated_from_keyboard ? ui::EF_NONE : ui::EF_LEFT_MOUSE_BUTTON; | 2019 int flags = activated_from_keyboard ? ui::EF_NONE : ui::EF_LEFT_MOUSE_BUTTON; |
| 2019 | 2020 |
| 2020 arc::LaunchAndroidSettingsApp(profile, flags); | 2021 arc::LaunchAndroidSettingsApp(profile, flags); |
| 2021 } | 2022 } |
| 2022 | 2023 |
| 2023 void BrowserOptionsHandler::ShowAccessibilityTalkBackSettings( | 2024 void BrowserOptionsHandler::ShowAccessibilityTalkBackSettings( |
| 2024 const base::ListValue *args) { | 2025 const base::ListValue *args) { |
| 2025 Profile* profile = Profile::FromWebUI(web_ui()); | 2026 Profile* profile = Profile::FromWebUI(web_ui()); |
| 2026 // Settings in secondary profile cannot access ARC. | 2027 // Settings in secondary profile cannot access ARC. |
| 2027 if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { | 2028 if (!arc::IsArcAllowedForProfile(profile)) { |
| 2028 LOG(WARNING) << "Settings can't be invoked for non-primary profile"; | 2029 LOG(WARNING) << "Settings can't be invoked for non-primary profile"; |
| 2029 return; | 2030 return; |
| 2030 } | 2031 } |
| 2031 | 2032 |
| 2032 arc::ShowTalkBackSettings(); | 2033 arc::ShowTalkBackSettings(); |
| 2033 } | 2034 } |
| 2034 | 2035 |
| 2035 void BrowserOptionsHandler::SetupAccessibilityFeatures() { | 2036 void BrowserOptionsHandler::SetupAccessibilityFeatures() { |
| 2036 PrefService* pref_service = g_browser_process->local_state(); | 2037 PrefService* pref_service = g_browser_process->local_state(); |
| 2037 base::FundamentalValue virtual_keyboard_enabled( | 2038 base::FundamentalValue virtual_keyboard_enabled( |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 | 2301 |
| 2301 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2302 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2302 #if defined(OS_CHROMEOS) | 2303 #if defined(OS_CHROMEOS) |
| 2303 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2304 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2304 #else | 2305 #else |
| 2305 return true; | 2306 return true; |
| 2306 #endif | 2307 #endif |
| 2307 } | 2308 } |
| 2308 | 2309 |
| 2309 } // namespace options | 2310 } // namespace options |
| OLD | NEW |