| 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | 1134 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 1135 ->policy_service() | 1135 ->policy_service() |
| 1136 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 1136 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
| 1137 std::string())) | 1137 std::string())) |
| 1138 .Get(policy::key::kUserAvatarImage)); | 1138 .Get(policy::key::kUserAvatarImage)); |
| 1139 | 1139 |
| 1140 OnWallpaperManagedChanged( | 1140 OnWallpaperManagedChanged( |
| 1141 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 1141 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
| 1142 user->GetAccountId())); | 1142 user->GetAccountId())); |
| 1143 | 1143 |
| 1144 if (arc::ArcAuthService::IsAllowedForProfile(profile) && | 1144 if (arc::ArcSessionManager::IsAllowedForProfile(profile) && |
| 1145 !arc::ArcAuthService::IsOptInVerificationDisabled()) { | 1145 !arc::ArcSessionManager::IsOptInVerificationDisabled()) { |
| 1146 base::FundamentalValue is_arc_enabled( | 1146 base::FundamentalValue is_arc_enabled( |
| 1147 arc::ArcAuthService::Get()->IsArcEnabled()); | 1147 arc::ArcSessionManager::Get()->IsArcEnabled()); |
| 1148 web_ui()->CallJavascriptFunctionUnsafe( | 1148 web_ui()->CallJavascriptFunctionUnsafe( |
| 1149 "BrowserOptions.showAndroidAppsSection", | 1149 "BrowserOptions.showAndroidAppsSection", |
| 1150 is_arc_enabled); | 1150 is_arc_enabled); |
| 1151 // Get the initial state of Android Settings app readiness. | 1151 // Get the initial state of Android Settings app readiness. |
| 1152 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 1152 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 1153 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); | 1153 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); |
| 1154 if (app_info && app_info->ready) | 1154 if (app_info && app_info->ready) |
| 1155 UpdateAndroidSettingsAppState(app_info->ready); | 1155 UpdateAndroidSettingsAppState(app_info->ready); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 void BrowserOptionsHandler::UpdateAndroidSettingsAppState(bool visible) { | 1976 void BrowserOptionsHandler::UpdateAndroidSettingsAppState(bool visible) { |
| 1977 base::FundamentalValue is_visible(visible); | 1977 base::FundamentalValue is_visible(visible); |
| 1978 web_ui()->CallJavascriptFunctionUnsafe( | 1978 web_ui()->CallJavascriptFunctionUnsafe( |
| 1979 "BrowserOptions.setAndroidAppsSettingsVisibility", is_visible); | 1979 "BrowserOptions.setAndroidAppsSettingsVisibility", is_visible); |
| 1980 } | 1980 } |
| 1981 | 1981 |
| 1982 void BrowserOptionsHandler::ShowAndroidAppsSettings( | 1982 void BrowserOptionsHandler::ShowAndroidAppsSettings( |
| 1983 const base::ListValue* args) { | 1983 const base::ListValue* args) { |
| 1984 Profile* profile = Profile::FromWebUI(web_ui()); | 1984 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1985 // Settings in secondary profile cannot access ARC. | 1985 // Settings in secondary profile cannot access ARC. |
| 1986 if (!arc::ArcAuthService::IsAllowedForProfile(profile)) { | 1986 if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { |
| 1987 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; | 1987 LOG(ERROR) << "Settings can't be invoked for non-primary profile"; |
| 1988 return; | 1988 return; |
| 1989 } | 1989 } |
| 1990 | 1990 |
| 1991 arc::LaunchAndroidSettingsApp(profile); | 1991 arc::LaunchAndroidSettingsApp(profile); |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 void BrowserOptionsHandler::ShowAccessibilityTalkBackSettings( | 1994 void BrowserOptionsHandler::ShowAccessibilityTalkBackSettings( |
| 1995 const base::ListValue *args) { | 1995 const base::ListValue *args) { |
| 1996 Profile* profile = Profile::FromWebUI(web_ui()); | 1996 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1997 // Settings in secondary profile cannot access ARC. | 1997 // Settings in secondary profile cannot access ARC. |
| 1998 if (!arc::ArcAuthService::IsAllowedForProfile(profile)) { | 1998 if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { |
| 1999 LOG(WARNING) << "Settings can't be invoked for non-primary profile"; | 1999 LOG(WARNING) << "Settings can't be invoked for non-primary profile"; |
| 2000 return; | 2000 return; |
| 2001 } | 2001 } |
| 2002 | 2002 |
| 2003 arc::ShowTalkBackSettings(); | 2003 arc::ShowTalkBackSettings(); |
| 2004 } | 2004 } |
| 2005 | 2005 |
| 2006 void BrowserOptionsHandler::SetupAccessibilityFeatures() { | 2006 void BrowserOptionsHandler::SetupAccessibilityFeatures() { |
| 2007 PrefService* pref_service = g_browser_process->local_state(); | 2007 PrefService* pref_service = g_browser_process->local_state(); |
| 2008 base::FundamentalValue virtual_keyboard_enabled( | 2008 base::FundamentalValue virtual_keyboard_enabled( |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 | 2269 |
| 2270 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2270 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2271 #if defined(OS_CHROMEOS) | 2271 #if defined(OS_CHROMEOS) |
| 2272 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2272 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2273 #else | 2273 #else |
| 2274 return true; | 2274 return true; |
| 2275 #endif | 2275 #endif |
| 2276 } | 2276 } |
| 2277 | 2277 |
| 2278 } // namespace options | 2278 } // namespace options |
| OLD | NEW |