OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/autotest_private/autotest_private_api.h" | 5 #include "chrome/browser/extensions/api/autotest_private/autotest_private_api.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { | 42 base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { |
43 const PermissionsData* permissions_data = ext->permissions_data(); | 43 const PermissionsData* permissions_data = ext->permissions_data(); |
44 const URLPatternSet& pattern_set = | 44 const URLPatternSet& pattern_set = |
45 effective_perm ? permissions_data->GetEffectiveHostPermissions() | 45 effective_perm ? permissions_data->GetEffectiveHostPermissions() |
46 : permissions_data->active_permissions().explicit_hosts(); | 46 : permissions_data->active_permissions().explicit_hosts(); |
47 | 47 |
48 base::ListValue* permissions = new base::ListValue; | 48 base::ListValue* permissions = new base::ListValue; |
49 for (URLPatternSet::const_iterator perm = pattern_set.begin(); | 49 for (URLPatternSet::const_iterator perm = pattern_set.begin(); |
50 perm != pattern_set.end(); | 50 perm != pattern_set.end(); |
51 ++perm) { | 51 ++perm) { |
52 permissions->Append(new base::StringValue(perm->GetAsString())); | 52 permissions->AppendString(perm->GetAsString()); |
53 } | 53 } |
54 | 54 |
55 return permissions; | 55 return permissions; |
56 } | 56 } |
57 | 57 |
58 base::ListValue* GetAPIPermissions(const Extension* ext) { | 58 base::ListValue* GetAPIPermissions(const Extension* ext) { |
59 base::ListValue* permissions = new base::ListValue; | 59 base::ListValue* permissions = new base::ListValue; |
60 std::set<std::string> perm_list = | 60 std::set<std::string> perm_list = |
61 ext->permissions_data()->active_permissions().GetAPIsAsStrings(); | 61 ext->permissions_data()->active_permissions().GetAPIsAsStrings(); |
62 for (std::set<std::string>::const_iterator perm = perm_list.begin(); | 62 for (std::set<std::string>::const_iterator perm = perm_list.begin(); |
63 perm != perm_list.end(); ++perm) { | 63 perm != perm_list.end(); ++perm) { |
64 permissions->Append(new base::StringValue(perm->c_str())); | 64 permissions->AppendString(perm->c_str()); |
65 } | 65 } |
66 return permissions; | 66 return permissions; |
67 } | 67 } |
68 | 68 |
69 bool IsTestMode(Profile* profile) { | 69 bool IsTestMode(Profile* profile) { |
70 return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode(); | 70 return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode(); |
71 } | 71 } |
72 | 72 |
73 } // namespace | 73 } // namespace |
74 | 74 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 return new AutotestPrivateAPI(); | 387 return new AutotestPrivateAPI(); |
388 } | 388 } |
389 | 389 |
390 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { | 390 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { |
391 } | 391 } |
392 | 392 |
393 AutotestPrivateAPI::~AutotestPrivateAPI() { | 393 AutotestPrivateAPI::~AutotestPrivateAPI() { |
394 } | 394 } |
395 | 395 |
396 } // namespace extensions | 396 } // namespace extensions |
OLD | NEW |