| 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 | 9 |
| 10 #include "chrome/browser/extensions/activity_log/activity_database.h" | 10 #include "chrome/browser/extensions/activity_log/activity_database.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // including some data that could be privacy sensitive (full URLs including | 21 // including some data that could be privacy sensitive (full URLs including |
| 22 // incognito URLs, full headers when WebRequest is used, etc.). It should not | 22 // incognito URLs, full headers when WebRequest is used, etc.). It should not |
| 23 // be used during normal browsing if users care about privacy. | 23 // be used during normal browsing if users care about privacy. |
| 24 class FullStreamUIPolicy : public ActivityLogDatabasePolicy { | 24 class FullStreamUIPolicy : public ActivityLogDatabasePolicy { |
| 25 public: | 25 public: |
| 26 // For more info about these member functions, see the super class. | 26 // For more info about these member functions, see the super class. |
| 27 explicit FullStreamUIPolicy(Profile* profile); | 27 explicit FullStreamUIPolicy(Profile* profile); |
| 28 | 28 |
| 29 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; | 29 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; |
| 30 | 30 |
| 31 // TODO(felt,dbabic) This is overly specific to FullStreamUIPolicy. | |
| 32 // 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 | |
| 34 // just counts the frequency of certain actions within some time period, | |
| 35 // this call would be meaningless, as it couldn't return anything useful. | |
| 36 virtual void ReadData( | |
| 37 const std::string& extension_id, | |
| 38 const int day, | |
| 39 const base::Callback | |
| 40 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; | |
| 41 | |
| 42 virtual void ReadFilteredData( | 31 virtual void ReadFilteredData( |
| 43 const std::string& extension_id, | 32 const std::string& extension_id, |
| 44 const Action::ActionType type, | 33 const Action::ActionType type, |
| 45 const std::string& api_name, | 34 const std::string& api_name, |
| 46 const std::string& page_url, | 35 const std::string& page_url, |
| 47 const std::string& arg_url, | 36 const std::string& arg_url, |
| 37 const int days_ago, |
| 48 const base::Callback | 38 const base::Callback |
| 49 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; | 39 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; |
| 50 | 40 |
| 51 virtual void Close() OVERRIDE; | 41 virtual void Close() OVERRIDE; |
| 52 | 42 |
| 53 // Clean the URL data stored for this policy. | 43 // Clean the URL data stored for this policy. |
| 54 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) OVERRIDE; | 44 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) OVERRIDE; |
| 55 | 45 |
| 56 // Database table schema. | 46 // Database table schema. |
| 57 static const char* kTableName; | 47 static const char* kTableName; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 83 | 73 |
| 84 // Tracks any pending updates to be written to the database, if write | 74 // Tracks any pending updates to be written to the database, if write |
| 85 // batching is turned on. Should only be accessed from the database thread. | 75 // batching is turned on. Should only be accessed from the database thread. |
| 86 Action::ActionVector queued_actions_; | 76 Action::ActionVector queued_actions_; |
| 87 | 77 |
| 88 private: | 78 private: |
| 89 // Adds an Action to queued_actions_; this should be invoked only on the | 79 // Adds an Action to queued_actions_; this should be invoked only on the |
| 90 // database thread. | 80 // database thread. |
| 91 void QueueAction(scoped_refptr<Action> action); | 81 void QueueAction(scoped_refptr<Action> action); |
| 92 | 82 |
| 93 // The implementation of ReadData; this must only run on the database thread. | |
| 94 scoped_ptr<Action::ActionVector> DoReadData(const std::string& extension_id, | |
| 95 const int days_ago); | |
| 96 | |
| 97 // Internal method to read data from the database; called on the database | 83 // Internal method to read data from the database; called on the database |
| 98 // thread. | 84 // thread. |
| 99 scoped_ptr<Action::ActionVector> DoReadFilteredData( | 85 scoped_ptr<Action::ActionVector> DoReadFilteredData( |
| 100 const std::string& extension_id, | 86 const std::string& extension_id, |
| 101 const Action::ActionType type, | 87 const Action::ActionType type, |
| 102 const std::string& api_name, | 88 const std::string& api_name, |
| 103 const std::string& page_url, | 89 const std::string& page_url, |
| 104 const std::string& arg_url); | 90 const std::string& arg_url, |
| 91 const int days_ago); |
| 105 }; | 92 }; |
| 106 | 93 |
| 107 } // namespace extensions | 94 } // namespace extensions |
| 108 | 95 |
| 109 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | 96 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
| OLD | NEW |