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

Unified Diff: trunk/src/chrome/browser/chromeos/policy/device_local_account_policy_service.cc

Issue 60683002: Revert 233048 "Support policies referencing external data for de..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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: trunk/src/chrome/browser/chromeos/policy/device_local_account_policy_service.cc
===================================================================
--- trunk/src/chrome/browser/chromeos/policy/device_local_account_policy_service.cc (revision 233050)
+++ trunk/src/chrome/browser/chromeos/policy/device_local_account_policy_service.cc (working copy)
@@ -17,7 +17,6 @@
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/chromeos/policy/device_local_account.h"
-#include "chrome/browser/chromeos/policy/device_local_account_external_data_service.h"
#include "chrome/browser/chromeos/policy/device_local_account_policy_store.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chrome/browser/policy/cloud/cloud_policy_client.h"
@@ -29,7 +28,6 @@
#include "chromeos/dbus/session_manager_client.h"
#include "chromeos/settings/cros_settings_names.h"
#include "chromeos/settings/cros_settings_provider.h"
-#include "net/url_request/url_request_context_getter.h"
#include "policy/policy_constants.h"
namespace em = enterprise_management;
@@ -73,7 +71,7 @@
void DeleteOrphanedExtensionCaches(
const std::set<std::string>& subdirectories_to_keep) {
base::FilePath cache_root_dir;
- CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS,
+ CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_CACHE,
&cache_root_dir));
base::FileEnumerator enumerator(cache_root_dir,
false,
@@ -93,7 +91,7 @@
// the removal is in progress.
void DeleteObsoleteExtensionCache(const std::string& account_id_to_delete) {
base::FilePath cache_root_dir;
- CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS,
+ CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_CACHE,
&cache_root_dir));
const base::FilePath path = cache_root_dir
.Append(GetCacheSubdirectoryForAccountID(account_id_to_delete));
@@ -106,18 +104,16 @@
DeviceLocalAccountPolicyBroker::DeviceLocalAccountPolicyBroker(
const DeviceLocalAccount& account,
scoped_ptr<DeviceLocalAccountPolicyStore> store,
- scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager,
const scoped_refptr<base::SequencedTaskRunner>& task_runner)
: account_id_(account.account_id),
user_id_(account.user_id),
store_(store.Pass()),
- external_data_manager_(external_data_manager),
core_(PolicyNamespaceKey(dm_protocol::kChromePublicAccountPolicyType,
store_->account_id()),
store_.get(),
task_runner) {
base::FilePath cache_root_dir;
- CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS,
+ CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_CACHE,
&cache_root_dir));
extension_loader_ = new chromeos::DeviceLocalAccountExternalPolicyLoader(
store_.get(),
@@ -126,8 +122,6 @@
}
DeviceLocalAccountPolicyBroker::~DeviceLocalAccountPolicyBroker() {
- external_data_manager_->SetPolicyStore(NULL);
- external_data_manager_->Disconnect();
}
void DeviceLocalAccountPolicyBroker::Initialize() {
@@ -136,8 +130,7 @@
void DeviceLocalAccountPolicyBroker::ConnectIfPossible(
chromeos::DeviceSettingsService* device_settings_service,
- DeviceManagementService* device_management_service,
- scoped_refptr<net::URLRequestContextGetter> request_context) {
+ DeviceManagementService* device_management_service) {
if (core_.client())
return;
@@ -147,11 +140,14 @@
return;
core_.Connect(client.Pass());
- external_data_manager_->Connect(request_context);
core_.StartRefreshScheduler();
UpdateRefreshDelay();
}
+void DeviceLocalAccountPolicyBroker::Disconnect() {
+ core_.Disconnect();
+}
+
void DeviceLocalAccountPolicyBroker::UpdateRefreshDelay() {
if (core_.refresh_scheduler()) {
const Value* policy_value =
@@ -176,11 +172,7 @@
chromeos::DeviceSettingsService* device_settings_service,
chromeos::CrosSettings* cros_settings,
scoped_refptr<base::SequencedTaskRunner> store_background_task_runner,
- scoped_refptr<base::SequencedTaskRunner> extension_cache_task_runner,
- scoped_refptr<base::SequencedTaskRunner>
- external_data_service_backend_task_runner,
- scoped_refptr<base::SequencedTaskRunner> io_task_runner,
- scoped_refptr<net::URLRequestContextGetter> request_context)
+ scoped_refptr<base::SequencedTaskRunner> extension_cache_task_runner)
: session_manager_client_(session_manager_client),
device_settings_service_(device_settings_service),
cros_settings_(cros_settings),
@@ -189,28 +181,16 @@
orphan_cache_deletion_state_(NOT_STARTED),
store_background_task_runner_(store_background_task_runner),
extension_cache_task_runner_(extension_cache_task_runner),
- request_context_(request_context),
local_accounts_subscription_(cros_settings_->AddSettingsObserver(
chromeos::kAccountsPrefDeviceLocalAccounts,
base::Bind(&DeviceLocalAccountPolicyService::
UpdateAccountListIfNonePending,
base::Unretained(this)))),
weak_factory_(this) {
- external_data_service_.reset(new DeviceLocalAccountExternalDataService(
- this,
- external_data_service_backend_task_runner,
- io_task_runner));
UpdateAccountList();
}
DeviceLocalAccountPolicyService::~DeviceLocalAccountPolicyService() {
- DCHECK(!request_context_);
- DCHECK(policy_brokers_.empty());
-}
-
-void DeviceLocalAccountPolicyService::Shutdown() {
- device_management_service_ = NULL;
- request_context_ = NULL;
DeleteBrokers(&policy_brokers_);
}
@@ -223,11 +203,21 @@
for (PolicyBrokerMap::iterator it(policy_brokers_.begin());
it != policy_brokers_.end(); ++it) {
it->second->ConnectIfPossible(device_settings_service_,
- device_management_service_,
- request_context_);
+ device_management_service_);
}
}
+void DeviceLocalAccountPolicyService::Disconnect() {
+ DCHECK(device_management_service_);
+ device_management_service_ = NULL;
+
+ // Disconnect the brokers.
+ for (PolicyBrokerMap::iterator it(policy_brokers_.begin());
+ it != policy_brokers_.end(); ++it) {
+ it->second->Disconnect();
+ }
+}
+
DeviceLocalAccountPolicyBroker*
DeviceLocalAccountPolicyService::GetBrokerForUser(
const std::string& user_id) {
@@ -397,22 +387,16 @@
device_settings_service_,
store_background_task_runner_));
store->AddObserver(this);
- scoped_refptr<DeviceLocalAccountExternalDataManager>
- external_data_manager =
- external_data_service_->GetExternalDataManager(it->account_id,
- store.get());
broker.reset(new DeviceLocalAccountPolicyBroker(
*it,
store.Pass(),
- external_data_manager,
base::MessageLoopProxy::current()));
}
// Fire up the cloud connection for fetching policy for the account from
// the cloud if this is an enterprise-managed device.
broker->ConnectIfPossible(device_settings_service_,
- device_management_service_,
- request_context_);
+ device_management_service_);
policy_brokers_[it->user_id] = broker.release();
if (!broker_initialized) {

Powered by Google App Engine
This is Rietveld 408576698