Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log.h

Issue 666153002: Standardize usage of virtual/override/final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_ACTIVITY_LOG_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 const std::string& api_name, 79 const std::string& api_name,
80 const std::string& page_url, 80 const std::string& page_url,
81 const std::string& arg_url, 81 const std::string& arg_url,
82 const int days_ago, 82 const int days_ago,
83 const base::Callback 83 const base::Callback
84 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback); 84 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback);
85 85
86 // ExtensionRegistryObserver. 86 // ExtensionRegistryObserver.
87 // We keep track of whether the whitelisted extension is installed; if it is, 87 // We keep track of whether the whitelisted extension is installed; if it is,
88 // we want to recompute whether to have logging enabled. 88 // we want to recompute whether to have logging enabled.
89 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, 89 void OnExtensionLoaded(content::BrowserContext* browser_context,
90 const Extension* extension) override; 90 const Extension* extension) override;
91 virtual void OnExtensionUnloaded( 91 void OnExtensionUnloaded(content::BrowserContext* browser_context,
92 content::BrowserContext* browser_context, 92 const Extension* extension,
93 const Extension* extension, 93 UnloadedExtensionInfo::Reason reason) override;
94 UnloadedExtensionInfo::Reason reason) override; 94 void OnExtensionUninstalled(content::BrowserContext* browser_context,
95 virtual void OnExtensionUninstalled( 95 const Extension* extension,
96 content::BrowserContext* browser_context, 96 extensions::UninstallReason reason) override;
97 const Extension* extension,
98 extensions::UninstallReason reason) override;
99 97
100 // ApiActivityMonitor. 98 // ApiActivityMonitor.
101 virtual void OnApiEventDispatched( 99 void OnApiEventDispatched(const std::string& extension_id,
102 const std::string& extension_id, 100 const std::string& event_name,
103 const std::string& event_name, 101 scoped_ptr<base::ListValue> event_args) override;
104 scoped_ptr<base::ListValue> event_args) override; 102 void OnApiFunctionCalled(const std::string& extension_id,
105 virtual void OnApiFunctionCalled( 103 const std::string& api_name,
106 const std::string& extension_id, 104 scoped_ptr<base::ListValue> event_args) override;
107 const std::string& api_name,
108 scoped_ptr<base::ListValue> event_args) override;
109 105
110 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 106 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
111 107
112 // Remove actions from the activity log database which IDs specified in the 108 // Remove actions from the activity log database which IDs specified in the
113 // action_ids array. 109 // action_ids array.
114 void RemoveActions(const std::vector<int64>& action_ids); 110 void RemoveActions(const std::vector<int64>& action_ids);
115 111
116 // Clean up URLs from the activity log database. 112 // Clean up URLs from the activity log database.
117 // If restrict_urls is empty then all URLs in the activity log database are 113 // If restrict_urls is empty then all URLs in the activity log database are
118 // removed, otherwise only those in restrict_urls are removed. 114 // removed, otherwise only those in restrict_urls are removed.
119 void RemoveURLs(const std::vector<GURL>& restrict_urls); 115 void RemoveURLs(const std::vector<GURL>& restrict_urls);
120 void RemoveURLs(const std::set<GURL>& restrict_urls); 116 void RemoveURLs(const std::set<GURL>& restrict_urls);
121 void RemoveURL(const GURL& url); 117 void RemoveURL(const GURL& url);
122 118
123 // Deletes the database associated with the policy that's currently in use. 119 // Deletes the database associated with the policy that's currently in use.
124 void DeleteDatabase(); 120 void DeleteDatabase();
125 121
126 // If we're in a browser test, we need to pretend that the watchdog app is 122 // If we're in a browser test, we need to pretend that the watchdog app is
127 // active. 123 // active.
128 void SetWatchdogAppActiveForTesting(bool active); 124 void SetWatchdogAppActiveForTesting(bool active);
129 125
130 private: 126 private:
131 friend class ActivityLogTest; 127 friend class ActivityLogTest;
132 friend class BrowserContextKeyedAPIFactory<ActivityLog>; 128 friend class BrowserContextKeyedAPIFactory<ActivityLog>;
133 129
134 explicit ActivityLog(content::BrowserContext* context); 130 explicit ActivityLog(content::BrowserContext* context);
135 virtual ~ActivityLog(); 131 ~ActivityLog() override;
136 132
137 // Specifies if the Watchdog app is active (installed & enabled). 133 // Specifies if the Watchdog app is active (installed & enabled).
138 // If so, we need to log to the database and stream to the API. 134 // If so, we need to log to the database and stream to the API.
139 bool IsWatchdogAppActive(); 135 bool IsWatchdogAppActive();
140 136
141 // Specifies if we need to record actions to the db. If so, we need to log to 137 // Specifies if we need to record actions to the db. If so, we need to log to
142 // the database. This is true if the Watchdog app is active *or* the 138 // the database. This is true if the Watchdog app is active *or* the
143 // --enable-extension-activity-logging flag is set. 139 // --enable-extension-activity-logging flag is set.
144 bool IsDatabaseEnabled(); 140 bool IsDatabaseEnabled();
145 141
146 // Delayed initialization of ExtensionRegistry which waits until after the 142 // Delayed initialization of ExtensionRegistry which waits until after the
147 // ExtensionSystem/ExtensionService are done with their own setup. 143 // ExtensionSystem/ExtensionService are done with their own setup.
148 void StartObserving(); 144 void StartObserving();
149 145
150 // ScriptExecutionObserver implementation. 146 // ScriptExecutionObserver implementation.
151 // Fires when a ContentScript is executed. 147 // Fires when a ContentScript is executed.
152 virtual void OnScriptsExecuted( 148 void OnScriptsExecuted(const content::WebContents* web_contents,
153 const content::WebContents* web_contents, 149 const ExecutingScriptsMap& extension_ids,
154 const ExecutingScriptsMap& extension_ids, 150 const GURL& on_url) override;
155 const GURL& on_url) override;
156 151
157 // At the moment, ActivityLog will use only one policy for summarization. 152 // At the moment, ActivityLog will use only one policy for summarization.
158 // These methods are used to choose and set the most appropriate policy. 153 // These methods are used to choose and set the most appropriate policy.
159 // Changing policies at runtime is not recommended, and likely only should be 154 // Changing policies at runtime is not recommended, and likely only should be
160 // done for unit tests. 155 // done for unit tests.
161 void ChooseDatabasePolicy(); 156 void ChooseDatabasePolicy();
162 void SetDatabasePolicy(ActivityLogPolicy::PolicyType policy_type); 157 void SetDatabasePolicy(ActivityLogPolicy::PolicyType policy_type);
163 158
164 // BrowserContextKeyedAPI implementation. 159 // BrowserContextKeyedAPI implementation.
165 static const char* service_name() { return "ActivityLog"; } 160 static const char* service_name() { return "ActivityLog"; }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, WatchdogSwitch); 212 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, WatchdogSwitch);
218 DISALLOW_COPY_AND_ASSIGN(ActivityLog); 213 DISALLOW_COPY_AND_ASSIGN(ActivityLog);
219 }; 214 };
220 215
221 template <> 216 template <>
222 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies(); 217 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies();
223 218
224 } // namespace extensions 219 } // namespace extensions
225 220
226 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ 221 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698