Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3931)

Unified Diff: chrome/common/extensions/permissions/permission_message.h

Issue 10649003: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase on HEAD Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/permissions/permission_message.h
diff --git a/chrome/common/extensions/permissions/permission_message.h b/chrome/common/extensions/permissions/permission_message.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8710af20b76882e8cf72534c9454f237a5213a8
--- /dev/null
+++ b/chrome/common/extensions/permissions/permission_message.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
+#define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
+#pragma once
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "base/string16.h"
+
+namespace extensions {
+
+// When prompting the user to install or approve permissions, we display
+// messages describing the effects of the permissions rather than listing the
+// permissions themselves. Each PermissionMessage represents one of the
+// messages shown to the user.
+class PermissionMessage {
+ public:
+ // Do not reorder this enumeration. If you need to add a new enum, add it just
+ // prior to kEnumBoundary.
+ enum ID {
+ kUnknown,
+ kNone,
+ kBookmarks,
+ kGeolocation,
+ kBrowsingHistory,
+ kTabs,
+ kManagement,
+ kDebugger,
+ kHosts1,
+ kHosts2,
+ kHosts3,
+ kHosts4OrMore,
+ kHostsAll,
+ kFullAccess,
+ kClipboard,
+ kTtsEngine,
+ kContentSettings,
+ kAllPageContent,
+ kPrivacy,
+ kManagedMode,
+ kInput,
+ kAudioCapture,
+ kVideoCapture,
+ kDownloads,
+ kEnumBoundary
+ };
+
+ // Creates the corresponding permission message for a list of hosts. This is
+ // simply a convenience method around the constructor, since the messages
+ // change depending on what hosts are present.
+ static PermissionMessage CreateFromHostList(
+ const std::set<std::string>& hosts);
+
+ // Creates the corresponding permission message.
+ PermissionMessage(ID id, const string16& message);
+ ~PermissionMessage();
+
+ // Gets the id of the permission message, which can be used in UMA
+ // histograms.
+ ID id() const { return id_; }
+
+ // Gets a localized message describing this permission. Please note that
+ // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN.
+ const string16& message() const { return message_; }
+
+ // Comparator to work with std::set.
+ bool operator<(const PermissionMessage& that) const {
+ return id_ < that.id_;
+ }
+
+ private:
+ ID id_;
+ string16 message_;
+};
+
+typedef std::vector<PermissionMessage> PermissionMessages;
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
« no previous file with comments | « chrome/common/extensions/permissions/api_permission.cc ('k') | chrome/common/extensions/permissions/permission_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698