| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "chrome/browser/extensions/activity_log/activity_database.h" | 10 #include "chrome/browser/extensions/activity_log/activity_database.h" |
| 11 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" | 11 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 // A policy for logging the full stream of actions, including all arguments. | 17 // A policy for logging the full stream of actions, including all arguments. |
| 18 // It's mostly intended to be used in testing and analysis. | 18 // It's mostly intended to be used in testing and analysis. |
| 19 class FullStreamUIPolicy : public ActivityLogPolicy, | 19 class FullStreamUIPolicy : public ActivityLogPolicy, |
| 20 public ActivityDatabase::Delegate { | 20 public ActivityDatabase::Delegate { |
| 21 public: | 21 public: |
| 22 // For more info about these member functions, see the super class. | 22 // For more info about these member functions, see the super class. |
| 23 explicit FullStreamUIPolicy(Profile* profile); | 23 explicit FullStreamUIPolicy(Profile* profile); |
| 24 | 24 |
| 25 virtual void ProcessAction(ActionType action_type, | 25 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; |
| 26 const std::string& extension_id, | |
| 27 const std::string& name, const GURL& gurl, | |
| 28 const base::ListValue* args, | |
| 29 const base::DictionaryValue* details) OVERRIDE; | |
| 30 | 26 |
| 31 // TODO(felt,dbabic) This is overly specific to FullStreamUIPolicy. | 27 // TODO(felt,dbabic) This is overly specific to FullStreamUIPolicy. |
| 32 // It assumes that the callback can return a sorted vector of actions. Some | 28 // It assumes that the callback can return a sorted vector of actions. Some |
| 33 // policies might not do that. For instance, imagine a trivial policy that | 29 // policies might not do that. For instance, imagine a trivial policy that |
| 34 // just counts the frequency of certain actions within some time period, | 30 // just counts the frequency of certain actions within some time period, |
| 35 // this call would be meaningless, as it couldn't return anything useful. | 31 // this call would be meaningless, as it couldn't return anything useful. |
| 36 virtual void ReadData( | 32 virtual void ReadData( |
| 37 const std::string& extension_id, | 33 const std::string& extension_id, |
| 38 const int day, | 34 const int day, |
| 39 const base::Callback | 35 const base::Callback |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 // Only ever run by OnDatabaseClose() below; see the comments on the | 51 // Only ever run by OnDatabaseClose() below; see the comments on the |
| 56 // ActivityDatabase class for an overall discussion of how cleanup works. | 52 // ActivityDatabase class for an overall discussion of how cleanup works. |
| 57 virtual ~FullStreamUIPolicy() {} | 53 virtual ~FullStreamUIPolicy() {} |
| 58 | 54 |
| 59 // The ActivityDatabase::PolicyDelegate interface. These are always called | 55 // The ActivityDatabase::PolicyDelegate interface. These are always called |
| 60 // from the database thread. | 56 // from the database thread. |
| 61 virtual bool OnDatabaseInit(sql::Connection* db) OVERRIDE; | 57 virtual bool OnDatabaseInit(sql::Connection* db) OVERRIDE; |
| 62 virtual void OnDatabaseClose() OVERRIDE; | 58 virtual void OnDatabaseClose() OVERRIDE; |
| 63 | 59 |
| 64 // Strips arguments if needed by policy. | 60 // Strips arguments if needed by policy. |
| 65 virtual scoped_ptr<base::ListValue> ProcessArguments( | 61 virtual void ProcessArguments(scoped_refptr<Action> action) const; |
| 66 ActionType action_type, | |
| 67 const std::string& name, | |
| 68 const base::ListValue* args) const; | |
| 69 | 62 |
| 70 // Concatenates arguments. | 63 // Concatenates arguments. |
| 71 virtual std::string JoinArguments(ActionType action_type, | 64 virtual std::string JoinArguments(ActionType action_type, |
| 72 const std::string& name, | 65 const std::string& name, |
| 73 const base::ListValue* args) const; | 66 const base::ListValue* args) const; |
| 74 | 67 |
| 75 virtual void ProcessWebRequestModifications( | 68 virtual void ProcessWebRequestModifications( |
| 76 base::DictionaryValue& details, | 69 base::DictionaryValue& details, |
| 77 std::string& details_string) const; | 70 std::string& details_string) const; |
| 78 | 71 |
| 79 // See the comments for the ActivityDatabase class for a discussion of how | 72 // See the comments for the ActivityDatabase class for a discussion of how |
| 80 // cleanup runs. | 73 // cleanup runs. |
| 81 ActivityDatabase* db_; | 74 ActivityDatabase* db_; |
| 82 }; | 75 }; |
| 83 | 76 |
| 84 } // namespace extensions | 77 } // namespace extensions |
| 85 | 78 |
| 86 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | 79 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
| OLD | NEW |