Chromium Code Reviews| Index: chrome/browser/extensions/manager_actions.h |
| =================================================================== |
| --- chrome/browser/extensions/manager_actions.h (revision 0) |
| +++ chrome/browser/extensions/manager_actions.h (revision 0) |
| @@ -0,0 +1,89 @@ |
| +// 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_MANAGER_ACTIONS_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_MANAGER_ACTIONS_H_ |
| + |
| +#include <string> |
| +#include "base/time.h" |
| +#include "chrome/browser/extensions/activity_actions.h" |
| + |
| +namespace extensions { |
| + |
| +// This class describes API calls that did not run into permissions or quota |
| +// problems. See BlockedActions for API calls that did not succeed. |
| +class ManagerAction : public Action, |
|
Matt Perry
2013/01/03 20:53:35
Why "ManagerAction"? Why not APIAction?
felt
2013/01/07 23:44:22
Done.
|
| + public base::RefCountedThreadSafe<ManagerAction> { |
| + public: |
| + // TODO(felt): I'll finalize this list when making the UI. |
| + enum ManagerActionType { |
| + READ, |
| + MODIFIED, |
| + DELETED, |
| + ADDED, |
| + ENABLED, |
| + DISABLED, |
| + CREATED, |
| + UNKNOWN_ACTION |
| + }; |
| + |
| + // TODO(felt): I'll finalize this list when making the UI. |
| + enum ManagerTargetType { |
| + BOOKMARK, |
| + TABS, |
| + HISTORY, |
| + COOKIES, |
| + BROWSER_ACTION, |
| + NOTIFICATION, |
| + OMNIBOX, |
| + UNKNOWN_TARGET |
| + }; |
| + |
| + static const char* kTableName; |
| + static const char* kTableStructure; |
| + |
| + // Create a new ManagerAction to describe a successful API call. All |
| + // parameters are required. |
| + ManagerAction(const std::string& extension_id, |
| + const ManagerActionType verb, |
| + const ManagerTargetType target, |
| + const std::string& api_call, |
| + const base::Time& time); |
| + |
| + // Print a ManagerAction with il8n substitutions for display. |
| + virtual std::string PrettyPrintFori18n() OVERRIDE; |
| + |
| + // Print a ManagerAction 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& api_call() const { return api_call_; } |
| + std::string VerbAsString() const; |
| + std::string TargetAsString() const; |
| + |
| + // Helper methods for creating a ManagerAction. |
| + static ManagerActionType StringAsActionType(const std::string& str); |
| + static ManagerTargetType StringAsTargetType(const std::string& str); |
| + |
| + protected: |
| + virtual ~ManagerAction(); |
| + |
| + private: |
| + friend class base::RefCountedThreadSafe<ManagerAction>; |
| + |
| + std::string extension_id_; |
| + ManagerActionType verb_; |
| + ManagerTargetType target_; |
| + std::string api_call_; |
| + base::Time time_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ManagerAction); |
| +}; |
| + |
| +} // namespace |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_MANAGER_ACTIONS_H_ |
| + |