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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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 | Annotate | Revision Log
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 16 matching lines...) Expand all
27 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
28 28
29 class Profile; 29 class Profile;
30 using content::BrowserThread; 30 using content::BrowserThread;
31 31
32 namespace extensions { 32 namespace extensions {
33 class Extension; 33 class Extension;
34 34
35 // A utility for tracing interesting activity for each extension. 35 // A utility for tracing interesting activity for each extension.
36 // It writes to an ActivityDatabase on a separate thread to record the activity. 36 // It writes to an ActivityDatabase on a separate thread to record the activity.
37 class ActivityLog : public ProfileKeyedService, 37 class ActivityLog : public BrowserContextKeyedService,
38 public TabHelper::ScriptExecutionObserver { 38 public TabHelper::ScriptExecutionObserver {
39 public: 39 public:
40 enum Activity { 40 enum Activity {
41 ACTIVITY_EXTENSION_API_CALL, // Extension API invocation is called. 41 ACTIVITY_EXTENSION_API_CALL, // Extension API invocation is called.
42 ACTIVITY_EXTENSION_API_BLOCK, // Extension API invocation is blocked. 42 ACTIVITY_EXTENSION_API_BLOCK, // Extension API invocation is blocked.
43 ACTIVITY_CONTENT_SCRIPT, // Content script is executing. 43 ACTIVITY_CONTENT_SCRIPT, // Content script is executing.
44 ACTIVITY_EVENT_DISPATCH, // Event sent to listener in extension. 44 ACTIVITY_EVENT_DISPATCH, // Event sent to listener in extension.
45 }; 45 };
46 46
47 // Observers can listen for activity events. 47 // Observers can listen for activity events.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 bool testing_mode_; 224 bool testing_mode_;
225 base::hash_set<std::string> arg_whitelist_api_; 225 base::hash_set<std::string> arg_whitelist_api_;
226 226
227 Profile* profile_; 227 Profile* profile_;
228 228
229 DISALLOW_COPY_AND_ASSIGN(ActivityLog); 229 DISALLOW_COPY_AND_ASSIGN(ActivityLog);
230 }; 230 };
231 231
232 // Each profile has different extensions, so we keep a different database for 232 // Each profile has different extensions, so we keep a different database for
233 // each profile. 233 // each profile.
234 class ActivityLogFactory : public ProfileKeyedServiceFactory { 234 class ActivityLogFactory : public BrowserContextKeyedServiceFactory {
235 public: 235 public:
236 static ActivityLog* GetForProfile(Profile* profile) { 236 static ActivityLog* GetForProfile(Profile* profile) {
237 return static_cast<ActivityLog*>( 237 return static_cast<ActivityLog*>(
238 GetInstance()->GetServiceForProfile(profile, true)); 238 GetInstance()->GetServiceForBrowserContext(profile, true));
239 } 239 }
240 240
241 static ActivityLogFactory* GetInstance(); 241 static ActivityLogFactory* GetInstance();
242 242
243 private: 243 private:
244 friend struct DefaultSingletonTraits<ActivityLogFactory>; 244 friend struct DefaultSingletonTraits<ActivityLogFactory>;
245 ActivityLogFactory() 245 ActivityLogFactory()
246 : ProfileKeyedServiceFactory("ActivityLog", 246 : BrowserContextKeyedServiceFactory(
247 ProfileDependencyManager::GetInstance()) {} 247 "ActivityLog",
248 BrowserContextDependencyManager::GetInstance()) {}
248 virtual ~ActivityLogFactory() {} 249 virtual ~ActivityLogFactory() {}
249 250
250 virtual ProfileKeyedService* BuildServiceInstanceFor( 251 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
251 content::BrowserContext* profile) const OVERRIDE; 252 content::BrowserContext* profile) const OVERRIDE;
252 253
253 virtual content::BrowserContext* GetBrowserContextToUse( 254 virtual content::BrowserContext* GetBrowserContextToUse(
254 content::BrowserContext* context) const OVERRIDE; 255 content::BrowserContext* context) const OVERRIDE;
255 256
256 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); 257 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory);
257 }; 258 };
258 259
259 260
260 } // namespace extensions 261 } // namespace extensions
261 262
262 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ 263 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698