| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace extensions { | 35 namespace extensions { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 const char kAllHostsPermission[] = "*://*/*"; | 39 const char kAllHostsPermission[] = "*://*/*"; |
| 40 | 40 |
| 41 bool CheckSocketPermission( | 41 bool CheckSocketPermission( |
| 42 scoped_refptr<Extension> extension, | 42 scoped_refptr<Extension> extension, |
| 43 SocketPermissionRequest::OperationType type, | 43 SocketPermissionRequest::OperationType type, |
| 44 const char* host, | 44 const char* host, |
| 45 int port) { | 45 uint16 port) { |
| 46 SocketPermission::CheckParam param(type, host, port); | 46 SocketPermission::CheckParam param(type, host, port); |
| 47 return extension->permissions_data()->CheckAPIPermissionWithParam( | 47 return extension->permissions_data()->CheckAPIPermissionWithParam( |
| 48 APIPermission::kSocket, ¶m); | 48 APIPermission::kSocket, ¶m); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Creates and returns an extension with the given |id|, |host_permissions|, and | 51 // Creates and returns an extension with the given |id|, |host_permissions|, and |
| 52 // manifest |location|. | 52 // manifest |location|. |
| 53 scoped_refptr<const Extension> GetExtensionWithHostPermission( | 53 scoped_refptr<const Extension> GetExtensionWithHostPermission( |
| 54 const std::string& id, | 54 const std::string& id, |
| 55 const std::string& host_permissions, | 55 const std::string& host_permissions, |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 | 744 |
| 745 permissions_data->ClearTabSpecificPermissions(1); | 745 permissions_data->ClearTabSpecificPermissions(1); |
| 746 EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(1).get()); | 746 EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(1).get()); |
| 747 | 747 |
| 748 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 0)); | 748 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 0)); |
| 749 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 1)); | 749 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 1)); |
| 750 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 2)); | 750 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 2)); |
| 751 } | 751 } |
| 752 | 752 |
| 753 } // namespace extensions | 753 } // namespace extensions |
| OLD | NEW |