OLD | NEW |
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/extensions/api/management/management_api.h" | 5 #include "chrome/browser/extensions/api/management/management_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 extension.GetActivePermissions()->explicit_hosts(); | 167 extension.GetActivePermissions()->explicit_hosts(); |
168 if (!host_perms.is_empty()) { | 168 if (!host_perms.is_empty()) { |
169 for (URLPatternSet::const_iterator iter = host_perms.begin(); | 169 for (URLPatternSet::const_iterator iter = host_perms.begin(); |
170 iter != host_perms.end(); ++iter) { | 170 iter != host_perms.end(); ++iter) { |
171 info->host_permissions.push_back(iter->GetAsString()); | 171 info->host_permissions.push_back(iter->GetAsString()); |
172 } | 172 } |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 switch (extension.location()) { | 176 switch (extension.location()) { |
177 case Extension::INTERNAL: | 177 case Manifest::INTERNAL: |
178 info->install_type = management::ExtensionInfo::INSTALL_TYPE_NORMAL; | 178 info->install_type = management::ExtensionInfo::INSTALL_TYPE_NORMAL; |
179 break; | 179 break; |
180 case Extension::LOAD: | 180 case Manifest::LOAD: |
181 info->install_type = management::ExtensionInfo::INSTALL_TYPE_DEVELOPMENT; | 181 info->install_type = management::ExtensionInfo::INSTALL_TYPE_DEVELOPMENT; |
182 break; | 182 break; |
183 case Extension::EXTERNAL_PREF: | 183 case Manifest::EXTERNAL_PREF: |
184 case Extension::EXTERNAL_REGISTRY: | 184 case Manifest::EXTERNAL_REGISTRY: |
185 case Extension::EXTERNAL_PREF_DOWNLOAD: | 185 case Manifest::EXTERNAL_PREF_DOWNLOAD: |
186 info->install_type = management::ExtensionInfo::INSTALL_TYPE_SIDELOAD; | 186 info->install_type = management::ExtensionInfo::INSTALL_TYPE_SIDELOAD; |
187 break; | 187 break; |
188 case Extension::EXTERNAL_POLICY_DOWNLOAD: | 188 case Manifest::EXTERNAL_POLICY_DOWNLOAD: |
189 info->install_type = management::ExtensionInfo::INSTALL_TYPE_ADMIN; | 189 info->install_type = management::ExtensionInfo::INSTALL_TYPE_ADMIN; |
190 break; | 190 break; |
191 default: | 191 default: |
192 info->install_type = management::ExtensionInfo::INSTALL_TYPE_OTHER; | 192 info->install_type = management::ExtensionInfo::INSTALL_TYPE_OTHER; |
193 break; | 193 break; |
194 } | 194 } |
195 | 195 |
196 return info.Pass(); | 196 return info.Pass(); |
197 } | 197 } |
198 | 198 |
199 void AddExtensionInfo(const ExtensionSet& extensions, | 199 void AddExtensionInfo(const ExtensionSet& extensions, |
200 ExtensionSystem* system, | 200 ExtensionSystem* system, |
201 ExtensionInfoList* extension_list) { | 201 ExtensionInfoList* extension_list) { |
202 for (ExtensionSet::const_iterator iter = extensions.begin(); | 202 for (ExtensionSet::const_iterator iter = extensions.begin(); |
203 iter != extensions.end(); ++iter) { | 203 iter != extensions.end(); ++iter) { |
204 const Extension& extension = **iter; | 204 const Extension& extension = **iter; |
205 | 205 |
206 if (extension.location() == Extension::COMPONENT) | 206 if (extension.location() == Manifest::COMPONENT) |
207 continue; // Skip built-in extensions. | 207 continue; // Skip built-in extensions. |
208 | 208 |
209 extension_list->push_back(make_linked_ptr<management::ExtensionInfo>( | 209 extension_list->push_back(make_linked_ptr<management::ExtensionInfo>( |
210 CreateExtensionInfo(extension, system).release())); | 210 CreateExtensionInfo(extension, system).release())); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 } // namespace | 214 } // namespace |
215 | 215 |
216 ExtensionService* ManagementFunction::service() { | 216 ExtensionService* ManagementFunction::service() { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 // Response is sent async in OnParseSuccess/Failure(). | 376 // Response is sent async in OnParseSuccess/Failure(). |
377 return true; | 377 return true; |
378 } | 378 } |
379 | 379 |
380 void ManagementGetPermissionWarningsByManifestFunction::OnParseSuccess( | 380 void ManagementGetPermissionWarningsByManifestFunction::OnParseSuccess( |
381 DictionaryValue* parsed_manifest) { | 381 DictionaryValue* parsed_manifest) { |
382 CHECK(parsed_manifest); | 382 CHECK(parsed_manifest); |
383 | 383 |
384 scoped_refptr<Extension> extension = Extension::Create( | 384 scoped_refptr<Extension> extension = Extension::Create( |
385 FilePath(), Extension::INVALID, *parsed_manifest, Extension::NO_FLAGS, | 385 FilePath(), Manifest::INVALID_LOCATION, *parsed_manifest, |
386 &error_); | 386 Extension::NO_FLAGS, &error_); |
387 if (!extension.get()) { | 387 if (!extension.get()) { |
388 OnParseFailure(keys::kExtensionCreateError); | 388 OnParseFailure(keys::kExtensionCreateError); |
389 return; | 389 return; |
390 } | 390 } |
391 | 391 |
392 std::vector<std::string> warnings = CreateWarningsList(extension); | 392 std::vector<std::string> warnings = CreateWarningsList(extension); |
393 results_ = management::GetPermissionWarningsByManifest::Results::Create( | 393 results_ = management::GetPermissionWarningsByManifest::Results::Create( |
394 warnings); | 394 warnings); |
395 SendResponse(true); | 395 SendResponse(true); |
396 | 396 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { | 708 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { |
709 return &g_factory.Get(); | 709 return &g_factory.Get(); |
710 } | 710 } |
711 | 711 |
712 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { | 712 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { |
713 management_event_router_.reset(new ManagementEventRouter(profile_)); | 713 management_event_router_.reset(new ManagementEventRouter(profile_)); |
714 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 714 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
715 } | 715 } |
716 | 716 |
717 } // namespace extensions | 717 } // namespace extensions |
OLD | NEW |