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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "content/public/browser/utility_process_host_client.h" | 42 #include "content/public/browser/utility_process_host_client.h" |
43 | 43 |
44 #if !defined(OS_ANDROID) | 44 #if !defined(OS_ANDROID) |
45 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 45 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
46 #endif | 46 #endif |
47 | 47 |
48 using base::IntToString; | 48 using base::IntToString; |
49 using content::BrowserThread; | 49 using content::BrowserThread; |
50 using content::UtilityProcessHost; | 50 using content::UtilityProcessHost; |
51 using content::UtilityProcessHostClient; | 51 using content::UtilityProcessHostClient; |
| 52 using extensions::api::management::ExtensionInfo; |
| 53 using extensions::api::management::IconInfo; |
52 using extensions::Extension; | 54 using extensions::Extension; |
53 using extensions::ExtensionSystem; | 55 using extensions::ExtensionSystem; |
54 using extensions::PermissionMessages; | 56 using extensions::PermissionMessages; |
55 | 57 |
56 namespace events = extensions::event_names; | 58 namespace events = extensions::event_names; |
57 namespace keys = extension_management_api_constants; | 59 namespace keys = extension_management_api_constants; |
58 namespace management = extensions::api::management; | 60 namespace management = extensions::api::management; |
59 | 61 |
60 namespace { | 62 namespace { |
61 | 63 |
(...skipping 30 matching lines...) Expand all Loading... |
92 info->enabled = service->IsExtensionEnabled(info->id); | 94 info->enabled = service->IsExtensionEnabled(info->id); |
93 info->offline_enabled = extension.offline_enabled(); | 95 info->offline_enabled = extension.offline_enabled(); |
94 info->version = extension.VersionString(); | 96 info->version = extension.VersionString(); |
95 info->description = extension.description(); | 97 info->description = extension.description(); |
96 info->options_url = extension.options_url().spec(); | 98 info->options_url = extension.options_url().spec(); |
97 info->homepage_url.reset(new std::string( | 99 info->homepage_url.reset(new std::string( |
98 extension.GetHomepageURL().spec())); | 100 extension.GetHomepageURL().spec())); |
99 info->may_disable = system->management_policy()-> | 101 info->may_disable = system->management_policy()-> |
100 UserMayModifySettings(&extension, NULL); | 102 UserMayModifySettings(&extension, NULL); |
101 info->is_app = extension.is_app(); | 103 info->is_app = extension.is_app(); |
| 104 if (info->is_app) { |
| 105 if (extension.is_packaged_app()) |
| 106 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; |
| 107 else if (extension.is_hosted_app()) |
| 108 info->type = ExtensionInfo::TYPE_HOSTED_APP; |
| 109 else |
| 110 info->type = ExtensionInfo::TYPE_NEW_PACKAGED_APP; |
| 111 } else if (extension.is_theme()) { |
| 112 info->type = ExtensionInfo::TYPE_THEME; |
| 113 } else { |
| 114 info->type = ExtensionInfo::TYPE_EXTENSION; |
| 115 } |
102 | 116 |
103 if (info->enabled) { | 117 if (info->enabled) { |
104 info->disabled_reason = management::ExtensionInfo::DISABLED_REASON_NONE; | 118 info->disabled_reason = management::ExtensionInfo::DISABLED_REASON_NONE; |
105 } else { | 119 } else { |
106 extensions::ExtensionPrefs* prefs = service->extension_prefs(); | 120 extensions::ExtensionPrefs* prefs = service->extension_prefs(); |
107 if (prefs->DidExtensionEscalatePermissions(extension.id())) { | 121 if (prefs->DidExtensionEscalatePermissions(extension.id())) { |
108 info->disabled_reason = | 122 info->disabled_reason = |
109 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; | 123 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; |
110 } else { | 124 } else { |
111 info->disabled_reason = | 125 info->disabled_reason = |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 } | 643 } |
630 CHECK(extension); | 644 CHECK(extension); |
631 scoped_ptr<management::ExtensionInfo> info = CreateExtensionInfo( | 645 scoped_ptr<management::ExtensionInfo> info = CreateExtensionInfo( |
632 *extension, ExtensionSystem::Get(profile)); | 646 *extension, ExtensionSystem::Get(profile)); |
633 args->Append(info->ToValue().release()); | 647 args->Append(info->ToValue().release()); |
634 } | 648 } |
635 | 649 |
636 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 650 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
637 event_name, args.Pass(), NULL, GURL(), extensions::EventFilteringInfo()); | 651 event_name, args.Pass(), NULL, GURL(), extensions::EventFilteringInfo()); |
638 } | 652 } |
OLD | NEW |