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

Side by Side Diff: remoting/host/policy_hack/policy_watcher.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const 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
« no previous file with comments | « printing/page_size_margins.cc ('k') | sync/internal_api/public/change_record_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Most of this code is copied from: 5 // Most of this code is copied from:
6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc} 6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc}
7 7
8 #include "remoting/host/policy_hack/policy_watcher.h" 8 #include "remoting/host/policy_hack/policy_watcher.h"
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 14 matching lines...) Expand all
25 const int kFallbackReloadDelayMinutes = 15; 25 const int kFallbackReloadDelayMinutes = 15;
26 26
27 // Gets a boolean from a dictionary, or returns a default value if the boolean 27 // Gets a boolean from a dictionary, or returns a default value if the boolean
28 // couldn't be read. 28 // couldn't be read.
29 bool GetBooleanOrDefault(const base::DictionaryValue* dict, const char* key, 29 bool GetBooleanOrDefault(const base::DictionaryValue* dict, const char* key,
30 bool default_if_value_missing, 30 bool default_if_value_missing,
31 bool default_if_value_not_boolean) { 31 bool default_if_value_not_boolean) {
32 if (!dict->HasKey(key)) { 32 if (!dict->HasKey(key)) {
33 return default_if_value_missing; 33 return default_if_value_missing;
34 } 34 }
35 base::Value* value; 35 const base::Value* value;
36 if (dict->Get(key, &value) && value->IsType(base::Value::TYPE_BOOLEAN)) { 36 if (dict->Get(key, &value) && value->IsType(base::Value::TYPE_BOOLEAN)) {
37 bool bool_value; 37 bool bool_value;
38 CHECK(value->GetAsBoolean(&bool_value)); 38 CHECK(value->GetAsBoolean(&bool_value));
39 return bool_value; 39 return bool_value;
40 } 40 }
41 return default_if_value_not_boolean; 41 return default_if_value_not_boolean;
42 } 42 }
43 43
44 // Copies a boolean from one dictionary to another, using a default value 44 // Copies a boolean from one dictionary to another, using a default value
45 // if the boolean couldn't be read from the first dictionary. 45 // if the boolean couldn't be read from the first dictionary.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 old_policies_.swap(new_policies); 154 old_policies_.swap(new_policies);
155 155
156 // Notify our client of the changed policies. 156 // Notify our client of the changed policies.
157 if (!changed_policies->empty()) { 157 if (!changed_policies->empty()) {
158 policy_callback_.Run(changed_policies.Pass()); 158 policy_callback_.Run(changed_policies.Pass());
159 } 159 }
160 } 160 }
161 161
162 } // namespace policy_hack 162 } // namespace policy_hack
163 } // namespace remoting 163 } // namespace remoting
OLDNEW
« no previous file with comments | « printing/page_size_margins.cc ('k') | sync/internal_api/public/change_record_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698