OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_BLOCKED_ACTIONS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_BLOCKED_ACTIONS_H_ |
| 7 |
| 8 #include <string> |
| 9 #include "base/time.h" |
| 10 #include "chrome/browser/extensions/activity_actions.h" |
| 11 |
| 12 namespace extensions { |
| 13 |
| 14 // This class describes API calls that ran into permissions or quota problems. |
| 15 // See APIActions for API calls that succeeded. |
| 16 class BlockedAction : public Action { |
| 17 public: |
| 18 static const char* kTableName; |
| 19 static const char* kTableStructure; |
| 20 |
| 21 BlockedAction(const std::string& extension_id, |
| 22 const base::Time& time, |
| 23 const std::string& blocked_action, // the blocked API call |
| 24 const std::string& reason, // the reason it's blocked |
| 25 const std::string& extra); // any extra logging info |
| 26 |
| 27 // Record the action in the database. |
| 28 virtual void Record(sql::Connection* db) OVERRIDE; |
| 29 |
| 30 // Print a BlockedAction with il8n substitutions for display. |
| 31 virtual std::string PrettyPrintFori18n() OVERRIDE; |
| 32 |
| 33 // Print a BlockedAction as a regular string for debugging purposes. |
| 34 virtual std::string PrettyPrintForDebug() OVERRIDE; |
| 35 |
| 36 // Helper methods for recording the values into the db. |
| 37 const std::string& extension_id() const { return extension_id_; } |
| 38 const base::Time& time() const { return time_; } |
| 39 const std::string& reason() const { return reason_; } |
| 40 const std::string& blocked_action() const { return blocked_action_; } |
| 41 const std::string& extra() const { return extra_; } |
| 42 |
| 43 protected: |
| 44 virtual ~BlockedAction(); |
| 45 |
| 46 private: |
| 47 std::string extension_id_; |
| 48 base::Time time_; |
| 49 std::string blocked_action_; |
| 50 std::string reason_; |
| 51 std::string extra_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(BlockedAction); |
| 54 }; |
| 55 |
| 56 } // namespace extensions |
| 57 |
| 58 #endif // CHROME_BROWSER_EXTENSIONS_BLOCKED_ACTIONS_H_ |
| 59 |
OLD | NEW |