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

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: fix clang 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 4093 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); 4104 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
4105 } 4105 }
4106 4106
4107 namespace { 4107 namespace {
4108 4108
4109 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { 4109 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) {
4110 URLPatternSet pattern_set; 4110 URLPatternSet pattern_set;
4111 if (effective_perm) 4111 if (effective_perm)
4112 pattern_set = ext->GetEffectiveHostPermissions(); 4112 pattern_set = ext->GetEffectiveHostPermissions();
4113 else 4113 else
4114 pattern_set = ext->permission_set()->explicit_hosts(); 4114 pattern_set = ext->GetActivePermissions()->explicit_hosts();
4115 4115
4116 ListValue* permissions = new ListValue; 4116 ListValue* permissions = new ListValue;
4117 for (URLPatternSet::const_iterator perm = pattern_set.begin(); 4117 for (URLPatternSet::const_iterator perm = pattern_set.begin();
4118 perm != pattern_set.end(); ++perm) { 4118 perm != pattern_set.end(); ++perm) {
4119 permissions->Append(new StringValue(perm->GetAsString())); 4119 permissions->Append(new StringValue(perm->GetAsString()));
4120 } 4120 }
4121 4121
4122 return permissions; 4122 return permissions;
4123 } 4123 }
4124 4124
4125 ListValue* GetAPIPermissions(const Extension* ext) { 4125 ListValue* GetAPIPermissions(const Extension* ext) {
4126 ListValue* permissions = new ListValue; 4126 ListValue* permissions = new ListValue;
4127 std::set<std::string> perm_list = ext->permission_set()->GetAPIsAsStrings(); 4127 std::set<std::string> perm_list =
4128 ext->GetActivePermissions()->GetAPIsAsStrings();
4128 for (std::set<std::string>::const_iterator perm = perm_list.begin(); 4129 for (std::set<std::string>::const_iterator perm = perm_list.begin();
4129 perm != perm_list.end(); ++perm) { 4130 perm != perm_list.end(); ++perm) {
4130 permissions->Append(new StringValue(perm->c_str())); 4131 permissions->Append(new StringValue(perm->c_str()));
4131 } 4132 }
4132 return permissions; 4133 return permissions;
4133 } 4134 }
4134 4135
4135 } // namespace 4136 } // namespace
4136 4137
4137 // Sample json input: { "command": "GetExtensionsInfo" } 4138 // Sample json input: { "command": "GetExtensionsInfo" }
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after
6133 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); 6134 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl);
6134 6135
6135 Send(reply_message_); 6136 Send(reply_message_);
6136 redirect_query_ = 0; 6137 redirect_query_ = 0;
6137 reply_message_ = NULL; 6138 reply_message_ = NULL;
6138 } 6139 }
6139 6140
6140 void TestingAutomationProvider::OnRemoveProvider() { 6141 void TestingAutomationProvider::OnRemoveProvider() {
6141 AutomationProviderList::GetInstance()->RemoveProvider(this); 6142 AutomationProviderList::GetInstance()->RemoveProvider(this);
6142 } 6143 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/background/background_mode_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698