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

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: Cleanup and update ExtensionPermissionSet data model. 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 3984 matching lines...) Expand 10 before | Expand all | Expand 10 after
3995 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); 3995 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
3996 } 3996 }
3997 3997
3998 namespace { 3998 namespace {
3999 3999
4000 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { 4000 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) {
4001 URLPatternList pattern_list; 4001 URLPatternList pattern_list;
4002 if (effective_perm) 4002 if (effective_perm)
4003 pattern_list = ext->GetEffectiveHostPermissions().patterns(); 4003 pattern_list = ext->GetEffectiveHostPermissions().patterns();
4004 else 4004 else
4005 pattern_list = ext->host_permissions(); 4005 pattern_list = ext->permission_set()->explicit_hosts().patterns();
4006 4006
4007 ListValue* permissions = new ListValue; 4007 ListValue* permissions = new ListValue;
4008 for (URLPatternList::const_iterator perm = pattern_list.begin(); 4008 for (URLPatternList::const_iterator perm = pattern_list.begin();
4009 perm != pattern_list.end(); ++perm) { 4009 perm != pattern_list.end(); ++perm) {
4010 permissions->Append(new StringValue(perm->GetAsString())); 4010 permissions->Append(new StringValue(perm->GetAsString()));
4011 } 4011 }
4012 4012
4013 return permissions; 4013 return permissions;
4014 } 4014 }
4015 4015
4016 ListValue* GetAPIPermissions(const Extension* ext) { 4016 ListValue* GetAPIPermissions(const Extension* ext) {
4017 ListValue* permissions = new ListValue; 4017 ListValue* permissions = new ListValue;
4018 std::set<std::string> perm_list = ext->api_permissions(); 4018 std::set<std::string> perm_list = ext->permission_set()->GetAPIsAsStrings();
4019 for (std::set<std::string>::const_iterator perm = perm_list.begin(); 4019 for (std::set<std::string>::const_iterator perm = perm_list.begin();
4020 perm != perm_list.end(); ++perm) { 4020 perm != perm_list.end(); ++perm) {
4021 permissions->Append(new StringValue(perm->c_str())); 4021 permissions->Append(new StringValue(perm->c_str()));
4022 } 4022 }
4023 return permissions; 4023 return permissions;
4024 } 4024 }
4025 4025
4026 } // namespace 4026 } // namespace
4027 4027
4028 // Sample json input: { "command": "GetExtensionsInfo" } 4028 // Sample json input: { "command": "GetExtensionsInfo" }
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
5899 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); 5899 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl);
5900 5900
5901 Send(reply_message_); 5901 Send(reply_message_);
5902 redirect_query_ = 0; 5902 redirect_query_ = 0;
5903 reply_message_ = NULL; 5903 reply_message_ = NULL;
5904 } 5904 }
5905 5905
5906 void TestingAutomationProvider::OnRemoveProvider() { 5906 void TestingAutomationProvider::OnRemoveProvider() {
5907 AutomationProviderList::GetInstance()->RemoveProvider(this); 5907 AutomationProviderList::GetInstance()->RemoveProvider(this);
5908 } 5908 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698