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

Unified Diff: chrome/browser/policy/browser_policy_connector.cc

Issue 26770002: Report logged in users on enterprise managed devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ran update_policies.py Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/browser_policy_connector.cc
diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc
index 832dc33c087eeac06306c6413f928eacb102d073..a405c31a861cf428f09d6f0cdaba313525195dbc 100644
--- a/chrome/browser/policy/browser_policy_connector.cc
+++ b/chrome/browser/policy/browser_policy_connector.cc
@@ -98,6 +98,11 @@ const int64 kServiceInitializationStartupDelay = 5000;
const char kDefaultDeviceManagementServerUrl[] =
"https://m.google.com/devicemanagement/data/api";
+#if defined(OS_CHROMEOS)
+// Install attributes for tests.
+EnterpriseInstallAttributes* g_testing_install_attributes = NULL;
+#endif // defined(OS_CHROMEOS)
+
// Used in BrowserPolicyConnector::SetPolicyProviderForTesting.
ConfigurationPolicyProvider* g_testing_provider = NULL;
@@ -210,6 +215,9 @@ BrowserPolicyConnector::BrowserPolicyConnector()
platform_provider_.reset(CreatePlatformProvider());
#if defined(OS_CHROMEOS)
+ if (g_testing_install_attributes)
+ install_attributes_.reset(g_testing_install_attributes);
+
// SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests.
// TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready
@@ -218,8 +226,10 @@ BrowserPolicyConnector::BrowserPolicyConnector()
chromeos::DBusThreadManager::IsInitialized()) {
chromeos::CryptohomeClient* cryptohome_client =
chromeos::DBusThreadManager::Get()->GetCryptohomeClient();
- install_attributes_.reset(
- new EnterpriseInstallAttributes(cryptohome_client));
+ if (!g_testing_install_attributes) {
+ install_attributes_.reset(
+ new EnterpriseInstallAttributes(cryptohome_client));
+ }
base::FilePath install_attrs_file;
CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES,
&install_attrs_file));
@@ -453,6 +463,12 @@ void BrowserPolicyConnector::SetUserPolicyDelegate(
ConfigurationPolicyProvider* user_policy_provider) {
global_user_cloud_policy_provider_.SetDelegate(user_policy_provider);
}
+
+void BrowserPolicyConnector::SetInstallAttributesForTesting(
+ EnterpriseInstallAttributes* attributes) {
+ DCHECK(!g_testing_install_attributes);
+ g_testing_install_attributes = attributes;
+}
#endif
// static
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.h ('k') | chrome/browser/policy/proto/chromeos/chrome_device_policy.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698