| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/logging.h" |
| 15 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
| 16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/extensions/api/management/management_api_constants.h" | 23 #include "chrome/browser/extensions/api/management/management_api_constants.h" |
| 23 #include "chrome/browser/extensions/event_router.h" | 24 #include "chrome/browser/extensions/event_router.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | 25 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 break; | 184 break; |
| 184 case Manifest::UNPACKED: | 185 case Manifest::UNPACKED: |
| 185 case Manifest::COMMAND_LINE: | 186 case Manifest::COMMAND_LINE: |
| 186 info->install_type = management::ExtensionInfo::INSTALL_TYPE_DEVELOPMENT; | 187 info->install_type = management::ExtensionInfo::INSTALL_TYPE_DEVELOPMENT; |
| 187 break; | 188 break; |
| 188 case Manifest::EXTERNAL_PREF: | 189 case Manifest::EXTERNAL_PREF: |
| 189 case Manifest::EXTERNAL_REGISTRY: | 190 case Manifest::EXTERNAL_REGISTRY: |
| 190 case Manifest::EXTERNAL_PREF_DOWNLOAD: | 191 case Manifest::EXTERNAL_PREF_DOWNLOAD: |
| 191 info->install_type = management::ExtensionInfo::INSTALL_TYPE_SIDELOAD; | 192 info->install_type = management::ExtensionInfo::INSTALL_TYPE_SIDELOAD; |
| 192 break; | 193 break; |
| 194 case Manifest::EXTERNAL_POLICY: |
| 193 case Manifest::EXTERNAL_POLICY_DOWNLOAD: | 195 case Manifest::EXTERNAL_POLICY_DOWNLOAD: |
| 194 info->install_type = management::ExtensionInfo::INSTALL_TYPE_ADMIN; | 196 info->install_type = management::ExtensionInfo::INSTALL_TYPE_ADMIN; |
| 195 break; | 197 break; |
| 196 default: | 198 case Manifest::NUM_LOCATIONS: |
| 199 NOTREACHED(); |
| 200 case Manifest::INVALID_LOCATION: |
| 201 case Manifest::COMPONENT: |
| 197 info->install_type = management::ExtensionInfo::INSTALL_TYPE_OTHER; | 202 info->install_type = management::ExtensionInfo::INSTALL_TYPE_OTHER; |
| 198 break; | 203 break; |
| 199 } | 204 } |
| 200 | 205 |
| 201 return info.Pass(); | 206 return info.Pass(); |
| 202 } | 207 } |
| 203 | 208 |
| 204 void AddExtensionInfo(const ExtensionSet& extensions, | 209 void AddExtensionInfo(const ExtensionSet& extensions, |
| 205 ExtensionSystem* system, | 210 ExtensionSystem* system, |
| 206 ExtensionInfoList* extension_list) { | 211 ExtensionInfoList* extension_list) { |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { | 722 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { |
| 718 return &g_factory.Get(); | 723 return &g_factory.Get(); |
| 719 } | 724 } |
| 720 | 725 |
| 721 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { | 726 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 722 management_event_router_.reset(new ManagementEventRouter(profile_)); | 727 management_event_router_.reset(new ManagementEventRouter(profile_)); |
| 723 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 728 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 724 } | 729 } |
| 725 | 730 |
| 726 } // namespace extensions | 731 } // namespace extensions |
| OLD | NEW |