| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 116 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 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_auth_service.h" | 126 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 127 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" | 127 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" |
| 128 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 128 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 129 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" | 129 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" |
| 130 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 130 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 131 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 131 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 132 #include "chrome/browser/chromeos/reset/metrics.h" | 132 #include "chrome/browser/chromeos/reset/metrics.h" |
| 133 #include "chrome/browser/chromeos/settings/cros_settings.h" | 133 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 134 #include "chrome/browser/chromeos/system/timezone_util.h" | 134 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 135 #include "chrome/browser/policy/profile_policy_connector.h" | 135 #include "chrome/browser/policy/profile_policy_connector.h" |
| 136 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 136 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | 1156 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 1157 ->policy_service() | 1157 ->policy_service() |
| 1158 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 1158 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
| 1159 std::string())) | 1159 std::string())) |
| 1160 .Get(policy::key::kUserAvatarImage)); | 1160 .Get(policy::key::kUserAvatarImage)); |
| 1161 | 1161 |
| 1162 OnWallpaperManagedChanged( | 1162 OnWallpaperManagedChanged( |
| 1163 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 1163 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
| 1164 user->GetAccountId())); | 1164 user->GetAccountId())); |
| 1165 | 1165 |
| 1166 if (arc::ArcAuthService::IsAllowedForProfile(profile) && | 1166 if (arc::ArcSessionManager::IsAllowedForProfile(profile) && |
| 1167 !arc::ArcAuthService::IsOptInVerificationDisabled()) { | 1167 !arc::ArcSessionManager::IsOptInVerificationDisabled()) { |
| 1168 base::FundamentalValue is_arc_enabled( | 1168 base::FundamentalValue is_arc_enabled( |
| 1169 arc::ArcAuthService::Get()->IsArcEnabled()); | 1169 arc::ArcSessionManager::Get()->IsArcEnabled()); |
| 1170 web_ui()->CallJavascriptFunctionUnsafe( | 1170 web_ui()->CallJavascriptFunctionUnsafe( |
| 1171 "BrowserOptions.showAndroidAppsSection", | 1171 "BrowserOptions.showAndroidAppsSection", |
| 1172 is_arc_enabled); | 1172 is_arc_enabled); |
| 1173 // Get the initial state of Android Settings app readiness. | 1173 // Get the initial state of Android Settings app readiness. |
| 1174 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 1174 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 1175 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); | 1175 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); |
| 1176 if (app_info && app_info->ready) | 1176 if (app_info && app_info->ready) |
| 1177 UpdateAndroidSettingsAppState(app_info->ready); | 1177 UpdateAndroidSettingsAppState(app_info->ready); |
| 1178 } | 1178 } |
| 1179 | 1179 |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 void BrowserOptionsHandler::UpdateAndroidSettingsAppState(bool visible) { | 1996 void BrowserOptionsHandler::UpdateAndroidSettingsAppState(bool visible) { |
| 1997 base::FundamentalValue is_visible(visible); | 1997 base::FundamentalValue is_visible(visible); |
| 1998 web_ui()->CallJavascriptFunctionUnsafe( | 1998 web_ui()->CallJavascriptFunctionUnsafe( |
| 1999 "BrowserOptions.setAndroidAppsSettingsVisibility", is_visible); | 1999 "BrowserOptions.setAndroidAppsSettingsVisibility", is_visible); |
| 2000 } | 2000 } |
| 2001 | 2001 |
| 2002 void BrowserOptionsHandler::ShowAndroidAppsSettings( | 2002 void BrowserOptionsHandler::ShowAndroidAppsSettings( |
| 2003 const base::ListValue* args) { | 2003 const base::ListValue* args) { |
| 2004 Profile* profile = Profile::FromWebUI(web_ui()); | 2004 Profile* profile = Profile::FromWebUI(web_ui()); |
| 2005 // Settings in secondary profile cannot access ARC. | 2005 // Settings in secondary profile cannot access ARC. |
| 2006 if (!arc::ArcAuthService::IsAllowedForProfile(profile)) { | 2006 if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { |
| 2007 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; | 2007 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; |
| 2008 return; | 2008 return; |
| 2009 } | 2009 } |
| 2010 | 2010 |
| 2011 arc::LaunchAndroidSettingsApp(profile); | 2011 arc::LaunchAndroidSettingsApp(profile); |
| 2012 } | 2012 } |
| 2013 | 2013 |
| 2014 void BrowserOptionsHandler::ShowAccessibilityTalkBackSettings( | 2014 void BrowserOptionsHandler::ShowAccessibilityTalkBackSettings( |
| 2015 const base::ListValue *args) { | 2015 const base::ListValue *args) { |
| 2016 Profile* profile = Profile::FromWebUI(web_ui()); | 2016 Profile* profile = Profile::FromWebUI(web_ui()); |
| 2017 // Settings in secondary profile cannot access ARC. | 2017 // Settings in secondary profile cannot access ARC. |
| 2018 if (!arc::ArcAuthService::IsAllowedForProfile(profile)) { | 2018 if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { |
| 2019 LOG(WARNING) << "Settings can't be invoked for non-primary profile"; | 2019 LOG(WARNING) << "Settings can't be invoked for non-primary profile"; |
| 2020 return; | 2020 return; |
| 2021 } | 2021 } |
| 2022 | 2022 |
| 2023 arc::ShowTalkBackSettings(); | 2023 arc::ShowTalkBackSettings(); |
| 2024 } | 2024 } |
| 2025 | 2025 |
| 2026 void BrowserOptionsHandler::SetupAccessibilityFeatures() { | 2026 void BrowserOptionsHandler::SetupAccessibilityFeatures() { |
| 2027 PrefService* pref_service = g_browser_process->local_state(); | 2027 PrefService* pref_service = g_browser_process->local_state(); |
| 2028 base::FundamentalValue virtual_keyboard_enabled( | 2028 base::FundamentalValue virtual_keyboard_enabled( |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2290 | 2290 |
| 2291 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2291 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2292 #if defined(OS_CHROMEOS) | 2292 #if defined(OS_CHROMEOS) |
| 2293 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2293 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2294 #else | 2294 #else |
| 2295 return true; | 2295 return true; |
| 2296 #endif | 2296 #endif |
| 2297 } | 2297 } |
| 2298 | 2298 |
| 2299 } // namespace options | 2299 } // namespace options |
| OLD | NEW |