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

Side by Side Diff: chrome/browser/policy/managed_mode_policy_provider.cc

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
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/policy/managed_mode_policy_provider.h" 5 #include "chrome/browser/policy/managed_mode_policy_provider.h"
6 6
7 #include "base/threading/sequenced_worker_pool.h"
7 #include "chrome/browser/policy/policy_bundle.h" 8 #include "chrome/browser/policy/policy_bundle.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/json_pref_store.h" 10 #include "chrome/common/json_pref_store.h"
10 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 13
13 using content::BrowserThread; 14 using content::BrowserThread;
14 15
15 namespace policy { 16 namespace policy {
16 17
17 // static 18 // static
18 const char ManagedModePolicyProvider::kPolicies[] = "policies"; 19 const char ManagedModePolicyProvider::kPolicies[] = "policies";
19 20
20 // static 21 // static
21 ManagedModePolicyProvider* ManagedModePolicyProvider::Create(Profile* profile) { 22 ManagedModePolicyProvider* ManagedModePolicyProvider::Create(Profile* profile) {
22 JsonPrefStore* pref_store = 23 FilePath path = profile->GetPath().Append(chrome::kManagedModePolicyFilename);
23 new JsonPrefStore(profile->GetPath().Append( 24 JsonPrefStore* pref_store = JsonPrefStore::Create(
24 chrome::kManagedModePolicyFilename), 25 path,
25 BrowserThread::GetMessageLoopProxyForThread( 26 JsonPrefStore::GetTaskRunnerForFile(path,
26 BrowserThread::FILE)); 27 BrowserThread::GetBlockingPool()));
27 return new ManagedModePolicyProvider(pref_store); 28 return new ManagedModePolicyProvider(pref_store);
28 } 29 }
29 30
30 ManagedModePolicyProvider::ManagedModePolicyProvider( 31 ManagedModePolicyProvider::ManagedModePolicyProvider(
31 PersistentPrefStore* pref_store) 32 PersistentPrefStore* pref_store)
32 : store_(pref_store) { 33 : store_(pref_store) {
33 store_->AddObserver(this); 34 store_->AddObserver(this);
34 store_->ReadPrefsAsync(NULL); 35 store_->ReadPrefsAsync(NULL);
35 } 36 }
36 37
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void ManagedModePolicyProvider::UpdatePolicyFromCache() { 100 void ManagedModePolicyProvider::UpdatePolicyFromCache() {
100 scoped_ptr<PolicyBundle> policy_bundle(new PolicyBundle); 101 scoped_ptr<PolicyBundle> policy_bundle(new PolicyBundle);
101 PolicyMap* policy_map = 102 PolicyMap* policy_map =
102 &policy_bundle->Get(POLICY_DOMAIN_CHROME, std::string()); 103 &policy_bundle->Get(POLICY_DOMAIN_CHROME, std::string());
103 policy_map->LoadFrom(GetCachedPolicy(), 104 policy_map->LoadFrom(GetCachedPolicy(),
104 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER); 105 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER);
105 UpdatePolicy(policy_bundle.Pass()); 106 UpdatePolicy(policy_bundle.Pass());
106 } 107 }
107 108
108 } // namespace policy 109 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698