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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/browser/extensions/extension_action_manager.h" | 9 #include "chrome/browser/extensions/extension_action_manager.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 25 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
26 #include "chrome/browser/chromeos/login/users/user_manager.h" | 26 #include "chrome/browser/chromeos/login/users/user_manager.h" |
27 #include "chromeos/dbus/dbus_thread_manager.h" | 27 #include "chromeos/dbus/dbus_thread_manager.h" |
28 #include "chromeos/dbus/session_manager_client.h" | 28 #include "chromeos/dbus/session_manager_client.h" |
29 #endif | 29 #endif |
30 | 30 |
31 namespace extensions { | 31 namespace extensions { |
32 namespace { | 32 namespace { |
33 | 33 |
34 base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { | 34 base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { |
35 URLPatternSet pattern_set; | 35 const PermissionsData* permissions_data = ext->permissions_data(); |
36 if (effective_perm) | 36 const URLPatternSet& pattern_set = |
37 pattern_set = ext->permissions_data()->GetEffectiveHostPermissions(); | 37 effective_perm ? permissions_data->GetEffectiveHostPermissions() |
38 else | 38 : permissions_data->active_permissions()->explicit_hosts(); |
39 pattern_set = ext->GetActivePermissions()->explicit_hosts(); | |
40 | 39 |
41 base::ListValue* permissions = new base::ListValue; | 40 base::ListValue* permissions = new base::ListValue; |
42 for (URLPatternSet::const_iterator perm = pattern_set.begin(); | 41 for (URLPatternSet::const_iterator perm = pattern_set.begin(); |
43 perm != pattern_set.end(); | 42 perm != pattern_set.end(); |
44 ++perm) { | 43 ++perm) { |
45 permissions->Append(new base::StringValue(perm->GetAsString())); | 44 permissions->Append(new base::StringValue(perm->GetAsString())); |
46 } | 45 } |
47 | 46 |
48 return permissions; | 47 return permissions; |
49 } | 48 } |
50 | 49 |
51 base::ListValue* GetAPIPermissions(const Extension* ext) { | 50 base::ListValue* GetAPIPermissions(const Extension* ext) { |
52 base::ListValue* permissions = new base::ListValue; | 51 base::ListValue* permissions = new base::ListValue; |
53 std::set<std::string> perm_list = | 52 std::set<std::string> perm_list = |
54 ext->GetActivePermissions()->GetAPIsAsStrings(); | 53 ext->permissions_data()->active_permissions()->GetAPIsAsStrings(); |
55 for (std::set<std::string>::const_iterator perm = perm_list.begin(); | 54 for (std::set<std::string>::const_iterator perm = perm_list.begin(); |
56 perm != perm_list.end(); ++perm) { | 55 perm != perm_list.end(); ++perm) { |
57 permissions->Append(new base::StringValue(perm->c_str())); | 56 permissions->Append(new base::StringValue(perm->c_str())); |
58 } | 57 } |
59 return permissions; | 58 return permissions; |
60 } | 59 } |
61 | 60 |
62 bool IsTestMode(Profile* profile) { | 61 bool IsTestMode(Profile* profile) { |
63 return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode(); | 62 return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode(); |
64 } | 63 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return new AutotestPrivateAPI(); | 238 return new AutotestPrivateAPI(); |
240 } | 239 } |
241 | 240 |
242 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { | 241 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { |
243 } | 242 } |
244 | 243 |
245 AutotestPrivateAPI::~AutotestPrivateAPI() { | 244 AutotestPrivateAPI::~AutotestPrivateAPI() { |
246 } | 245 } |
247 | 246 |
248 } // namespace extensions | 247 } // namespace extensions |
OLD | NEW |