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

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

Issue 7003098: Start refractoring extension permissions into ExtensionPermissionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + small cleanup Created 9 years, 6 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 3993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4004 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); 4004 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
4005 } 4005 }
4006 4006
4007 namespace { 4007 namespace {
4008 4008
4009 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { 4009 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) {
4010 URLPatternList pattern_list; 4010 URLPatternList pattern_list;
4011 if (effective_perm) 4011 if (effective_perm)
4012 pattern_list = ext->GetEffectiveHostPermissions().patterns(); 4012 pattern_list = ext->GetEffectiveHostPermissions().patterns();
4013 else 4013 else
4014 pattern_list = ext->host_permissions(); 4014 pattern_list = ext->permission_set()->explicit_hosts().patterns();
4015 4015
4016 ListValue* permissions = new ListValue; 4016 ListValue* permissions = new ListValue;
4017 for (URLPatternList::const_iterator perm = pattern_list.begin(); 4017 for (URLPatternList::const_iterator perm = pattern_list.begin();
4018 perm != pattern_list.end(); ++perm) { 4018 perm != pattern_list.end(); ++perm) {
4019 permissions->Append(new StringValue(perm->GetAsString())); 4019 permissions->Append(new StringValue(perm->GetAsString()));
4020 } 4020 }
4021 4021
4022 return permissions; 4022 return permissions;
4023 } 4023 }
4024 4024
4025 ListValue* GetAPIPermissions(const Extension* ext) { 4025 ListValue* GetAPIPermissions(const Extension* ext) {
4026 ListValue* permissions = new ListValue; 4026 ListValue* permissions = new ListValue;
4027 std::set<std::string> perm_list = ext->api_permissions(); 4027 std::set<std::string> perm_list = ext->permission_set()->GetAPIsAsStrings();
4028 for (std::set<std::string>::const_iterator perm = perm_list.begin(); 4028 for (std::set<std::string>::const_iterator perm = perm_list.begin();
4029 perm != perm_list.end(); ++perm) { 4029 perm != perm_list.end(); ++perm) {
4030 permissions->Append(new StringValue(perm->c_str())); 4030 permissions->Append(new StringValue(perm->c_str()));
4031 } 4031 }
4032 return permissions; 4032 return permissions;
4033 } 4033 }
4034 4034
4035 } // namespace 4035 } // namespace
4036 4036
4037 // Sample json input: { "command": "GetExtensionsInfo" } 4037 // Sample json input: { "command": "GetExtensionsInfo" }
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
5908 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); 5908 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl);
5909 5909
5910 Send(reply_message_); 5910 Send(reply_message_);
5911 redirect_query_ = 0; 5911 redirect_query_ = 0;
5912 reply_message_ = NULL; 5912 reply_message_ = NULL;
5913 } 5913 }
5914 5914
5915 void TestingAutomationProvider::OnRemoveProvider() { 5915 void TestingAutomationProvider::OnRemoveProvider() {
5916 AutomationProviderList::GetInstance()->RemoveProvider(this); 5916 AutomationProviderList::GetInstance()->RemoveProvider(this);
5917 } 5917 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698