| 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" |
| 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 // | 19 // |
| 20 // NOTE: The FullStreamUIPolicy deliberately keeps almost all information, | 20 // NOTE: The FullStreamUIPolicy deliberately keeps almost all information, |
| 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 virtual void ReadFilteredData( | 31 virtual void ReadFilteredData( |
| 32 const std::string& extension_id, | 32 const std::string& extension_id, |
| 33 const Action::ActionType type, | 33 const Action::ActionType type, |
| 34 const std::string& api_name, | 34 const std::string& api_name, |
| 35 const std::string& page_url, | 35 const std::string& page_url, |
| 36 const std::string& arg_url, | 36 const std::string& arg_url, |
| 37 const int days_ago, | 37 const int days_ago, |
| 38 const base::Callback | 38 const base::Callback |
| 39 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; | 39 <void(scoped_ptr<Action::ActionVector>)>& callback) override; |
| 40 | 40 |
| 41 virtual void Close() OVERRIDE; | 41 virtual void Close() override; |
| 42 | 42 |
| 43 // Remove the actions stored for this policy according to the passed IDs. | 43 // Remove the actions stored for this policy according to the passed IDs. |
| 44 virtual void RemoveActions(const std::vector<int64>& action_ids) OVERRIDE; | 44 virtual void RemoveActions(const std::vector<int64>& action_ids) override; |
| 45 | 45 |
| 46 // Clean the URL data stored for this policy. | 46 // Clean the URL data stored for this policy. |
| 47 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) OVERRIDE; | 47 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) override; |
| 48 | 48 |
| 49 // Clean the data related to this extension for this policy. | 49 // Clean the data related to this extension for this policy. |
| 50 virtual void RemoveExtensionData(const std::string& extension_id) OVERRIDE; | 50 virtual void RemoveExtensionData(const std::string& extension_id) override; |
| 51 | 51 |
| 52 // Delete everything in the database. | 52 // Delete everything in the database. |
| 53 virtual void DeleteDatabase() OVERRIDE; | 53 virtual void DeleteDatabase() override; |
| 54 | 54 |
| 55 // Database table schema. | 55 // Database table schema. |
| 56 static const char* kTableName; | 56 static const char* kTableName; |
| 57 static const char* kTableContentFields[]; | 57 static const char* kTableContentFields[]; |
| 58 static const char* kTableFieldTypes[]; | 58 static const char* kTableFieldTypes[]; |
| 59 static const int kTableFieldCount; | 59 static const int kTableFieldCount; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 // Only ever run by OnDatabaseClose() below; see the comments on the | 62 // Only ever run by OnDatabaseClose() below; see the comments on the |
| 63 // ActivityDatabase class for an overall discussion of how cleanup works. | 63 // ActivityDatabase class for an overall discussion of how cleanup works. |
| 64 virtual ~FullStreamUIPolicy(); | 64 virtual ~FullStreamUIPolicy(); |
| 65 | 65 |
| 66 // The ActivityDatabase::Delegate interface. These are always called from | 66 // The ActivityDatabase::Delegate interface. These are always called from |
| 67 // the database thread. | 67 // the database thread. |
| 68 virtual bool InitDatabase(sql::Connection* db) OVERRIDE; | 68 virtual bool InitDatabase(sql::Connection* db) override; |
| 69 virtual bool FlushDatabase(sql::Connection* db) OVERRIDE; | 69 virtual bool FlushDatabase(sql::Connection* db) override; |
| 70 virtual void OnDatabaseFailure() OVERRIDE; | 70 virtual void OnDatabaseFailure() override; |
| 71 virtual void OnDatabaseClose() OVERRIDE; | 71 virtual void OnDatabaseClose() override; |
| 72 | 72 |
| 73 // Strips arguments if needed by policy. May return the original object (if | 73 // Strips arguments if needed by policy. May return the original object (if |
| 74 // unmodified), or a copy (if modifications were made). The implementation | 74 // unmodified), or a copy (if modifications were made). The implementation |
| 75 // in FullStreamUIPolicy returns the action unmodified. | 75 // in FullStreamUIPolicy returns the action unmodified. |
| 76 virtual scoped_refptr<Action> ProcessArguments( | 76 virtual scoped_refptr<Action> ProcessArguments( |
| 77 scoped_refptr<Action> action) const; | 77 scoped_refptr<Action> action) const; |
| 78 | 78 |
| 79 // The implementation of RemoveActions; this must only run on the database | 79 // The implementation of RemoveActions; this must only run on the database |
| 80 // thread. | 80 // thread. |
| 81 void DoRemoveActions(const std::vector<int64>& action_ids); | 81 void DoRemoveActions(const std::vector<int64>& action_ids); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 108 const Action::ActionType type, | 108 const Action::ActionType type, |
| 109 const std::string& api_name, | 109 const std::string& api_name, |
| 110 const std::string& page_url, | 110 const std::string& page_url, |
| 111 const std::string& arg_url, | 111 const std::string& arg_url, |
| 112 const int days_ago); | 112 const int days_ago); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace extensions | 115 } // namespace extensions |
| 116 | 116 |
| 117 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | 117 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
| OLD | NEW |