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

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

Issue 6869042: Add immutable settings checks when handling policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, address comments Created 9 years, 8 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
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.h ('k') | chrome/browser/policy/device_policy_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56f4443b3e02af25380c36b4a8125d8dfca37d80..e6f375e1b112f284d3ef8c4f1f3029a509be8290 100644
--- a/chrome/browser/policy/browser_policy_connector.cc
+++ b/chrome/browser/policy/browser_policy_connector.cc
@@ -23,8 +23,10 @@
#endif
#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/policy/device_policy_cache.h"
#include "chrome/browser/policy/device_policy_identity_strategy.h"
+#include "chrome/browser/policy/enterprise_install_attributes.h"
#endif
namespace policy {
@@ -38,9 +40,12 @@ BrowserPolicyConnector::BrowserPolicyConnector()
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kEnableDevicePolicy)) {
identity_strategy_.reset(new DevicePolicyIdentityStrategy());
+ install_attributes_.reset(new EnterpriseInstallAttributes(
+ chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()));
cloud_policy_subsystem_.reset(new CloudPolicySubsystem(
identity_strategy_.get(),
- new DevicePolicyCache(identity_strategy_.get())));
+ new DevicePolicyCache(identity_strategy_.get(),
+ install_attributes_.get())));
// Initialize the subsystem once the message loops are spinning.
MessageLoop::current()->PostTask(
@@ -149,22 +154,23 @@ bool BrowserPolicyConnector::IsEnterpriseManaged() {
#endif
}
-std::string BrowserPolicyConnector::GetEnterpriseDomain() {
- std::string domain;
+EnterpriseInstallAttributes::LockResult
+ BrowserPolicyConnector::LockDevice(const std::string& user) {
+#if defined(OS_CHROMEOS)
+ if (install_attributes_.get())
+ return install_attributes_->LockDevice(user);
+#endif
+ return EnterpriseInstallAttributes::LOCK_BACKEND_ERROR;
+}
+
+std::string BrowserPolicyConnector::GetEnterpriseDomain() {
#if defined(OS_CHROMEOS)
- // TODO(xiyuan): Find a better way to get enterprise domain.
- std::string username;
- std::string auth_token;
- if (identity_strategy_.get() &&
- identity_strategy_->GetCredentials(&username, &auth_token)) {
- size_t pos = username.find('@');
- if (pos != std::string::npos)
- domain = username.substr(pos + 1);
- }
+ if (install_attributes_.get())
+ return install_attributes_->GetDomain();
#endif
- return domain;
+ return std::string();
}
void BrowserPolicyConnector::StopAutoRetry() {
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.h ('k') | chrome/browser/policy/device_policy_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698