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

Side by Side Diff: chrome_frame/policy_settings.cc

Issue 13619014: Change PolicyLoaderWin to load PReg files if possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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
« no previous file with comments | « chrome_frame/chrome_launcher.cc ('k') | chrome_frame/test/policy_settings_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 #include "chrome_frame/policy_settings.h" 5 #include "chrome_frame/policy_settings.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DCHECK(renderer_exclusion_list); 67 DCHECK(renderer_exclusion_list);
68 68
69 *default_renderer = RENDERER_NOT_SPECIFIED; 69 *default_renderer = RENDERER_NOT_SPECIFIED;
70 renderer_exclusion_list->clear(); 70 renderer_exclusion_list->clear();
71 71
72 base::win::RegKey config_key; 72 base::win::RegKey config_key;
73 DWORD value = RENDERER_NOT_SPECIFIED; 73 DWORD value = RENDERER_NOT_SPECIFIED;
74 std::wstring settings_value( 74 std::wstring settings_value(
75 ASCIIToWide(policy::key::kChromeFrameRendererSettings)); 75 ASCIIToWide(policy::key::kChromeFrameRendererSettings));
76 for (int i = 0; i < arraysize(kRootKeys); ++i) { 76 for (int i = 0; i < arraysize(kRootKeys); ++i) {
77 if ((config_key.Open(kRootKeys[i], policy::kRegistryMandatorySubKey, 77 if ((config_key.Open(kRootKeys[i], policy::kRegistryChromePolicyKey,
78 KEY_READ) == ERROR_SUCCESS) && 78 KEY_READ) == ERROR_SUCCESS) &&
79 (config_key.ReadValueDW(settings_value.c_str(), 79 (config_key.ReadValueDW(settings_value.c_str(),
80 &value) == ERROR_SUCCESS)) { 80 &value) == ERROR_SUCCESS)) {
81 break; 81 break;
82 } 82 }
83 } 83 }
84 84
85 DCHECK(value == RENDERER_NOT_SPECIFIED || 85 DCHECK(value == RENDERER_NOT_SPECIFIED ||
86 value == RENDER_IN_HOST || 86 value == RENDER_IN_HOST ||
87 value == RENDER_IN_CHROME_FRAME) << 87 value == RENDER_IN_CHROME_FRAME) <<
(...skipping 14 matching lines...) Expand all
102 << *default_renderer 102 << *default_renderer
103 << " exclusion list size: " << renderer_exclusion_list->size(); 103 << " exclusion list size: " << renderer_exclusion_list->size();
104 } 104 }
105 } 105 }
106 106
107 // static 107 // static
108 void PolicySettings::ReadContentTypeSetting( 108 void PolicySettings::ReadContentTypeSetting(
109 std::vector<std::wstring>* content_type_list) { 109 std::vector<std::wstring>* content_type_list) {
110 DCHECK(content_type_list); 110 DCHECK(content_type_list);
111 111
112 std::wstring sub_key(policy::kRegistryMandatorySubKey); 112 std::wstring sub_key(policy::kRegistryChromePolicyKey);
113 sub_key += L"\\"; 113 sub_key += L"\\";
114 sub_key += ASCIIToWide(policy::key::kChromeFrameContentTypes); 114 sub_key += ASCIIToWide(policy::key::kChromeFrameContentTypes);
115 115
116 content_type_list->clear(); 116 content_type_list->clear();
117 for (int i = 0; i < arraysize(kRootKeys) && content_type_list->empty(); 117 for (int i = 0; i < arraysize(kRootKeys) && content_type_list->empty();
118 ++i) { 118 ++i) {
119 EnumerateKeyValues(kRootKeys[i], sub_key.c_str(), content_type_list); 119 EnumerateKeyValues(kRootKeys[i], sub_key.c_str(), content_type_list);
120 } 120 }
121 } 121 }
122 122
123 // static 123 // static
124 void PolicySettings::ReadStringSetting(const char* value_name, 124 void PolicySettings::ReadStringSetting(const char* value_name,
125 std::wstring* value) { 125 std::wstring* value) {
126 DCHECK(value); 126 DCHECK(value);
127 value->clear(); 127 value->clear();
128 base::win::RegKey config_key; 128 base::win::RegKey config_key;
129 std::wstring value_name_str(ASCIIToWide(value_name)); 129 std::wstring value_name_str(ASCIIToWide(value_name));
130 for (int i = 0; i < arraysize(kRootKeys); ++i) { 130 for (int i = 0; i < arraysize(kRootKeys); ++i) {
131 if ((config_key.Open(kRootKeys[i], policy::kRegistryMandatorySubKey, 131 if ((config_key.Open(kRootKeys[i], policy::kRegistryChromePolicyKey,
132 KEY_READ) == ERROR_SUCCESS) && 132 KEY_READ) == ERROR_SUCCESS) &&
133 (config_key.ReadValue(value_name_str.c_str(), 133 (config_key.ReadValue(value_name_str.c_str(),
134 value) == ERROR_SUCCESS)) { 134 value) == ERROR_SUCCESS)) {
135 break; 135 break;
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 void PolicySettings::RefreshFromRegistry() { 140 void PolicySettings::RefreshFromRegistry() {
141 RendererForUrl default_renderer; 141 RendererForUrl default_renderer;
(...skipping 22 matching lines...) Expand all
164 swap(renderer_exclusion_list_, renderer_exclusion_list); 164 swap(renderer_exclusion_list_, renderer_exclusion_list);
165 swap(content_type_list_, content_type_list); 165 swap(content_type_list_, content_type_list);
166 swap(application_locale_, application_locale); 166 swap(application_locale_, application_locale);
167 swap(additional_launch_parameters_, additional_launch_parameters); 167 swap(additional_launch_parameters_, additional_launch_parameters);
168 } 168 }
169 169
170 // static 170 // static
171 PolicySettings* PolicySettings::GetInstance() { 171 PolicySettings* PolicySettings::GetInstance() {
172 return Singleton<PolicySettings>::get(); 172 return Singleton<PolicySettings>::get();
173 } 173 }
OLDNEW
« no previous file with comments | « chrome_frame/chrome_launcher.cc ('k') | chrome_frame/test/policy_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698