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

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

Issue 8258018: Generate Chrome policy definition list from policy_templates.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the unittest fix Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 #include "net/base/cookie_store.h" 119 #include "net/base/cookie_store.h"
120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
121 #include "ui/base/events.h" 121 #include "ui/base/events.h"
122 #include "ui/base/keycodes/keyboard_codes.h" 122 #include "ui/base/keycodes/keyboard_codes.h"
123 #include "ui/base/message_box_flags.h" 123 #include "ui/base/message_box_flags.h"
124 #include "webkit/glue/webdropdata.h" 124 #include "webkit/glue/webdropdata.h"
125 #include "webkit/plugins/webplugininfo.h" 125 #include "webkit/plugins/webplugininfo.h"
126 126
127 #if defined(ENABLE_CONFIGURATION_POLICY) 127 #if defined(ENABLE_CONFIGURATION_POLICY)
128 #include "chrome/browser/policy/browser_policy_connector.h" 128 #include "chrome/browser/policy/browser_policy_connector.h"
129 #include "chrome/browser/policy/configuration_policy_pref_store.h"
130 #include "chrome/browser/policy/configuration_policy_provider.h" 129 #include "chrome/browser/policy/configuration_policy_provider.h"
131 #include "chrome/browser/policy/policy_map.h" 130 #include "chrome/browser/policy/policy_map.h"
131 #include "policy/policy_constants.h"
132 #endif 132 #endif
133 133
134 #if defined(OS_CHROMEOS) 134 #if defined(OS_CHROMEOS)
135 #include "chrome/browser/ui/webui/active_downloads_ui.h" 135 #include "chrome/browser/ui/webui/active_downloads_ui.h"
136 #else 136 #else
137 #include "chrome/browser/download/download_shelf.h" 137 #include "chrome/browser/download/download_shelf.h"
138 #endif 138 #endif
139 139
140 using automation_util::SendErrorIfModalDialogActive; 140 using automation_util::SendErrorIfModalDialogActive;
141 141
(...skipping 5718 matching lines...) Expand 10 before | Expand all | Expand 10 after
5860 } 5860 }
5861 5861
5862 void TestingAutomationProvider::SetPolicies( 5862 void TestingAutomationProvider::SetPolicies(
5863 DictionaryValue* args, 5863 DictionaryValue* args,
5864 IPC::Message* reply_message) { 5864 IPC::Message* reply_message) {
5865 AutomationJSONReply reply(this, reply_message); 5865 AutomationJSONReply reply(this, reply_message);
5866 5866
5867 #if !defined(ENABLE_CONFIGURATION_POLICY) || defined(OFFICIAL_BUILD) 5867 #if !defined(ENABLE_CONFIGURATION_POLICY) || defined(OFFICIAL_BUILD)
5868 reply.SendError("Configuration Policy disabled"); 5868 reply.SendError("Configuration Policy disabled");
5869 #else 5869 #else
5870 const policy::ConfigurationPolicyProvider::PolicyDefinitionList* list = 5870 const policy::PolicyDefinitionList* list =
5871 policy::ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(); 5871 policy::GetChromePolicyDefinitionList();
5872 policy::BrowserPolicyConnector* connector = 5872 policy::BrowserPolicyConnector* connector =
5873 g_browser_process->browser_policy_connector(); 5873 g_browser_process->browser_policy_connector();
5874 struct { 5874 struct {
5875 std::string name; 5875 std::string name;
5876 policy::ConfigurationPolicyProvider* provider; 5876 policy::ConfigurationPolicyProvider* provider;
5877 } providers[] = { 5877 } providers[] = {
5878 { "managed_cloud", connector->GetManagedCloudProvider() }, 5878 { "managed_cloud", connector->GetManagedCloudProvider() },
5879 { "managed_platform", connector->GetManagedPlatformProvider() }, 5879 { "managed_platform", connector->GetManagedPlatformProvider() },
5880 { "recommended_cloud", connector->GetRecommendedCloudProvider() }, 5880 { "recommended_cloud", connector->GetRecommendedCloudProvider() },
5881 { "recommended_platform", connector->GetRecommendedPlatformProvider() } 5881 { "recommended_platform", connector->GetRecommendedPlatformProvider() }
(...skipping 24 matching lines...) Expand all
5906 void TestingAutomationProvider::GetPolicyDefinitionList( 5906 void TestingAutomationProvider::GetPolicyDefinitionList(
5907 DictionaryValue* args, 5907 DictionaryValue* args,
5908 IPC::Message* reply_message) { 5908 IPC::Message* reply_message) {
5909 AutomationJSONReply reply(this, reply_message); 5909 AutomationJSONReply reply(this, reply_message);
5910 5910
5911 #if !defined(ENABLE_CONFIGURATION_POLICY) 5911 #if !defined(ENABLE_CONFIGURATION_POLICY)
5912 reply.SendError("Configuration Policy disabled"); 5912 reply.SendError("Configuration Policy disabled");
5913 #else 5913 #else
5914 DictionaryValue response; 5914 DictionaryValue response;
5915 5915
5916 const policy::ConfigurationPolicyProvider::PolicyDefinitionList* list = 5916 const policy::PolicyDefinitionList* list =
5917 policy::ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(); 5917 policy::GetChromePolicyDefinitionList();
5918 // Value::Type to python type. 5918 // Value::Type to python type.
5919 std::map<Value::Type, std::string> types; 5919 std::map<Value::Type, std::string> types;
5920 types[Value::TYPE_BOOLEAN] = "bool"; 5920 types[Value::TYPE_BOOLEAN] = "bool";
5921 types[Value::TYPE_INTEGER] = "int"; 5921 types[Value::TYPE_INTEGER] = "int";
5922 types[Value::TYPE_STRING] = "str"; 5922 types[Value::TYPE_STRING] = "str";
5923 types[Value::TYPE_LIST] = "list"; 5923 types[Value::TYPE_LIST] = "list";
5924 5924
5925 const policy::ConfigurationPolicyProvider::PolicyDefinitionList::Entry* entry; 5925 const policy::PolicyDefinitionList::Entry* entry;
5926 for (entry = list->begin; entry != list->end; ++entry) { 5926 for (entry = list->begin; entry != list->end; ++entry) {
5927 if (types.find(entry->value_type) == types.end()) { 5927 if (types.find(entry->value_type) == types.end()) {
5928 std::string error("Unrecognized policy type for policy "); 5928 std::string error("Unrecognized policy type for policy ");
5929 reply.SendError(error + entry->name); 5929 reply.SendError(error + entry->name);
5930 return; 5930 return;
5931 } 5931 }
5932 response.SetString(entry->name, types[entry->value_type]); 5932 response.SetString(entry->name, types[entry->value_type]);
5933 } 5933 }
5934 5934
5935 reply.SendSuccess(&response); 5935 reply.SendSuccess(&response);
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
6526 6526
6527 Send(reply_message_); 6527 Send(reply_message_);
6528 redirect_query_ = 0; 6528 redirect_query_ = 0;
6529 reply_message_ = NULL; 6529 reply_message_ = NULL;
6530 } 6530 }
6531 6531
6532 void TestingAutomationProvider::OnRemoveProvider() { 6532 void TestingAutomationProvider::OnRemoveProvider() {
6533 if (g_browser_process) 6533 if (g_browser_process)
6534 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6534 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6535 } 6535 }
OLDNEW
« no previous file with comments | « chrome/app/policy/policy_templates.json ('k') | chrome/browser/automation/testing_automation_provider_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698