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

Side by Side Diff: chrome/browser/extensions/extension_management_api.cc

Issue 10750010: Add an installType property to the management API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
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/browser/extensions/extension_management_api.h" 5 #include "chrome/browser/extensions/extension_management_api.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 for (host_perms_iter = host_perms.begin(); 136 for (host_perms_iter = host_perms.begin();
137 host_perms_iter != host_perms.end(); 137 host_perms_iter != host_perms.end();
138 ++host_perms_iter) { 138 ++host_perms_iter) {
139 StringValue* name = new StringValue(host_perms_iter->GetAsString()); 139 StringValue* name = new StringValue(host_perms_iter->GetAsString());
140 host_permission_list->Append(name); 140 host_permission_list->Append(name);
141 } 141 }
142 } 142 }
143 } 143 }
144 info->Set(keys::kHostPermissionsKey, host_permission_list); 144 info->Set(keys::kHostPermissionsKey, host_permission_list);
145 145
146 std::string install_type = keys::kInstallTypeOther;
147 switch (extension.location()) {
148 case Extension::INTERNAL:
149 install_type = keys::kInstallTypeNormal;
150 break;
151 case Extension::LOAD:
152 install_type = keys::kInstallTypeDevelopment;
153 break;
154 case Extension::EXTERNAL_PREF:
155 case Extension::EXTERNAL_REGISTRY:
156 case Extension::EXTERNAL_PREF_DOWNLOAD:
157 case Extension::EXTERNAL_POLICY_DOWNLOAD:
158 install_type = keys::kInstallTypeSideload;
159 break;
160 default:
161 install_type = keys::kInstallTypeOther;
162 }
163 info->SetString(keys::kInstallTypeKey, install_type);
164
146 return info; 165 return info;
147 } 166 }
148 167
149 static void AddExtensionInfo(ListValue* list, 168 static void AddExtensionInfo(ListValue* list,
150 const ExtensionSet& extensions, 169 const ExtensionSet& extensions,
151 ExtensionService* service) { 170 ExtensionService* service) {
152 for (ExtensionSet::const_iterator i = extensions.begin(); 171 for (ExtensionSet::const_iterator i = extensions.begin();
153 i != extensions.end(); ++i) { 172 i != extensions.end(); ++i) {
154 const Extension& extension = **i; 173 const Extension& extension = **i;
155 174
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 ExtensionService* service = profile->GetExtensionService(); 604 ExtensionService* service = profile->GetExtensionService();
586 args.Append(CreateExtensionInfo(*extension, service)); 605 args.Append(CreateExtensionInfo(*extension, service));
587 } 606 }
588 607
589 std::string args_json; 608 std::string args_json;
590 base::JSONWriter::Write(&args, &args_json); 609 base::JSONWriter::Write(&args, &args_json);
591 610
592 profile->GetExtensionEventRouter()->DispatchEventToRenderers( 611 profile->GetExtensionEventRouter()->DispatchEventToRenderers(
593 event_name, args_json, NULL, GURL(), extensions::EventFilteringInfo()); 612 event_name, args_json, NULL, GURL(), extensions::EventFilteringInfo());
594 } 613 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698