summaryrefslogtreecommitdiffstats
path: root/extensions/common/permissions
diff options
context:
space:
mode:
authortreib <treib@chromium.org>2015-08-20 04:23:31 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-20 11:24:15 +0000
commita27148197ec0834b2bd74f1467d00ced0f1e1860 (patch)
treea12cc832d2744d063fbcfbb25ba906f0e26e048b /extensions/common/permissions
parent3bcb0ad7800e5a00f12c8aca1a71c91ea45df915 (diff)
downloadchromium_src-a27148197ec0834b2bd74f1467d00ced0f1e1860.zip
chromium_src-a27148197ec0834b2bd74f1467d00ced0f1e1860.tar.gz
chromium_src-a27148197ec0834b2bd74f1467d00ced0f1e1860.tar.bz2
Extensions: Remove the legacy GetMessages/HasMessages
from APIPermission and ManifestPermission [This is part 4 of operation "remove the old permission message system".] BUG=398257 Review URL: https://codereview.chromium.org/1213603004 Cr-Commit-Position: refs/heads/master@{#344475}
Diffstat (limited to 'extensions/common/permissions')
-rw-r--r--extensions/common/permissions/api_permission.cc22
-rw-r--r--extensions/common/permissions/api_permission.h27
-rw-r--r--extensions/common/permissions/api_permission_set.cc16
-rw-r--r--extensions/common/permissions/api_permission_set.h10
-rw-r--r--extensions/common/permissions/extensions_api_permissions.cc75
-rw-r--r--extensions/common/permissions/manifest_permission.h11
-rw-r--r--extensions/common/permissions/manifest_permission_set_unittest.cc6
-rw-r--r--extensions/common/permissions/media_galleries_permission.cc8
-rw-r--r--extensions/common/permissions/media_galleries_permission.h1
-rw-r--r--extensions/common/permissions/permission_message_test_util.cc2
-rw-r--r--extensions/common/permissions/set_disjunction_permission.h2
-rw-r--r--extensions/common/permissions/settings_override_permission.cc33
-rw-r--r--extensions/common/permissions/settings_override_permission.h2
-rw-r--r--extensions/common/permissions/socket_permission.cc8
-rw-r--r--extensions/common/permissions/socket_permission.h2
-rw-r--r--extensions/common/permissions/usb_device_permission.cc7
-rw-r--r--extensions/common/permissions/usb_device_permission.h1
-rw-r--r--extensions/common/permissions/usb_device_permission_unittest.cc93
18 files changed, 20 insertions, 306 deletions
diff --git a/extensions/common/permissions/api_permission.cc b/extensions/common/permissions/api_permission.cc
index 7d8f04e..70b71ce 100644
--- a/extensions/common/permissions/api_permission.cc
+++ b/extensions/common/permissions/api_permission.cc
@@ -27,17 +27,6 @@ class SimpleAPIPermission : public APIPermission {
return permissions;
}
- bool HasMessages() const override {
- return info()->message_id() > PermissionMessage::kNone;
- }
-
- PermissionMessages GetMessages() const override {
- DCHECK(HasMessages());
- PermissionMessages result;
- result.push_back(GetMessage_());
- return result;
- }
-
bool Check(const APIPermission::CheckParam* param) const override {
return !param;
}
@@ -110,10 +99,6 @@ const char* APIPermission::name() const {
return info()->name();
}
-PermissionMessage APIPermission::GetMessage_() const {
- return info()->GetMessage_();
-}
-
//
// APIPermissionInfo
//
@@ -122,8 +107,6 @@ APIPermissionInfo::APIPermissionInfo(const APIPermissionInfo::InitInfo& info)
: id_(info.id),
name_(info.name),
flags_(info.flags),
- l10n_message_id_(info.l10n_message_id),
- message_id_(info.message_id ? info.message_id : PermissionMessage::kNone),
api_permission_constructor_(info.constructor) {
}
@@ -134,9 +117,4 @@ APIPermission* APIPermissionInfo::CreateAPIPermission() const {
api_permission_constructor_(this) : new SimpleAPIPermission(this);
}
-PermissionMessage APIPermissionInfo::GetMessage_() const {
- return PermissionMessage(
- message_id_, l10n_util::GetStringUTF16(l10n_message_id_));
-}
-
} // namespace extensions
diff --git a/extensions/common/permissions/api_permission.h b/extensions/common/permissions/api_permission.h
index bf25a1b..8600454 100644
--- a/extensions/common/permissions/api_permission.h
+++ b/extensions/common/permissions/api_permission.h
@@ -5,7 +5,6 @@
#ifndef EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_
#define EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_
-#include <map>
#include <set>
#include <string>
#include <vector>
@@ -288,14 +287,6 @@ class APIPermission {
// ChromePermissionMessageProvider.
virtual PermissionIDSet GetPermissions() const = 0;
- // Returns true if this permission has any PermissionMessages.
- // TODO(sashab): Deprecate this in favor of GetPermissions() above.
- virtual bool HasMessages() const = 0;
-
- // Returns the localized permission messages of this permission.
- // TODO(sashab): Deprecate this in favor of GetPermissions() above.
- virtual PermissionMessages GetMessages() const = 0;
-
// Returns true if the given permission is allowed.
virtual bool Check(const CheckParam* param) const = 0;
@@ -339,11 +330,6 @@ class APIPermission {
// Logs this permission.
virtual void Log(std::string* log) const = 0;
- protected:
- // Returns the localized permission message associated with this api.
- // Use GetMessage_ to avoid name conflict with macro GetMessage on Windows.
- PermissionMessage GetMessage_() const;
-
private:
const APIPermissionInfo* const info_;
};
@@ -388,11 +374,6 @@ class APIPermissionInfo {
APIPermission::ID id() const { return id_; }
- // Returns the message id associated with this permission.
- PermissionMessage::ID message_id() const {
- return message_id_;
- }
-
// Returns the name of this permission.
const char* name() const { return name_; }
@@ -440,22 +421,14 @@ class APIPermissionInfo {
APIPermission::ID id;
const char* name;
int flags;
- int l10n_message_id;
- PermissionMessage::ID message_id;
APIPermissionInfo::APIPermissionConstructor constructor;
};
explicit APIPermissionInfo(const InitInfo& info);
- // Returns the localized permission message associated with this api.
- // Use GetMessage_ to avoid name conflict with macro GetMessage on Windows.
- PermissionMessage GetMessage_() const;
-
const APIPermission::ID id_;
const char* const name_;
const int flags_;
- const int l10n_message_id_;
- const PermissionMessage::ID message_id_;
const APIPermissionConstructor api_permission_constructor_;
};
diff --git a/extensions/common/permissions/api_permission_set.cc b/extensions/common/permissions/api_permission_set.cc
index 562c730..82d2faa 100644
--- a/extensions/common/permissions/api_permission_set.cc
+++ b/extensions/common/permissions/api_permission_set.cc
@@ -212,7 +212,7 @@ PermissionIDSet::~PermissionIDSet() {
}
void PermissionIDSet::insert(APIPermission::ID permission_id) {
- permissions_.insert(PermissionID(permission_id, base::string16()));
+ insert(permission_id, base::string16());
}
void PermissionIDSet::insert(APIPermission::ID permission_id,
@@ -280,20 +280,6 @@ PermissionIDSet PermissionIDSet::Difference(const PermissionIDSet& set_1,
set_1.permissions_, set_2.permissions_));
}
-// static
-PermissionIDSet PermissionIDSet::Intersection(const PermissionIDSet& set_1,
- const PermissionIDSet& set_2) {
- return PermissionIDSet(base::STLSetIntersection<std::set<PermissionID>>(
- set_1.permissions_, set_2.permissions_));
-}
-
-// static
-PermissionIDSet PermissionIDSet::Union(const PermissionIDSet& set_1,
- const PermissionIDSet& set_2) {
- return PermissionIDSet(base::STLSetUnion<std::set<PermissionID>>(
- set_1.permissions_, set_2.permissions_));
-}
-
size_t PermissionIDSet::size() const {
return permissions_.size();
}
diff --git a/extensions/common/permissions/api_permission_set.h b/extensions/common/permissions/api_permission_set.h
index f96c50e..476ad13 100644
--- a/extensions/common/permissions/api_permission_set.h
+++ b/extensions/common/permissions/api_permission_set.h
@@ -5,7 +5,11 @@
#ifndef EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_SET_H_
#define EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_SET_H_
+#include <set>
+#include <string>
+#include <vector>
+#include "base/strings/string16.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/base_set_operators.h"
@@ -136,15 +140,11 @@ class PermissionIDSet {
PermissionIDSet GetAllPermissionsWithIDs(
const std::set<APIPermission::ID>& permission_ids) const;
- // Convenience functions that call their stl_util counterparts.
+ // Convenience functions for common set operations.
bool Includes(const PermissionIDSet& subset) const;
bool Equals(const PermissionIDSet& set) const;
static PermissionIDSet Difference(const PermissionIDSet& set_1,
const PermissionIDSet& set_2);
- static PermissionIDSet Intersection(const PermissionIDSet& set_1,
- const PermissionIDSet& set_2);
- static PermissionIDSet Union(const PermissionIDSet& set_1,
- const PermissionIDSet& set_2);
size_t size() const;
bool empty() const;
diff --git a/extensions/common/permissions/extensions_api_permissions.cc b/extensions/common/permissions/extensions_api_permissions.cc
index 3b21c61..6977f8f 100644
--- a/extensions/common/permissions/extensions_api_permissions.cc
+++ b/extensions/common/permissions/extensions_api_permissions.cc
@@ -33,9 +33,6 @@ std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions()
// WARNING: If you are modifying a permission message in this list, be sure to
// add the corresponding permission message rule to
// ChromePermissionMessageProvider::GetCoalescedPermissionMessages as well.
- // TODO(sashab): Remove all permission messages from this list, once
- // GetCoalescedPermissionMessages() is the only way of generating permission
- // messages.
APIPermissionInfo::InitInfo permissions_to_register[] = {
{APIPermission::kAlarms, "alarms"},
{APIPermission::kAlphaEnabled, "app.window.alpha"},
@@ -44,75 +41,43 @@ std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions()
"appview",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kAudio, "audio"},
- {APIPermission::kAudioCapture,
- "audioCapture",
- APIPermissionInfo::kFlagNone,
- IDS_EXTENSION_PROMPT_WARNING_AUDIO_CAPTURE,
- PermissionMessage::kAudioCapture},
+ {APIPermission::kAudioCapture, "audioCapture"},
{APIPermission::kBluetoothPrivate,
"bluetoothPrivate",
- APIPermissionInfo::kFlagCannotBeOptional,
- IDS_EXTENSION_PROMPT_WARNING_BLUETOOTH_PRIVATE,
- PermissionMessage::kBluetoothPrivate},
+ APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kClipboardRead,
"clipboardRead",
- APIPermissionInfo::kFlagSupportsContentCapabilities,
- IDS_EXTENSION_PROMPT_WARNING_CLIPBOARD,
- PermissionMessage::kClipboard},
+ APIPermissionInfo::kFlagSupportsContentCapabilities},
{APIPermission::kClipboardWrite,
"clipboardWrite",
APIPermissionInfo::kFlagSupportsContentCapabilities},
- {APIPermission::kDeclarativeWebRequest,
- "declarativeWebRequest",
- APIPermissionInfo::kFlagNone,
- IDS_EXTENSION_PROMPT_WARNING_DECLARATIVE_WEB_REQUEST,
- PermissionMessage::kDeclarativeWebRequest},
+ {APIPermission::kDeclarativeWebRequest, "declarativeWebRequest"},
{APIPermission::kDiagnostics,
"diagnostics",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kDns, "dns"},
- {APIPermission::kDocumentScan,
- "documentScan",
- APIPermissionInfo::kFlagNone,
- IDS_EXTENSION_PROMPT_WARNING_DOCUMENT_SCAN,
- PermissionMessage::kDocumentScan},
+ {APIPermission::kDocumentScan, "documentScan"},
{APIPermission::kExtensionView,
"extensionview",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kExternallyConnectableAllUrls,
"externally_connectable.all_urls"},
{APIPermission::kFullscreen, "app.window.fullscreen"},
- {APIPermission::kHid, "hid", APIPermissionInfo::kFlagNone},
+ {APIPermission::kHid, "hid"},
{APIPermission::kImeWindowEnabled, "app.window.ime"},
{APIPermission::kOverrideEscFullscreen,
"app.window.fullscreen.overrideEsc"},
{APIPermission::kIdle, "idle"},
- {APIPermission::kNetworkingConfig,
- "networking.config",
- APIPermissionInfo::kFlagNone,
- IDS_EXTENSION_PROMPT_WARNING_NETWORKING_CONFIG,
- PermissionMessage::kNetworkingConfig},
+ {APIPermission::kNetworkingConfig, "networking.config"},
{APIPermission::kNetworkingPrivate,
"networkingPrivate",
- APIPermissionInfo::kFlagCannotBeOptional,
- IDS_EXTENSION_PROMPT_WARNING_NETWORKING_PRIVATE,
- PermissionMessage::kNetworkingPrivate},
+ APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kPower, "power"},
{APIPermission::kPrinterProvider, "printerProvider"},
- {APIPermission::kSerial,
- "serial",
- APIPermissionInfo::kFlagNone,
- IDS_EXTENSION_PROMPT_WARNING_SERIAL,
- PermissionMessage::kSerial},
- // Because warning messages for the "socket" permission vary based
- // on the permissions parameters, no message ID or message text is
- // specified here. The message ID and text used will be
- // determined at run-time in the |SocketPermission| class.
+ {APIPermission::kSerial, "serial"},
{APIPermission::kSocket,
"socket",
APIPermissionInfo::kFlagCannotBeOptional,
- 0,
- PermissionMessage::kNone,
&CreateAPIPermission<SocketPermission>},
{APIPermission::kStorage, "storage"},
{APIPermission::kSystemCpu, "system.cpu"},
@@ -120,11 +85,7 @@ std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions()
{APIPermission::kSystemNetwork, "system.network"},
{APIPermission::kSystemDisplay, "system.display"},
{APIPermission::kSystemStorage, "system.storage"},
- {APIPermission::kU2fDevices,
- "u2fDevices",
- APIPermissionInfo::kFlagNone,
- IDS_EXTENSION_PROMPT_WARNING_U2F_DEVICES,
- PermissionMessage::kU2fDevices},
+ {APIPermission::kU2fDevices, "u2fDevices"},
{APIPermission::kUnlimitedStorage,
"unlimitedStorage",
APIPermissionInfo::kFlagCannotBeOptional |
@@ -133,28 +94,18 @@ std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions()
{APIPermission::kUsbDevice,
"usbDevices",
APIPermissionInfo::kFlagNone,
- 0,
- PermissionMessage::kNone,
&CreateAPIPermission<UsbDevicePermission>},
- {APIPermission::kVideoCapture,
- "videoCapture",
- APIPermissionInfo::kFlagNone,
- IDS_EXTENSION_PROMPT_WARNING_VIDEO_CAPTURE,
- PermissionMessage::kVideoCapture},
+ {APIPermission::kVideoCapture, "videoCapture"},
{APIPermission::kVpnProvider,
"vpnProvider",
- APIPermissionInfo::kFlagCannotBeOptional,
- IDS_EXTENSION_PROMPT_WARNING_VPN,
- PermissionMessage::kVpnProvider},
+ APIPermissionInfo::kFlagCannotBeOptional},
// NOTE(kalman): This is provided by a manifest property but needs to
// appear in the install permission dialogue, so we need a fake
// permission for it. See http://crbug.com/247857.
{APIPermission::kWebConnectable,
"webConnectable",
APIPermissionInfo::kFlagCannotBeOptional |
- APIPermissionInfo::kFlagInternal,
- IDS_EXTENSION_PROMPT_WARNING_WEB_CONNECTABLE,
- PermissionMessage::kWebConnectable},
+ APIPermissionInfo::kFlagInternal},
{APIPermission::kWebRequest, "webRequest"},
{APIPermission::kWebRequestBlocking, "webRequestBlocking"},
{APIPermission::kWebView,
diff --git a/extensions/common/permissions/manifest_permission.h b/extensions/common/permissions/manifest_permission.h
index fded281..31e6ffc 100644
--- a/extensions/common/permissions/manifest_permission.h
+++ b/extensions/common/permissions/manifest_permission.h
@@ -15,7 +15,6 @@
namespace base {
class PickleIterator;
-class ListValue;
class Value;
}
@@ -43,16 +42,6 @@ class ManifestPermission {
// for the app.
virtual PermissionIDSet GetPermissions() const = 0;
- // Returns true if this permission has any PermissionMessages.
- // TODO(sashab): Deprecate this, using GetPermissions() above and adding
- // message rules to ChromePermissionMessageProvider.
- virtual bool HasMessages() const = 0;
-
- // Returns the localized permission messages of this permission.
- // TODO(sashab): Deprecate this, using GetPermissions() above and adding
- // message rules to ChromePermissionMessageProvider.
- virtual PermissionMessages GetMessages() const = 0;
-
// Parses the ManifestPermission from |value|. Returns false if error happens.
virtual bool FromValue(const base::Value* value) = 0;
diff --git a/extensions/common/permissions/manifest_permission_set_unittest.cc b/extensions/common/permissions/manifest_permission_set_unittest.cc
index 5018ab2..f366036 100644
--- a/extensions/common/permissions/manifest_permission_set_unittest.cc
+++ b/extensions/common/permissions/manifest_permission_set_unittest.cc
@@ -23,12 +23,6 @@ class MockManifestPermission : public ManifestPermission {
PermissionIDSet GetPermissions() const override { return PermissionIDSet(); }
- bool HasMessages() const override { return false; }
-
- PermissionMessages GetMessages() const override {
- return PermissionMessages();
- }
-
bool FromValue(const base::Value* value) override { return true; }
scoped_ptr<base::Value> ToValue() const override {
diff --git a/extensions/common/permissions/media_galleries_permission.cc b/extensions/common/permissions/media_galleries_permission.cc
index 7f01332..864d13e 100644
--- a/extensions/common/permissions/media_galleries_permission.cc
+++ b/extensions/common/permissions/media_galleries_permission.cc
@@ -187,17 +187,9 @@ bool MediaGalleriesPermission::FromValue(
}
PermissionIDSet MediaGalleriesPermission::GetPermissions() const {
- DCHECK(HasMessages());
PermissionIDSet result;
AddPermissionsToLists(data_set_, &result, NULL);
return result;
}
-PermissionMessages MediaGalleriesPermission::GetMessages() const {
- DCHECK(HasMessages());
- PermissionMessages result;
- AddPermissionsToLists(data_set_, NULL, &result);
- return result;
-}
-
} // namespace extensions
diff --git a/extensions/common/permissions/media_galleries_permission.h b/extensions/common/permissions/media_galleries_permission.h
index e7764ab..0276454 100644
--- a/extensions/common/permissions/media_galleries_permission.h
+++ b/extensions/common/permissions/media_galleries_permission.h
@@ -44,7 +44,6 @@ class MediaGalleriesPermission
// APIPermission overrides.
PermissionIDSet GetPermissions() const override;
- PermissionMessages GetMessages() const override;
// Permission strings.
static const char kAllAutoDetectedPermission[];
diff --git a/extensions/common/permissions/permission_message_test_util.cc b/extensions/common/permissions/permission_message_test_util.cc
index 77ee5d6a..fb8a5bb 100644
--- a/extensions/common/permissions/permission_message_test_util.cc
+++ b/extensions/common/permissions/permission_message_test_util.cc
@@ -91,7 +91,7 @@ bool CheckThatSubmessagesMatch(
std::vector<base::string16> actual_sorted(actual_submessages);
std::sort(actual_sorted.begin(), actual_sorted.end());
- if (actual_sorted != actual_submessages) {
+ if (expected_sorted != actual_sorted) {
// This is always a failure, even within an EXPECT_FALSE.
// Message: Expected submessages for "Message" to be { "Foo" }, but got
// { "Bar", "Baz" }
diff --git a/extensions/common/permissions/set_disjunction_permission.h b/extensions/common/permissions/set_disjunction_permission.h
index 15625a1..00ffad7 100644
--- a/extensions/common/permissions/set_disjunction_permission.h
+++ b/extensions/common/permissions/set_disjunction_permission.h
@@ -34,8 +34,6 @@ class SetDisjunctionPermission : public APIPermission {
~SetDisjunctionPermission() override {}
// APIPermission overrides
- bool HasMessages() const override { return !data_set_.empty(); }
-
bool Check(const APIPermission::CheckParam* param) const override {
for (typename std::set<PermissionDataType>::const_iterator i =
data_set_.begin();
diff --git a/extensions/common/permissions/settings_override_permission.cc b/extensions/common/permissions/settings_override_permission.cc
index c45678c..b4cec3c 100644
--- a/extensions/common/permissions/settings_override_permission.cc
+++ b/extensions/common/permissions/settings_override_permission.cc
@@ -24,39 +24,6 @@ PermissionIDSet SettingsOverrideAPIPermission::GetPermissions() const {
return permissions;
}
-bool SettingsOverrideAPIPermission::HasMessages() const {
- return info()->message_id() > PermissionMessage::kNone;
-}
-
-PermissionMessages SettingsOverrideAPIPermission::GetMessages() const {
- DCHECK(HasMessages());
- int string_id = -1;
- // Warning: when modifying this function, be sure to modify the correct rule
- // in ChromePermissionMessageProvider.
- switch (id()) {
- case kHomepage: {
- string_id = IDS_EXTENSION_PROMPT_WARNING_HOME_PAGE_SETTING_OVERRIDE;
- break;
- }
- case kStartupPages: {
- string_id = IDS_EXTENSION_PROMPT_WARNING_START_PAGE_SETTING_OVERRIDE;
- break;
- }
- case kSearchProvider: {
- string_id = IDS_EXTENSION_PROMPT_WARNING_SEARCH_SETTINGS_OVERRIDE;
- break;
- }
- default:
- NOTREACHED();
- }
- PermissionMessages result;
- result.push_back(
- PermissionMessage(info()->message_id(),
- l10n_util::GetStringFUTF16(
- string_id, base::UTF8ToUTF16(setting_value_))));
- return result;
-}
-
bool SettingsOverrideAPIPermission::Check(
const APIPermission::CheckParam* param) const {
return (param == NULL);
diff --git a/extensions/common/permissions/settings_override_permission.h b/extensions/common/permissions/settings_override_permission.h
index 20910e3..8c0bb00 100644
--- a/extensions/common/permissions/settings_override_permission.h
+++ b/extensions/common/permissions/settings_override_permission.h
@@ -21,8 +21,6 @@ class SettingsOverrideAPIPermission : public APIPermission {
// APIPermission overrides.
PermissionIDSet GetPermissions() const override;
- bool HasMessages() const override;
- PermissionMessages GetMessages() const override;
bool Check(const APIPermission::CheckParam* param) const override;
bool Contains(const APIPermission* rhs) const override;
bool Equal(const APIPermission* rhs) const override;
diff --git a/extensions/common/permissions/socket_permission.cc b/extensions/common/permissions/socket_permission.cc
index e5fac9d..1826282 100644
--- a/extensions/common/permissions/socket_permission.cc
+++ b/extensions/common/permissions/socket_permission.cc
@@ -45,12 +45,4 @@ PermissionIDSet SocketPermission::GetPermissions() const {
return ids;
}
-PermissionMessages SocketPermission::GetMessages() const {
- DCHECK(HasMessages());
- PermissionMessages messages;
- SocketPermissionEntrySet entries = ExtractSocketEntries(data_set_);
- SocketsManifestPermission::AddSocketHostPermissions(entries, NULL, &messages);
- return messages;
-}
-
} // namespace extensions
diff --git a/extensions/common/permissions/socket_permission.h b/extensions/common/permissions/socket_permission.h
index c2c1156..d554293 100644
--- a/extensions/common/permissions/socket_permission.h
+++ b/extensions/common/permissions/socket_permission.h
@@ -29,8 +29,6 @@ class SocketPermission
~SocketPermission() override;
PermissionIDSet GetPermissions() const override;
- // Returns the localized permission messages of this permission.
- PermissionMessages GetMessages() const override;
private:
// Add all host messages for this manifest permission into the given lists.
diff --git a/extensions/common/permissions/usb_device_permission.cc b/extensions/common/permissions/usb_device_permission.cc
index 59b28d5..287cf24 100644
--- a/extensions/common/permissions/usb_device_permission.cc
+++ b/extensions/common/permissions/usb_device_permission.cc
@@ -146,11 +146,4 @@ PermissionIDSet UsbDevicePermission::GetPermissions() const {
return ids;
}
-PermissionMessages UsbDevicePermission::GetMessages() const {
- DCHECK(HasMessages());
- PermissionMessages messages;
- AddPermissionsToLists(data_set_, NULL, &messages);
- return messages;
-}
-
} // namespace extensions
diff --git a/extensions/common/permissions/usb_device_permission.h b/extensions/common/permissions/usb_device_permission.h
index 50ea79d..881d6dd 100644
--- a/extensions/common/permissions/usb_device_permission.h
+++ b/extensions/common/permissions/usb_device_permission.h
@@ -31,7 +31,6 @@ class UsbDevicePermission
// APIPermission overrides
PermissionIDSet GetPermissions() const override;
- PermissionMessages GetMessages() const override;
};
} // namespace extensions
diff --git a/extensions/common/permissions/usb_device_permission_unittest.cc b/extensions/common/permissions/usb_device_permission_unittest.cc
index 345a000..7397196 100644
--- a/extensions/common/permissions/usb_device_permission_unittest.cc
+++ b/extensions/common/permissions/usb_device_permission_unittest.cc
@@ -2,18 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <set>
-#include <string>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/pickle.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "extensions/common/permissions/api_permission.h"
-#include "extensions/common/permissions/permissions_info.h"
-#include "extensions/common/permissions/usb_device_permission.h"
#include "extensions/common/permissions/usb_device_permission_data.h"
-#include "ipc/ipc_message.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
@@ -27,86 +16,4 @@ TEST(USBDevicePermissionTest, PermissionDataOrder) {
UsbDevicePermissionData(0x02ad, 0x138c, 0));
}
-TEST(USBDevicePermissionTest, SingleDevicePermissionMessages) {
- const char* const kMessages[] = {
- "Access any PVR Mass Storage from HUMAX Co., Ltd. via USB",
- "Access USB devices from HUMAX Co., Ltd.",
- "Access USB devices from an unknown vendor",
- };
-
- {
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
- permission_list->Append(
- UsbDevicePermissionData(0x02ad, 0x138c, -1).ToValue().release());
-
- UsbDevicePermission permission(
- PermissionsInfo::GetInstance()->GetByID(APIPermission::kUsbDevice));
- ASSERT_TRUE(permission.FromValue(permission_list.get(), NULL, NULL));
-
- PermissionMessages messages = permission.GetMessages();
- ASSERT_EQ(1U, messages.size());
- EXPECT_EQ(base::ASCIIToUTF16(kMessages[0]), messages.at(0).message());
- }
- {
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
- permission_list->Append(
- UsbDevicePermissionData(0x02ad, 0x138d, -1).ToValue().release());
-
- UsbDevicePermission permission(
- PermissionsInfo::GetInstance()->GetByID(APIPermission::kUsbDevice));
- ASSERT_TRUE(permission.FromValue(permission_list.get(), NULL, NULL));
-
- PermissionMessages messages = permission.GetMessages();
- ASSERT_EQ(1U, messages.size());
- EXPECT_EQ(base::ASCIIToUTF16(kMessages[1]), messages.at(0).message());
- }
- {
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
- permission_list->Append(
- UsbDevicePermissionData(0x02ae, 0x138d, -1).ToValue().release());
-
- UsbDevicePermission permission(
- PermissionsInfo::GetInstance()->GetByID(APIPermission::kUsbDevice));
- ASSERT_TRUE(permission.FromValue(permission_list.get(), NULL, NULL));
-
- PermissionMessages messages = permission.GetMessages();
- ASSERT_EQ(1U, messages.size());
- EXPECT_EQ(base::ASCIIToUTF16(kMessages[2]), messages.at(0).message());
- }
-}
-
-TEST(USBDevicePermissionTest, MultipleDevicePermissionMessage) {
- const char* const kMessage = "Access any of these USB devices";
- const char* const kDetails =
- "PVR Mass Storage from HUMAX Co., Ltd.\n"
- "unknown devices from HUMAX Co., Ltd.\n"
- "devices from an unknown vendor";
-
- // Prepare data set
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
- permission_list->Append(
- UsbDevicePermissionData(0x02ad, 0x138c, -1).ToValue().release());
- // This device's product ID is not in Chrome's database.
- permission_list->Append(
- UsbDevicePermissionData(0x02ad, 0x138d, -1).ToValue().release());
- // This additional unknown product will be collapsed into the entry above.
- permission_list->Append(
- UsbDevicePermissionData(0x02ad, 0x138e, -1).ToValue().release());
- // This device's vendor ID is not in Chrome's database.
- permission_list->Append(
- UsbDevicePermissionData(0x02ae, 0x138d, -1).ToValue().release());
- // This additional unknown vendor will be collapsed into the entry above.
- permission_list->Append(
- UsbDevicePermissionData(0x02af, 0x138d, -1).ToValue().release());
-
- UsbDevicePermission permission(
- PermissionsInfo::GetInstance()->GetByID(APIPermission::kUsbDevice));
- ASSERT_TRUE(permission.FromValue(permission_list.get(), NULL, NULL));
-
- PermissionMessages messages = permission.GetMessages();
- ASSERT_EQ(1U, messages.size());
- EXPECT_EQ(base::ASCIIToUTF16(kMessage), messages.at(0).message());
- EXPECT_EQ(base::ASCIIToUTF16(kDetails), messages.at(0).details());
-}
-
} // namespace extensions