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

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

Issue 405383002: The consumer management enroll and unenroll buttons should only be visible to the device owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/app_window.h" 10 #include "apps/app_window.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #include "ash/shell.h" 105 #include "ash/shell.h"
106 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 106 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
107 #include "chrome/browser/chromeos/chromeos_utils.h" 107 #include "chrome/browser/chromeos/chromeos_utils.h"
108 #include "chrome/browser/chromeos/login/users/user.h" 108 #include "chrome/browser/chromeos/login/users/user.h"
109 #include "chrome/browser/chromeos/login/users/user_manager.h" 109 #include "chrome/browser/chromeos/login/users/user_manager.h"
110 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 110 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
111 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 111 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
112 #include "chrome/browser/chromeos/profiles/profile_helper.h" 112 #include "chrome/browser/chromeos/profiles/profile_helper.h"
113 #include "chrome/browser/chromeos/reset/metrics.h" 113 #include "chrome/browser/chromeos/reset/metrics.h"
114 #include "chrome/browser/chromeos/settings/cros_settings.h" 114 #include "chrome/browser/chromeos/settings/cros_settings.h"
115 #include "chrome/browser/chromeos/settings/device_settings_service.h"
115 #include "chrome/browser/chromeos/system/timezone_util.h" 116 #include "chrome/browser/chromeos/system/timezone_util.h"
116 #include "chrome/browser/policy/profile_policy_connector.h" 117 #include "chrome/browser/policy/profile_policy_connector.h"
117 #include "chrome/browser/policy/profile_policy_connector_factory.h" 118 #include "chrome/browser/policy/profile_policy_connector_factory.h"
118 #include "chrome/browser/ui/browser_window.h" 119 #include "chrome/browser/ui/browser_window.h"
119 #include "chromeos/dbus/dbus_thread_manager.h" 120 #include "chromeos/dbus/dbus_thread_manager.h"
120 #include "chromeos/dbus/power_manager_client.h" 121 #include "chromeos/dbus/power_manager_client.h"
121 #include "components/policy/core/common/policy_map.h" 122 #include "components/policy/core/common/policy_map.h"
122 #include "components/policy/core/common/policy_namespace.h" 123 #include "components/policy/core/common/policy_namespace.h"
123 #include "components/policy/core/common/policy_service.h" 124 #include "components/policy/core/common/policy_service.h"
124 #include "policy/policy_constants.h" 125 #include "policy/policy_constants.h"
126 #include "policy/proto/device_management_backend.pb.h"
125 #include "ui/gfx/image/image_skia.h" 127 #include "ui/gfx/image/image_skia.h"
126 #endif // defined(OS_CHROMEOS) 128 #endif // defined(OS_CHROMEOS)
127 129
128 #if defined(OS_WIN) 130 #if defined(OS_WIN)
129 #include "chrome/browser/extensions/settings_api_helpers.h" 131 #include "chrome/browser/extensions/settings_api_helpers.h"
130 #include "chrome/installer/util/auto_launch_util.h" 132 #include "chrome/installer/util/auto_launch_util.h"
131 #include "content/public/browser/browser_url_handler.h" 133 #include "content/public/browser/browser_url_handler.h"
132 #endif // defined(OS_WIN) 134 #endif // defined(OS_WIN)
133 135
134 #if defined(ENABLE_SERVICE_DISCOVERY) 136 #if defined(ENABLE_SERVICE_DISCOVERY)
135 #include "chrome/browser/local_discovery/privet_notifications.h" 137 #include "chrome/browser/local_discovery/privet_notifications.h"
136 #endif 138 #endif
137 139
138 using base::UserMetricsAction; 140 using base::UserMetricsAction;
139 using content::BrowserContext; 141 using content::BrowserContext;
140 using content::BrowserThread; 142 using content::BrowserThread;
141 using content::DownloadManager; 143 using content::DownloadManager;
142 using content::OpenURLParams; 144 using content::OpenURLParams;
143 using content::Referrer; 145 using content::Referrer;
144 using extensions::Extension; 146 using extensions::Extension;
145 using extensions::ExtensionRegistry; 147 using extensions::ExtensionRegistry;
146 148
149 namespace em = enterprise_management;
150
147 namespace { 151 namespace {
148 152
149 #if defined(OS_WIN) 153 #if defined(OS_WIN)
150 void AppendExtensionData(const std::string& key, 154 void AppendExtensionData(const std::string& key,
151 const Extension* extension, 155 const Extension* extension,
152 base::DictionaryValue* dict) { 156 base::DictionaryValue* dict) {
153 scoped_ptr<base::DictionaryValue> details(new base::DictionaryValue); 157 scoped_ptr<base::DictionaryValue> details(new base::DictionaryValue);
154 details->SetString("id", extension ? extension->id() : std::string()); 158 details->SetString("id", extension ? extension->id() : std::string());
155 details->SetString("name", extension ? extension->name() : std::string()); 159 details->SetString("name", extension ? extension->name() : std::string());
156 dict->Set(key, details.release()); 160 dict->Set(key, details.release());
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 values->SetString("easyUnlockCheckboxLabel", 609 values->SetString("easyUnlockCheckboxLabel",
606 l10n_util::GetStringFUTF16( 610 l10n_util::GetStringFUTF16(
607 IDS_OPTIONS_EASY_UNLOCK_CHECKBOX_LABEL_CHROMEOS, 611 IDS_OPTIONS_EASY_UNLOCK_CHECKBOX_LABEL_CHROMEOS,
608 chromeos::GetChromeDeviceType())); 612 chromeos::GetChromeDeviceType()));
609 613
610 values->SetBoolean( 614 values->SetBoolean(
611 "consumerManagementEnabled", 615 "consumerManagementEnabled",
612 CommandLine::ForCurrentProcess()->HasSwitch( 616 CommandLine::ForCurrentProcess()->HasSwitch(
613 chromeos::switches::kEnableConsumerManagement)); 617 chromeos::switches::kEnableConsumerManagement));
614 618
619 const em::PolicyData* policy_data =
bartfab (slow) 2014/07/23 19:27:13 Nit: Un-indent one space.
davidyu 2014/07/24 04:28:30 Done.
620 chromeos::DeviceSettingsService::Get()->policy_data();
bartfab (slow) 2014/07/23 19:27:13 Nit: Un-indent one space.
davidyu 2014/07/24 04:28:30 Done.
621 values->SetBoolean(
622 "consumerManagementEnrolled",
623 policy_data &&
624 policy_data->management_mode() == em::PolicyData::CONSUMER_MANAGED);
625
615 RegisterTitle(values, "thirdPartyImeConfirmOverlay", 626 RegisterTitle(values, "thirdPartyImeConfirmOverlay",
616 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); 627 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE);
617 #endif 628 #endif
618 629
619 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); 630 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser());
620 631
621 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); 632 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings());
622 633
623 values->SetBoolean("websiteSettingsManagerEnabled", 634 values->SetBoolean("websiteSettingsManagerEnabled",
624 CommandLine::ForCurrentProcess()->HasSwitch( 635 CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 extension = extensions::GetExtensionOverridingProxy( 1816 extension = extensions::GetExtensionOverridingProxy(
1806 Profile::FromWebUI(web_ui())); 1817 Profile::FromWebUI(web_ui()));
1807 AppendExtensionData("proxy", extension, &extension_controlled); 1818 AppendExtensionData("proxy", extension, &extension_controlled);
1808 1819
1809 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1820 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1810 extension_controlled); 1821 extension_controlled);
1811 #endif // defined(OS_WIN) 1822 #endif // defined(OS_WIN)
1812 } 1823 }
1813 1824
1814 } // namespace options 1825 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698