Index: chrome/browser/extensions/blocked_actions.h |
=================================================================== |
--- chrome/browser/extensions/blocked_actions.h (revision 0) |
+++ chrome/browser/extensions/blocked_actions.h (revision 0) |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// User of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_BLOCKED_ACTIONS_H_ |
+#define CHROME_BROWSER_EXTENSIONS_BLOCKED_ACTIONS_H_ |
+ |
+#include <string> |
+#include "base/time.h" |
+#include "chrome/browser/extensions/activity_actions.h" |
+ |
+namespace extensions { |
+ |
+// This class describes API calls that ran into permissions or quots problems. |
+// See ManagerActions for API calls that succeeded. |
+class BlockedAction : public Action, |
+ public base::RefCountedThreadSafe<BlockedAction> { |
+ public: |
+ static const char* kTableName; |
+ static const char* kTableStructure; |
+ |
+ BlockedAction(const std::string& extension_id, |
+ const std::string& blocked_action, |
+ const std::string& reason, |
+ const base::Time& time); |
+ |
+ // Print a BlockedAction with il8n substitutions for display. |
+ virtual std::string PrettyPrintFori18n() OVERRIDE; |
+ |
+ // Print a BlockedAction as a regular string for debugging purposes. |
+ virtual std::string PrettyPrintForDebug() OVERRIDE; |
+ |
+ // Helper methods for recording the values into the db. |
+ const std::string& extension_id() const { return extension_id_; } |
+ const base::Time& time() const { return time_; } |
+ const std::string& reason() const { return reason_; } |
+ const std::string& blocked_action() const { return blocked_action_; } |
+ |
+ protected: |
+ virtual ~BlockedAction(); |
+ |
+ private: |
+ friend class base::RefCountedThreadSafe<BlockedAction>; |
+ |
+ std::string extension_id_; |
+ std::string blocked_action_; |
+ std::string reason_; |
+ base::Time time_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BlockedAction); |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_BLOCKED_ACTIONS_H_ |
+ |