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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 7432006: Add an experimental permissions API for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed a scoped_refptr Created 9 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 | Annotate | Revision Log
OLDNEW
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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 4070 matching lines...) Expand 10 before | Expand all | Expand 10 after
4081 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); 4081 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
4082 } 4082 }
4083 4083
4084 namespace { 4084 namespace {
4085 4085
4086 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { 4086 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) {
4087 URLPatternSet pattern_set; 4087 URLPatternSet pattern_set;
4088 if (effective_perm) 4088 if (effective_perm)
4089 pattern_set = ext->GetEffectiveHostPermissions(); 4089 pattern_set = ext->GetEffectiveHostPermissions();
4090 else 4090 else
4091 pattern_set = ext->permission_set()->explicit_hosts(); 4091 pattern_set = ext->GetActivePermissions()->explicit_hosts();
4092 4092
4093 ListValue* permissions = new ListValue; 4093 ListValue* permissions = new ListValue;
4094 for (URLPatternSet::const_iterator perm = pattern_set.begin(); 4094 for (URLPatternSet::const_iterator perm = pattern_set.begin();
4095 perm != pattern_set.end(); ++perm) { 4095 perm != pattern_set.end(); ++perm) {
4096 permissions->Append(new StringValue(perm->GetAsString())); 4096 permissions->Append(new StringValue(perm->GetAsString()));
4097 } 4097 }
4098 4098
4099 return permissions; 4099 return permissions;
4100 } 4100 }
4101 4101
4102 ListValue* GetAPIPermissions(const Extension* ext) { 4102 ListValue* GetAPIPermissions(const Extension* ext) {
4103 ListValue* permissions = new ListValue; 4103 ListValue* permissions = new ListValue;
4104 std::set<std::string> perm_list = ext->permission_set()->GetAPIsAsStrings(); 4104 std::set<std::string> perm_list =
4105 ext->GetActivePermissions()->GetAPIsAsStrings();
4105 for (std::set<std::string>::const_iterator perm = perm_list.begin(); 4106 for (std::set<std::string>::const_iterator perm = perm_list.begin();
4106 perm != perm_list.end(); ++perm) { 4107 perm != perm_list.end(); ++perm) {
4107 permissions->Append(new StringValue(perm->c_str())); 4108 permissions->Append(new StringValue(perm->c_str()));
4108 } 4109 }
4109 return permissions; 4110 return permissions;
4110 } 4111 }
4111 4112
4112 } // namespace 4113 } // namespace
4113 4114
4114 // Sample json input: { "command": "GetExtensionsInfo" } 4115 // Sample json input: { "command": "GetExtensionsInfo" }
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
6072 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); 6073 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl);
6073 6074
6074 Send(reply_message_); 6075 Send(reply_message_);
6075 redirect_query_ = 0; 6076 redirect_query_ = 0;
6076 reply_message_ = NULL; 6077 reply_message_ = NULL;
6077 } 6078 }
6078 6079
6079 void TestingAutomationProvider::OnRemoveProvider() { 6080 void TestingAutomationProvider::OnRemoveProvider() {
6080 AutomationProviderList::GetInstance()->RemoveProvider(this); 6081 AutomationProviderList::GetInstance()->RemoveProvider(this);
6081 } 6082 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698