diff options
author | felt@chromium.org <felt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 22:39:19 +0000 |
---|---|---|
committer | felt@chromium.org <felt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 22:39:19 +0000 |
commit | e96757646d4f89240ed2bf0f73e419007f4eb272 (patch) | |
tree | c8e7c35a7d8bc86206441d9584f7bcb554ef5e19 /chrome/browser/extensions/blocked_actions.h | |
parent | 4d1a45420216bc6ba198ed195982f9e4c6f24da4 (diff) | |
download | chromium_src-e96757646d4f89240ed2bf0f73e419007f4eb272.zip chromium_src-e96757646d4f89240ed2bf0f73e419007f4eb272.tar.gz chromium_src-e96757646d4f89240ed2bf0f73e419007f4eb272.tar.bz2 |
Saves activity log calls into a database. Database interaction is loosely modeled after how history and bookmarks are saved, although I am not currently archiving the log after 3mo.
Also gives the activity log some structure in preparation for the new UI.
BUG=161002
Review URL: https://chromiumcodereview.appspot.com/11421192
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/blocked_actions.h')
-rw-r--r-- | chrome/browser/extensions/blocked_actions.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/chrome/browser/extensions/blocked_actions.h b/chrome/browser/extensions/blocked_actions.h new file mode 100644 index 0000000..57d20bf --- /dev/null +++ b/chrome/browser/extensions/blocked_actions.h @@ -0,0 +1,59 @@ +// Copyright (c) 2013 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_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 quota problems. +// See APIActions for API calls that succeeded. +class BlockedAction : public Action { + public: + static const char* kTableName; + static const char* kTableStructure; + + BlockedAction(const std::string& extension_id, + const base::Time& time, + const std::string& blocked_action, // the blocked API call + const std::string& reason, // the reason it's blocked + const std::string& extra); // any extra logging info + + // Record the action in the database. + virtual void Record(sql::Connection* db) OVERRIDE; + + // 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_; } + const std::string& extra() const { return extra_; } + + protected: + virtual ~BlockedAction(); + + private: + std::string extension_id_; + base::Time time_; + std::string blocked_action_; + std::string reason_; + std::string extra_; + + DISALLOW_COPY_AND_ASSIGN(BlockedAction); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_BLOCKED_ACTIONS_H_ + |