 Chromium Code Reviews
 Chromium Code Reviews Issue 15573003:
  New architecture of the activity logging: Policies for summarization (and compression)  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 15573003:
  New architecture of the activity logging: Policies for summarization (and compression)  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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..a0e1200e05e410e992fe1565ea868e8a4cae915b | 
| --- /dev/null | 
| +++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h | 
| @@ -0,0 +1,75 @@ | 
| +// 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 <string> | 
| +#include <sstream> | 
| +#include "chrome/browser/extensions/activity_log/activity_log_policy.h" | 
| + | 
| +class GURL; | 
| + | 
| +namespace extensions { | 
| + | 
| +class ActivityDatabase; | 
| + | 
| +class FullStreamUIPolicy : public ActivityLogPolicy { | 
| + public: | 
| 
felt
2013/05/24 18:43:38
"public:" should be indented 1 space, and all the
 
dbabic
2013/05/29 18:41:40
Done.
 | 
| + | 
| 
felt
2013/05/24 18:43:38
no vspace between "public" and comment
 
dbabic
2013/05/29 18:41:40
Done.
 | 
| + // 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; | 
| + | 
| + // 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, but then | 
| 
felt
2013/05/24 18:43:38
"ActivityLog and policy, but then"
 
dbabic
2013/05/29 18:41:40
Done.
 | 
| + // 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_ |