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

Side by Side Diff: chrome/browser/automation/testing_automation_provider_chromeos.cc

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 11 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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 default: 179 default:
180 return "UNKNOWN_STATE"; 180 return "UNKNOWN_STATE";
181 } 181 }
182 } 182 }
183 183
184 // Fills the supplied DictionaryValue with all policy settings held by the 184 // Fills the supplied DictionaryValue with all policy settings held by the
185 // given CloudPolicySubsystem (Device or User subsystems) at the given 185 // given CloudPolicySubsystem (Device or User subsystems) at the given
186 // PolicyLevel (Mandatory or Recommended policies). 186 // PolicyLevel (Mandatory or Recommended policies).
187 DictionaryValue* CreateDictionaryWithPolicies( 187 DictionaryValue* CreateDictionaryWithPolicies(
188 policy::CloudPolicySubsystem* policy_subsystem, 188 policy::CloudPolicySubsystem* policy_subsystem,
189 policy::CloudPolicyCacheBase::PolicyLevel policy_level) { 189 policy::PolicyLevel policy_level) {
190 DictionaryValue* dict = new DictionaryValue; 190 DictionaryValue* dict = new DictionaryValue;
191 policy::CloudPolicyCacheBase* policy_cache = 191 policy::CloudPolicyCacheBase* policy_cache =
192 policy_subsystem->GetCloudPolicyCacheBase(); 192 policy_subsystem->GetCloudPolicyCacheBase();
193 if (policy_cache) { 193 if (policy_cache) {
194 const policy::PolicyMap* policy_map = policy_cache->policy(policy_level); 194 const policy::PolicyMap* policy_map = policy_cache->policy();
195 if (policy_map) { 195 if (policy_map) {
196 policy::PolicyMap::const_iterator i; 196 policy::PolicyMap::const_iterator i;
197 for (i = policy_map->begin(); i != policy_map->end(); i++) 197 for (i = policy_map->begin(); i != policy_map->end(); i++) {
198 dict->Set(policy::GetPolicyName(i->first), 198 if (i->second.level == policy_level)
199 i->second->DeepCopy()); 199 dict->Set(i->first, i->second.value->DeepCopy());
200 }
200 } 201 }
201 } 202 }
202 return dict; 203 return dict;
203 } 204 }
204 205
205 // Last reported power status. 206 // Last reported power status.
206 chromeos::PowerSupplyStatus global_power_status; 207 chromeos::PowerSupplyStatus global_power_status;
207 208
208 } // namespace 209 } // namespace
209 210
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 return_value->SetString("machine_id", device_data_store->machine_id()); 980 return_value->SetString("machine_id", device_data_store->machine_id());
980 return_value->SetString("machine_model", device_data_store->machine_model()); 981 return_value->SetString("machine_model", device_data_store->machine_model());
981 return_value->SetString("user_name", device_data_store->user_name()); 982 return_value->SetString("user_name", device_data_store->user_name());
982 return_value->SetBoolean("device_token_cache_loaded", 983 return_value->SetBoolean("device_token_cache_loaded",
983 device_data_store->token_cache_loaded()); 984 device_data_store->token_cache_loaded());
984 return_value->SetBoolean("user_token_cache_loaded", 985 return_value->SetBoolean("user_token_cache_loaded",
985 user_data_store->token_cache_loaded()); 986 user_data_store->token_cache_loaded());
986 // Get PolicyMaps. 987 // Get PolicyMaps.
987 return_value->Set("device_mandatory_policies", 988 return_value->Set("device_mandatory_policies",
988 CreateDictionaryWithPolicies(device_cloud_policy, 989 CreateDictionaryWithPolicies(device_cloud_policy,
989 policy::CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); 990 policy::POLICY_LEVEL_MANDATORY));
990 return_value->Set("user_mandatory_policies", 991 return_value->Set("user_mandatory_policies",
991 CreateDictionaryWithPolicies(user_cloud_policy, 992 CreateDictionaryWithPolicies(user_cloud_policy,
992 policy::CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); 993 policy::POLICY_LEVEL_MANDATORY));
993 return_value->Set("device_recommended_policies", 994 return_value->Set("device_recommended_policies",
994 CreateDictionaryWithPolicies(device_cloud_policy, 995 CreateDictionaryWithPolicies(device_cloud_policy,
995 policy::CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); 996 policy::POLICY_LEVEL_RECOMMENDED));
996 return_value->Set("user_recommended_policies", 997 return_value->Set("user_recommended_policies",
997 CreateDictionaryWithPolicies(user_cloud_policy, 998 CreateDictionaryWithPolicies(user_cloud_policy,
998 policy::CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); 999 policy::POLICY_LEVEL_RECOMMENDED));
999 reply.SendSuccess(return_value.get()); 1000 reply.SendSuccess(return_value.get());
1000 } 1001 }
1001 1002
1002 void TestingAutomationProvider::GetTimeInfo(Browser* browser, 1003 void TestingAutomationProvider::GetTimeInfo(Browser* browser,
1003 DictionaryValue* args, 1004 DictionaryValue* args,
1004 IPC::Message* reply_message) { 1005 IPC::Message* reply_message) {
1005 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 1006 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
1006 base::Time time(base::Time::Now()); 1007 base::Time time(base::Time::Now());
1007 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean( 1008 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean(
1008 prefs::kUse24HourClock); 1009 prefs::kUse24HourClock);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 1141 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
1141 AddObserver(power_manager_observer_); 1142 AddObserver(power_manager_observer_);
1142 } 1143 }
1143 1144
1144 void TestingAutomationProvider::RemoveChromeosObservers() { 1145 void TestingAutomationProvider::RemoveChromeosObservers() {
1145 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 1146 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
1146 RemoveObserver(power_manager_observer_); 1147 RemoveObserver(power_manager_observer_);
1147 delete power_manager_observer_; 1148 delete power_manager_observer_;
1148 power_manager_observer_ = NULL; 1149 power_manager_observer_ = NULL;
1149 } 1150 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/policy/asynchronous_policy_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698