| OLD | NEW | 
|    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2011 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   84       Extension::Icons size = static_cast<Extension::Icons>(icon_iter->first); |   84       Extension::Icons size = static_cast<Extension::Icons>(icon_iter->first); | 
|   85       GURL url = ExtensionIconSource::GetIconURL( |   85       GURL url = ExtensionIconSource::GetIconURL( | 
|   86           &extension, size, ExtensionIconSet::MATCH_EXACTLY, false); |   86           &extension, size, ExtensionIconSet::MATCH_EXACTLY, false); | 
|   87       icon_info->SetInteger(kSizeKey, icon_iter->first); |   87       icon_info->SetInteger(kSizeKey, icon_iter->first); | 
|   88       icon_info->SetString(kUrlKey, url.spec()); |   88       icon_info->SetString(kUrlKey, url.spec()); | 
|   89       icon_list->Append(icon_info); |   89       icon_list->Append(icon_info); | 
|   90     } |   90     } | 
|   91     info->Set("icons", icon_list); |   91     info->Set("icons", icon_list); | 
|   92   } |   92   } | 
|   93  |   93  | 
|   94   const std::set<std::string> perms = extension.api_permissions(); |   94   const std::set<std::string> perms = | 
 |   95       extension.permission_set()->GetAPIsAsStrings(); | 
|   95   ListValue* permission_list = new ListValue(); |   96   ListValue* permission_list = new ListValue(); | 
|   96   if (!perms.empty()) { |   97   if (!perms.empty()) { | 
|   97     std::set<std::string>::const_iterator perms_iter; |   98     std::set<std::string>::const_iterator perms_iter; | 
|   98     for (perms_iter = perms.begin(); perms_iter != perms.end(); ++perms_iter) { |   99     for (perms_iter = perms.begin(); perms_iter != perms.end(); ++perms_iter) { | 
|   99       StringValue* permission_name = new StringValue(*perms_iter); |  100       StringValue* permission_name = new StringValue(*perms_iter); | 
|  100       permission_list->Append(permission_name); |  101       permission_list->Append(permission_name); | 
|  101     } |  102     } | 
|  102   } |  103   } | 
|  103   info->Set("permissions", permission_list); |  104   info->Set("permissions", permission_list); | 
|  104  |  105  | 
|  105   ListValue* host_permission_list = new ListValue(); |  106   ListValue* host_permission_list = new ListValue(); | 
|  106   if (!extension.is_hosted_app()) { |  107   if (!extension.is_hosted_app()) { | 
|  107     // Skip host permissions for hosted apps. |  108     // Skip host permissions for hosted apps. | 
|  108     const URLPatternList host_perms = extension.host_permissions(); |  109     const URLPatternList host_perms = | 
 |  110         extension.permission_set()->explicit_hosts().patterns(); | 
|  109     if (!host_perms.empty()) { |  111     if (!host_perms.empty()) { | 
|  110       URLPatternList::const_iterator host_perms_iter; |  112       URLPatternList::const_iterator host_perms_iter; | 
|  111       for (host_perms_iter = host_perms.begin(); |  113       for (host_perms_iter = host_perms.begin(); | 
|  112            host_perms_iter != host_perms.end(); |  114            host_perms_iter != host_perms.end(); | 
|  113            ++host_perms_iter) { |  115            ++host_perms_iter) { | 
|  114         StringValue* name = new StringValue(host_perms_iter->GetAsString()); |  116         StringValue* name = new StringValue(host_perms_iter->GetAsString()); | 
|  115         host_permission_list->Append(name); |  117         host_permission_list->Append(name); | 
|  116       } |  118       } | 
|  117     } |  119     } | 
|  118   } |  120   } | 
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  318     bool enabled = service->GetExtensionById(extension->id(), false) != NULL; |  320     bool enabled = service->GetExtensionById(extension->id(), false) != NULL; | 
|  319     args.Append(CreateExtensionInfo(*extension, enabled)); |  321     args.Append(CreateExtensionInfo(*extension, enabled)); | 
|  320   } |  322   } | 
|  321  |  323  | 
|  322   std::string args_json; |  324   std::string args_json; | 
|  323   base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); |  325   base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); | 
|  324  |  326  | 
|  325   profile->GetExtensionEventRouter()->DispatchEventToRenderers( |  327   profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 
|  326       event_name, args_json, NULL, GURL()); |  328       event_name, args_json, NULL, GURL()); | 
|  327 } |  329 } | 
| OLD | NEW |