| 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/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 4068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4079 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 4079 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
| 4080 } | 4080 } |
| 4081 | 4081 |
| 4082 namespace { | 4082 namespace { |
| 4083 | 4083 |
| 4084 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { | 4084 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { |
| 4085 URLPatternSet pattern_set; | 4085 URLPatternSet pattern_set; |
| 4086 if (effective_perm) | 4086 if (effective_perm) |
| 4087 pattern_set = ext->GetEffectiveHostPermissions(); | 4087 pattern_set = ext->GetEffectiveHostPermissions(); |
| 4088 else | 4088 else |
| 4089 pattern_set = ext->permission_set()->explicit_hosts(); | 4089 pattern_set = ext->GetActivePermissions()->explicit_hosts(); |
| 4090 | 4090 |
| 4091 ListValue* permissions = new ListValue; | 4091 ListValue* permissions = new ListValue; |
| 4092 for (URLPatternSet::const_iterator perm = pattern_set.begin(); | 4092 for (URLPatternSet::const_iterator perm = pattern_set.begin(); |
| 4093 perm != pattern_set.end(); ++perm) { | 4093 perm != pattern_set.end(); ++perm) { |
| 4094 permissions->Append(new StringValue(perm->GetAsString())); | 4094 permissions->Append(new StringValue(perm->GetAsString())); |
| 4095 } | 4095 } |
| 4096 | 4096 |
| 4097 return permissions; | 4097 return permissions; |
| 4098 } | 4098 } |
| 4099 | 4099 |
| 4100 ListValue* GetAPIPermissions(const Extension* ext) { | 4100 ListValue* GetAPIPermissions(const Extension* ext) { |
| 4101 ListValue* permissions = new ListValue; | 4101 ListValue* permissions = new ListValue; |
| 4102 std::set<std::string> perm_list = ext->permission_set()->GetAPIsAsStrings(); | 4102 std::set<std::string> perm_list = |
| 4103 ext->GetActivePermissions()->GetAPIsAsStrings(); |
| 4103 for (std::set<std::string>::const_iterator perm = perm_list.begin(); | 4104 for (std::set<std::string>::const_iterator perm = perm_list.begin(); |
| 4104 perm != perm_list.end(); ++perm) { | 4105 perm != perm_list.end(); ++perm) { |
| 4105 permissions->Append(new StringValue(perm->c_str())); | 4106 permissions->Append(new StringValue(perm->c_str())); |
| 4106 } | 4107 } |
| 4107 return permissions; | 4108 return permissions; |
| 4108 } | 4109 } |
| 4109 | 4110 |
| 4110 } // namespace | 4111 } // namespace |
| 4111 | 4112 |
| 4112 // Sample json input: { "command": "GetExtensionsInfo" } | 4113 // Sample json input: { "command": "GetExtensionsInfo" } |
| (...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6052 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6053 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
| 6053 | 6054 |
| 6054 Send(reply_message_); | 6055 Send(reply_message_); |
| 6055 redirect_query_ = 0; | 6056 redirect_query_ = 0; |
| 6056 reply_message_ = NULL; | 6057 reply_message_ = NULL; |
| 6057 } | 6058 } |
| 6058 | 6059 |
| 6059 void TestingAutomationProvider::OnRemoveProvider() { | 6060 void TestingAutomationProvider::OnRemoveProvider() { |
| 6060 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6061 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 6061 } | 6062 } |
| OLD | NEW |