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

Side by Side Diff: chrome/test/testing_profile.h

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TEST_TESTING_PROFILE_H_ 5 #ifndef CHROME_TEST_TESTING_PROFILE_H_
6 #define CHROME_TEST_TESTING_PROFILE_H_ 6 #define CHROME_TEST_TESTING_PROFILE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/timer.h" 12 #include "base/timer.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 14
15 namespace history { 15 namespace history {
16 class TopSites; 16 class TopSites;
17 } 17 }
18 18
19 namespace net { 19 namespace net {
20 class CookieMonster; 20 class CookieMonster;
21 } 21 }
22 22
23 class AutocompleteClassifier; 23 class AutocompleteClassifier;
24 class BookmarkModel; 24 class BookmarkModel;
25 class BrowserThemeProvider; 25 class BrowserThemeProvider;
26 class CommandLine; 26 class CommandLine;
27 class DesktopNotificationService; 27 class DesktopNotificationService;
28 class ExtensionPrefs;
28 class ExtensionPrefStore; 29 class ExtensionPrefStore;
29 class ExtensionPrefs; 30 class ExtensionPrefValueMap;
30 class FaviconService; 31 class FaviconService;
31 class FindBarState; 32 class FindBarState;
32 class GeolocationContentSettingsMap; 33 class GeolocationContentSettingsMap;
33 class GeolocationPermissionContext; 34 class GeolocationPermissionContext;
34 class HistoryService; 35 class HistoryService;
35 class HostContentSettingsMap; 36 class HostContentSettingsMap;
36 class PrefService; 37 class PrefService;
37 class ProfileSyncService; 38 class ProfileSyncService;
38 class SessionService; 39 class SessionService;
39 class TemplateURLModel; 40 class TemplateURLModel;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void SetTemplateURLModel(TemplateURLModel* model); 109 void SetTemplateURLModel(TemplateURLModel* model);
109 110
110 // Uses a specific theme provider for this profile. TestingProfile takes 111 // Uses a specific theme provider for this profile. TestingProfile takes
111 // ownership of |theme_provider|. 112 // ownership of |theme_provider|.
112 void UseThemeProvider(BrowserThemeProvider* theme_provider); 113 void UseThemeProvider(BrowserThemeProvider* theme_provider);
113 114
114 // Creates an ExtensionService initialized with the testing profile and 115 // Creates an ExtensionService initialized with the testing profile and
115 // returns it. The profile keeps its own copy of a scoped_refptr to the 116 // returns it. The profile keeps its own copy of a scoped_refptr to the
116 // ExtensionService to make sure that is still alive to be notified when the 117 // ExtensionService to make sure that is still alive to be notified when the
117 // profile is destroyed. 118 // profile is destroyed.
118 scoped_refptr<ExtensionService> CreateExtensionService( 119 ExtensionService* CreateExtensionService(const CommandLine* command_line,
119 const CommandLine* command_line, 120 const FilePath& install_directory);
120 const FilePath& install_directory);
121 121
122 TestingPrefService* GetTestingPrefService(); 122 TestingPrefService* GetTestingPrefService();
123 123
124 virtual ProfileId GetRuntimeId() { 124 virtual ProfileId GetRuntimeId() {
125 return reinterpret_cast<ProfileId>(this); 125 return reinterpret_cast<ProfileId>(this);
126 } 126 }
127 127
128 virtual FilePath GetPath(); 128 virtual FilePath GetPath();
129 129
130 // Sets whether we're off the record. Default is false. 130 // Sets whether we're off the record. Default is false.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 virtual ProfileSyncService* GetProfileSyncService( 313 virtual ProfileSyncService* GetProfileSyncService(
314 const std::string& cros_notes); 314 const std::string& cros_notes);
315 virtual CloudPrintProxyService* GetCloudPrintProxyService() { return NULL; } 315 virtual CloudPrintProxyService* GetCloudPrintProxyService() { return NULL; }
316 virtual ChromeBlobStorageContext* GetBlobStorageContext() { return NULL; } 316 virtual ChromeBlobStorageContext* GetBlobStorageContext() { return NULL; }
317 virtual ExtensionInfoMap* GetExtensionInfoMap() { return NULL; } 317 virtual ExtensionInfoMap* GetExtensionInfoMap() { return NULL; }
318 virtual PromoCounter* GetInstantPromoCounter() { return NULL; } 318 virtual PromoCounter* GetInstantPromoCounter() { return NULL; }
319 virtual policy::ProfilePolicyContext* GetPolicyContext() { return NULL; } 319 virtual policy::ProfilePolicyContext* GetPolicyContext() { return NULL; }
320 virtual PrerenderManager* GetPrerenderManager() { return NULL; } 320 virtual PrerenderManager* GetPrerenderManager() { return NULL; }
321 321
322 protected: 322 protected:
323 virtual ExtensionPrefValueMap* GetExtensionPrefValueMap() {
324 return extension_pref_value_map_.get();
325 }
danno 2011/01/14 13:05:09 private maybe :-)
battre 2011/01/20 17:59:29 decided not to change this
326
323 base::Time start_time_; 327 base::Time start_time_;
324 scoped_ptr<PrefService> prefs_; 328 scoped_ptr<PrefService> prefs_;
325 // ref only for right type, lifecycle is managed by prefs_ 329 // ref only for right type, lifecycle is managed by prefs_
326 TestingPrefService* testing_prefs_; 330 TestingPrefService* testing_prefs_;
327 331
328 private: 332 private:
329 // Destroys favicon service if it has been created. 333 // Destroys favicon service if it has been created.
330 void DestroyFaviconService(); 334 void DestroyFaviconService();
331 335
332 // If the webdata service has been created, it is destroyed. This is invoked 336 // If the webdata service has been created, it is destroyed. This is invoked
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 geolocation_content_settings_map_; 406 geolocation_content_settings_map_;
403 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; 407 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_;
404 scoped_ptr<DesktopNotificationService> desktop_notification_service_; 408 scoped_ptr<DesktopNotificationService> desktop_notification_service_;
405 409
406 // Find bar state. Created lazily by GetFindBarState(). 410 // Find bar state. Created lazily by GetFindBarState().
407 scoped_ptr<FindBarState> find_bar_state_; 411 scoped_ptr<FindBarState> find_bar_state_;
408 412
409 FilePath last_selected_directory_; 413 FilePath last_selected_directory_;
410 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. 414 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails.
411 415
412 // Extension pref store, created for use by |extension_prefs_|.
413 scoped_ptr<ExtensionPrefStore> extension_pref_store_;
414
415 // The Extension Preferences. Only created if CreateExtensionService is 416 // The Extension Preferences. Only created if CreateExtensionService is
416 // invoked. 417 // invoked.
417 scoped_ptr<ExtensionPrefs> extension_prefs_; 418 scoped_ptr<ExtensionPrefs> extension_prefs_;
418 419
419 // For properly notifying the ExtensionService when the profile 420 // For properly notifying the ExtensionService when the profile
420 // is disposed. 421 // is disposed.
421 scoped_refptr<ExtensionService> extensions_service_; 422 scoped_refptr<ExtensionService> extensions_service_;
422 423
424 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
425
423 // The proxy prefs tracker. 426 // The proxy prefs tracker.
424 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; 427 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
425 428
426 // We use a temporary directory to store testing profile data. 429 // We use a temporary directory to store testing profile data.
427 ScopedTempDir temp_dir_; 430 ScopedTempDir temp_dir_;
428 }; 431 };
429 432
430 // A profile that derives from another profile. This does not actually 433 // A profile that derives from another profile. This does not actually
431 // override anything except the GetRuntimeId() in order to test sharing of 434 // override anything except the GetRuntimeId() in order to test sharing of
432 // site information. 435 // site information.
433 class DerivedTestingProfile : public TestingProfile { 436 class DerivedTestingProfile : public TestingProfile {
434 public: 437 public:
435 explicit DerivedTestingProfile(Profile* profile) 438 explicit DerivedTestingProfile(Profile* profile)
436 : original_profile_(profile) {} 439 : original_profile_(profile) {}
437 440
438 virtual ProfileId GetRuntimeId() { 441 virtual ProfileId GetRuntimeId() {
439 return original_profile_->GetRuntimeId(); 442 return original_profile_->GetRuntimeId();
440 } 443 }
441 444
442 protected: 445 protected:
443 Profile* original_profile_; 446 Profile* original_profile_;
444 }; 447 };
445 448
446 #endif // CHROME_TEST_TESTING_PROFILE_H_ 449 #endif // CHROME_TEST_TESTING_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698