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

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

Issue 10830022: Fixed check return warnings from Coverity. (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/managed_mode_policy_provider.h" 5 #include "chrome/browser/policy/managed_mode_policy_provider.h"
6 6
7 #include "chrome/browser/policy/policy_bundle.h" 7 #include "chrome/browser/policy/policy_bundle.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/json_pref_store.h" 9 #include "chrome/common/json_pref_store.h"
10 #include "chrome/common/chrome_constants.h" 10 #include "chrome/common/chrome_constants.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 ManagedModePolicyProvider::~ManagedModePolicyProvider() { 38 ManagedModePolicyProvider::~ManagedModePolicyProvider() {
39 store_->RemoveObserver(this); 39 store_->RemoveObserver(this);
40 } 40 }
41 41
42 const base::Value* ManagedModePolicyProvider::GetPolicy( 42 const base::Value* ManagedModePolicyProvider::GetPolicy(
43 const std::string& key) const { 43 const std::string& key) const {
44 base::DictionaryValue* dict = GetCachedPolicy(); 44 base::DictionaryValue* dict = GetCachedPolicy();
45 base::Value* value = NULL; 45 base::Value* value = NULL;
46 dict->GetWithoutPathExpansion(key, &value); 46 bool rv = dict->GetWithoutPathExpansion(key, &value);
47 DCHECK(rv);
Mattias Nissler (ping if slow) 2012/07/26 09:37:06 I think this is wrong, the intention here is to re
Danh Nguyen 2012/07/26 15:46:27 Reverted. I'll remove the DCHECK and add a note he
47 return value; 48 return value;
48 } 49 }
49 50
50 void ManagedModePolicyProvider::SetPolicy(const std::string& key, 51 void ManagedModePolicyProvider::SetPolicy(const std::string& key,
51 const base::Value* value) { 52 const base::Value* value) {
52 base::DictionaryValue* dict = GetCachedPolicy(); 53 base::DictionaryValue* dict = GetCachedPolicy();
53 dict->SetWithoutPathExpansion(key, value->DeepCopy()); 54 dict->SetWithoutPathExpansion(key, value->DeepCopy());
54 store_->ReportValueChanged(kPolicies); 55 store_->ReportValueChanged(kPolicies);
55 UpdatePolicyFromCache(); 56 UpdatePolicyFromCache();
56 } 57 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void ManagedModePolicyProvider::UpdatePolicyFromCache() { 96 void ManagedModePolicyProvider::UpdatePolicyFromCache() {
96 scoped_ptr<PolicyBundle> policy_bundle(new PolicyBundle); 97 scoped_ptr<PolicyBundle> policy_bundle(new PolicyBundle);
97 PolicyMap* policy_map = 98 PolicyMap* policy_map =
98 &policy_bundle->Get(POLICY_DOMAIN_CHROME, std::string()); 99 &policy_bundle->Get(POLICY_DOMAIN_CHROME, std::string());
99 policy_map->LoadFrom(GetCachedPolicy(), 100 policy_map->LoadFrom(GetCachedPolicy(),
100 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER); 101 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER);
101 UpdatePolicy(policy_bundle.Pass()); 102 UpdatePolicy(policy_bundle.Pass());
102 } 103 }
103 104
104 } // namespace policy 105 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/policy_loader_win.cc » ('j') | chrome/browser/policy/policy_loader_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698