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

Side by Side Diff: components/policy/core/common/cloud/policy_header_service.cc

Issue 2530103002: Remove device policy store from PolicyHeaderService since it's not used. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/policy/core/common/cloud/policy_header_service.h" 5 #include "components/policy/core/common/cloud/policy_header_service.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "components/policy/core/common/cloud/cloud_policy_store.h" 11 #include "components/policy/core/common/cloud/cloud_policy_store.h"
12 #include "components/policy/core/common/cloud/policy_header_io_helper.h" 12 #include "components/policy/core/common/cloud/policy_header_io_helper.h"
13 13
14 namespace { 14 namespace {
15 const char kUserDMTokenKey[] = "user_dmtoken"; 15 const char kUserDMTokenKey[] = "user_dmtoken";
16 const char kUserPolicyTokenKey[] = "user_policy_token"; 16 const char kUserPolicyTokenKey[] = "user_policy_token";
17 const char kVerificationKeyHashKey[] = "verification_key_id"; 17 const char kVerificationKeyHashKey[] = "verification_key_id";
18 } 18 }
19 19
20 namespace policy { 20 namespace policy {
21 21
22 PolicyHeaderService::PolicyHeaderService( 22 PolicyHeaderService::PolicyHeaderService(
23 const std::string& server_url, 23 const std::string& server_url,
24 const std::string& verification_key_hash, 24 const std::string& verification_key_hash,
25 CloudPolicyStore* user_policy_store, 25 CloudPolicyStore* user_policy_store)
26 CloudPolicyStore* device_policy_store)
27 : server_url_(server_url), 26 : server_url_(server_url),
28 verification_key_hash_(verification_key_hash), 27 verification_key_hash_(verification_key_hash),
29 user_policy_store_(user_policy_store), 28 user_policy_store_(user_policy_store) {
30 device_policy_store_(device_policy_store) {
31 user_policy_store_->AddObserver(this); 29 user_policy_store_->AddObserver(this);
32 if (device_policy_store_)
33 device_policy_store_->AddObserver(this);
34 } 30 }
35 31
36 PolicyHeaderService::~PolicyHeaderService() { 32 PolicyHeaderService::~PolicyHeaderService() {
37 user_policy_store_->RemoveObserver(this); 33 user_policy_store_->RemoveObserver(this);
38 if (device_policy_store_)
39 device_policy_store_->RemoveObserver(this);
40 } 34 }
41 35
42 std::unique_ptr<PolicyHeaderIOHelper> 36 std::unique_ptr<PolicyHeaderIOHelper>
43 PolicyHeaderService::CreatePolicyHeaderIOHelper( 37 PolicyHeaderService::CreatePolicyHeaderIOHelper(
44 scoped_refptr<base::SequencedTaskRunner> task_runner) { 38 scoped_refptr<base::SequencedTaskRunner> task_runner) {
45 std::string initial_header_value = CreateHeaderValue(); 39 std::string initial_header_value = CreateHeaderValue();
46 std::unique_ptr<PolicyHeaderIOHelper> helper = 40 std::unique_ptr<PolicyHeaderIOHelper> helper =
47 base::MakeUnique<PolicyHeaderIOHelper>(server_url_, initial_header_value, 41 base::MakeUnique<PolicyHeaderIOHelper>(server_url_, initial_header_value,
48 task_runner); 42 task_runner);
49 helpers_.push_back(helper.get()); 43 helpers_.push_back(helper.get());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 92
99 void PolicyHeaderService::OnStoreError(CloudPolicyStore* store) { 93 void PolicyHeaderService::OnStoreError(CloudPolicyStore* store) {
100 // Do nothing on errors. 94 // Do nothing on errors.
101 } 95 }
102 96
103 std::vector<PolicyHeaderIOHelper*> PolicyHeaderService::GetHelpersForTest() { 97 std::vector<PolicyHeaderIOHelper*> PolicyHeaderService::GetHelpersForTest() {
104 return helpers_; 98 return helpers_;
105 } 99 }
106 100
107 } // namespace policy 101 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698