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

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

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/cloud_policy_provider.h" 5 #include "chrome/browser/policy/cloud_policy_provider.h"
6 6
7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/policy/browser_policy_connector.h" 8 #include "chrome/browser/policy/browser_policy_connector.h"
10 #include "chrome/browser/policy/policy_bundle.h" 9 #include "chrome/browser/policy/policy_bundle.h"
11 #include "chrome/browser/policy/policy_map.h" 10 #include "chrome/browser/policy/policy_map.h"
12 #include "chrome/common/chrome_switches.h"
13 11
14 namespace policy { 12 namespace policy {
15 13
16 CloudPolicyProvider::CloudPolicyProvider( 14 CloudPolicyProvider::CloudPolicyProvider(
17 BrowserPolicyConnector* browser_policy_connector, 15 BrowserPolicyConnector* browser_policy_connector,
18 PolicyLevel level) 16 PolicyLevel level)
19 : browser_policy_connector_(browser_policy_connector), 17 : browser_policy_connector_(browser_policy_connector),
20 level_(level), 18 level_(level),
21 initialization_complete_(false) { 19 initialization_complete_(false) {
22 for (size_t i = 0; i < CACHE_SIZE; ++i) 20 for (size_t i = 0; i < CACHE_SIZE; ++i)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 76 }
79 } 77 }
80 NOTREACHED(); 78 NOTREACHED();
81 } 79 }
82 80
83 void CloudPolicyProvider::Merge() { 81 void CloudPolicyProvider::Merge() {
84 // Re-check whether all caches are ready. 82 // Re-check whether all caches are ready.
85 if (!initialization_complete_) { 83 if (!initialization_complete_) {
86 initialization_complete_ = true; 84 initialization_complete_ = true;
87 for (size_t i = 0; i < CACHE_SIZE; ++i) { 85 for (size_t i = 0; i < CACHE_SIZE; ++i) {
88 #if defined(OS_CHROMEOS)
89 // Ignore the device policy cache if device policy is not enabled.
90 if (i == CACHE_DEVICE &&
91 !CommandLine::ForCurrentProcess()->HasSwitch(
92 switches::kEnableDevicePolicy)) {
93 continue;
94 }
95 #endif
96 if (caches_[i] == NULL || !caches_[i]->IsReady()) { 86 if (caches_[i] == NULL || !caches_[i]->IsReady()) {
97 initialization_complete_ = false; 87 initialization_complete_ = false;
98 break; 88 break;
99 } 89 }
100 } 90 }
101 } 91 }
102 92
103 PolicyMap combined; 93 PolicyMap combined;
104 for (size_t i = 0; i < CACHE_SIZE; ++i) { 94 for (size_t i = 0; i < CACHE_SIZE; ++i) {
105 if (caches_[i] && caches_[i]->IsReady()) 95 if (caches_[i] && caches_[i]->IsReady())
106 combined.MergeFrom(*caches_[i]->policy()); 96 combined.MergeFrom(*caches_[i]->policy());
107 } 97 }
108 combined.FilterLevel(level_); 98 combined.FilterLevel(level_);
109 99
110 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); 100 scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
111 bundle->Get(POLICY_DOMAIN_CHROME, std::string()).Swap(&combined); 101 bundle->Get(POLICY_DOMAIN_CHROME, std::string()).Swap(&combined);
112 UpdatePolicy(bundle.Pass()); 102 UpdatePolicy(bundle.Pass());
113 } 103 }
114 104
115 } // namespace policy 105 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_client.cc ('k') | chrome/browser/policy/cloud_policy_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698