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

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

Issue 23868042: Mark supervised profiles as such immediately when they're created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_TEST_BASE_TESTING_PROFILE_H_ 5 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_
6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ 6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // Sets the path to the directory to be used to hold profile data. 94 // Sets the path to the directory to be used to hold profile data.
95 void SetPath(const base::FilePath& path); 95 void SetPath(const base::FilePath& path);
96 96
97 // Sets the PrefService to be used by this profile. 97 // Sets the PrefService to be used by this profile.
98 void SetPrefService(scoped_ptr<PrefServiceSyncable> prefs); 98 void SetPrefService(scoped_ptr<PrefServiceSyncable> prefs);
99 99
100 // Makes the Profile being built an incognito profile. 100 // Makes the Profile being built an incognito profile.
101 void SetIncognito(); 101 void SetIncognito();
102 102
103 // Sets the managed user ID (which is empty by default). If it is set to a
104 // non-empty string, the profile is managed.
105 void SetManagedUserId(const std::string& managed_user_id);
106
103 // Creates the TestingProfile using previously-set settings. 107 // Creates the TestingProfile using previously-set settings.
104 scoped_ptr<TestingProfile> Build(); 108 scoped_ptr<TestingProfile> Build();
105 109
106 private: 110 private:
107 // If true, Build() has already been called. 111 // If true, Build() has already been called.
108 bool build_called_; 112 bool build_called_;
109 113
110 // Various staging variables where values are held until Build() is invoked. 114 // Various staging variables where values are held until Build() is invoked.
111 scoped_ptr<PrefServiceSyncable> pref_service_; 115 scoped_ptr<PrefServiceSyncable> pref_service_;
112 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_; 116 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_;
113 base::FilePath path_; 117 base::FilePath path_;
114 Delegate* delegate_; 118 Delegate* delegate_;
115 bool incognito_; 119 bool incognito_;
120 std::string managed_user_id_;
116 TestingFactories testing_factories_; 121 TestingFactories testing_factories_;
117 122
118 DISALLOW_COPY_AND_ASSIGN(Builder); 123 DISALLOW_COPY_AND_ASSIGN(Builder);
119 }; 124 };
120 125
121 // Multi-profile aware constructor that takes the path to a directory managed 126 // Multi-profile aware constructor that takes the path to a directory managed
122 // for this profile. This constructor is meant to be used by 127 // for this profile. This constructor is meant to be used by
123 // TestingProfileManager::CreateTestingProfile. If you need to create multi- 128 // TestingProfileManager::CreateTestingProfile. If you need to create multi-
124 // profile profiles, use that factory method instead of this directly. 129 // profile profiles, use that factory method instead of this directly.
125 // Exception: if you need to create multi-profile profiles for testing the 130 // Exception: if you need to create multi-profile profiles for testing the
126 // ProfileManager, then use the constructor below instead. 131 // ProfileManager, then use the constructor below instead.
127 explicit TestingProfile(const base::FilePath& path); 132 explicit TestingProfile(const base::FilePath& path);
128 133
129 // Multi-profile aware constructor that takes the path to a directory managed 134 // Multi-profile aware constructor that takes the path to a directory managed
130 // for this profile and a delegate. This constructor is meant to be used 135 // for this profile and a delegate. This constructor is meant to be used
131 // for unittesting the ProfileManager. 136 // for unittesting the ProfileManager.
132 TestingProfile(const base::FilePath& path, Delegate* delegate); 137 TestingProfile(const base::FilePath& path, Delegate* delegate);
133 138
134 // Full constructor allowing the setting of all possible instance data. 139 // Full constructor allowing the setting of all possible instance data.
135 // Callers should use Builder::Build() instead of invoking this constructor. 140 // Callers should use Builder::Build() instead of invoking this constructor.
136 TestingProfile(const base::FilePath& path, 141 TestingProfile(const base::FilePath& path,
137 Delegate* delegate, 142 Delegate* delegate,
138 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, 143 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
139 scoped_ptr<PrefServiceSyncable> prefs, 144 scoped_ptr<PrefServiceSyncable> prefs,
140 bool incognito, 145 bool incognito,
146 const std::string& managed_user_id,
141 const TestingFactories& factories); 147 const TestingFactories& factories);
142 148
143 virtual ~TestingProfile(); 149 virtual ~TestingProfile();
144 150
145 // Creates the favicon service. Consequent calls would recreate the service. 151 // Creates the favicon service. Consequent calls would recreate the service.
146 void CreateFaviconService(); 152 void CreateFaviconService();
147 153
148 // Creates the history service. If |delete_file| is true, the history file is 154 // Creates the history service. If |delete_file| is true, the history file is
149 // deleted first, then the HistoryService is created. As TestingProfile 155 // deleted first, then the HistoryService is created. As TestingProfile
150 // deletes the directory containing the files used by HistoryService, this 156 // deletes the directory containing the files used by HistoryService, this
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // request context. Currently, only the CookieMonster is hooked up. 347 // request context. Currently, only the CookieMonster is hooked up.
342 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; 348 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_;
343 349
344 std::wstring id_; 350 std::wstring id_;
345 351
346 bool incognito_; 352 bool incognito_;
347 bool force_incognito_; 353 bool force_incognito_;
348 scoped_ptr<Profile> incognito_profile_; 354 scoped_ptr<Profile> incognito_profile_;
349 Profile* original_profile_; 355 Profile* original_profile_;
350 356
357 std::string managed_user_id_;
358
351 // Did the last session exit cleanly? Default is true. 359 // Did the last session exit cleanly? Default is true.
352 bool last_session_exited_cleanly_; 360 bool last_session_exited_cleanly_;
353 361
354 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; 362 scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
355 363
356 base::FilePath last_selected_directory_; 364 base::FilePath last_selected_directory_;
357 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. 365 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails.
358 366
359 scoped_refptr<ExtensionSpecialStoragePolicy> 367 scoped_refptr<ExtensionSpecialStoragePolicy>
360 extension_special_storage_policy_; 368 extension_special_storage_policy_;
(...skipping 20 matching lines...) Expand all
381 389
382 scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_; 390 scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_;
383 391
384 // Weak pointer to a delegate for indicating that a profile was created. 392 // Weak pointer to a delegate for indicating that a profile was created.
385 Delegate* delegate_; 393 Delegate* delegate_;
386 394
387 std::string profile_name_; 395 std::string profile_name_;
388 }; 396 };
389 397
390 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ 398 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698