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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

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

Powered by Google App Engine
This is Rietveld 408576698