Chromium Code Reviews| Index: chrome/browser/extensions/activity_log/fullstream_ui_policy.h |
| diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy.h b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..436f5051b1ac6956149b3bf810c6dd6b39f06eb3 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h |
| @@ -0,0 +1,77 @@ |
| +// Copyright $YEAR 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_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
| + |
| +#include <sstream> |
| +#include <string> |
| +#include <vector> |
| +#include "chrome/browser/extensions/activity_log/activity_log_policy.h" |
| + |
| +class GURL; |
| + |
| +namespace extensions { |
| + |
| +class ActivityDatabase; |
| + |
| +class FullStreamUIPolicy : public ActivityLogPolicy { |
|
Matt Perry
2013/05/30 18:55:32
Add a class comment
dbabic
2013/05/30 21:51:25
Done.
|
| + public: |
| + // For more info about these member functions, see the super class. |
| + explicit FullStreamUIPolicy(Profile* profile, |
| + content::BrowserThread::ID thread_id); |
| + |
| + virtual ~FullStreamUIPolicy(); |
| + |
| + virtual void ProcessAction(ActionType action_type, |
| + const Extension& extension, |
| + const std::string& name, const GURL* gurl, |
| + const base::ListValue* args, |
| + const base::DictionaryValue* details) OVERRIDE; |
| + |
| + virtual void SaveState() OVERRIDE {} |
| + |
| + // TODO(felt,dbabic) This is overly specific to FullStreamUIPolicy. |
| + // It assumes that the callback can return a sorted vector of actions. Some |
| + // policies might not do that. For instance, imagine a trivial policy that |
| + // just counts the frequency of certain actions within some time period, |
| + // this call would be meaningless, as it couldn't return anything useful. |
| + virtual void ReadData( |
| + const std::string& extension_id, |
| + const int day, |
| + const base::Callback |
| + <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback) |
| + const OVERRIDE; |
| + |
| + virtual void SetSaveStateOnRequestOnly() OVERRIDE; |
| + |
| + // Returns the actual key for a given key type |
| + virtual void GetKey(ActivityLogPolicy::KeyType key_id, |
| + std::string* key_string) const OVERRIDE; |
| + |
| + // An error has happened; we want to rollback and close the db. |
| + // Needs to be public so the error delegate can call it. |
| + virtual void KillActivityLogDatabase(); |
| + |
| + protected: |
| + // Concatenates arguments efficiently using stringstream |
| + virtual void ProcessArguments(ActionType action_type, |
| + const std::string& name, |
| + const base::ListValue* args, |
| + std::stringstream& args_string) const; |
| + |
| + virtual void ProcessWebRequestModifications( |
| + base::DictionaryValue& details, |
| + std::string& details_string) const; |
| + |
| + // We initialize this on the same thread as the ActivityLog and policy, but |
| + // then subsequent operations occur on the DB thread. Instead of destructing |
| + // the ActivityDatabase, we call its Close() method on the DB thread and it |
| + // commits suicide. |
| + ActivityDatabase* db_; |
| +}; |
| + |
| +} // End of the extensions namespace |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |