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

Side by Side Diff: chrome/browser/chromeos/profiles/profile_helper.h

Issue 2827523003: Move BrowsingDataRemover to content/ (Closed)
Patch Set: Rebase over codereview.chromium.org/2815913005 Created 3 years, 8 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 6 #define CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/browsing_data/browsing_data_remover.h"
18 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" 17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
19 #include "components/user_manager/user_manager.h" 18 #include "components/user_manager/user_manager.h"
19 #include "content/public/browser/browsing_data_remover.h"
20 20
21 class ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest; 21 class ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest;
22 class ArcAppTest; 22 class ArcAppTest;
23 class SessionControllerClientTest; 23 class SessionControllerClientTest;
24 class Profile; 24 class Profile;
25 25
26 namespace base { 26 namespace base {
27 class FilePath; 27 class FilePath;
28 } 28 }
29 29
(...skipping 24 matching lines...) Expand all
54 // Whenever active user is changed (either add another user into session or 54 // Whenever active user is changed (either add another user into session or
55 // switch between users), ActiveUserHashChanged() will be called thus 55 // switch between users), ActiveUserHashChanged() will be called thus
56 // internal state |active_user_id_hash_| will be updated. 56 // internal state |active_user_id_hash_| will be updated.
57 // Typical use cases for using this class: 57 // Typical use cases for using this class:
58 // 1. Get "signin profile" which is a special type of profile that is only used 58 // 1. Get "signin profile" which is a special type of profile that is only used
59 // during signin flow: GetSigninProfile() 59 // during signin flow: GetSigninProfile()
60 // 2. Get profile dir of an active user, used by ProfileManager: 60 // 2. Get profile dir of an active user, used by ProfileManager:
61 // GetActiveUserProfileDir() 61 // GetActiveUserProfileDir()
62 // 3. Get mapping from user_id_hash to Profile instance/profile path etc. 62 // 3. Get mapping from user_id_hash to Profile instance/profile path etc.
63 class ProfileHelper 63 class ProfileHelper
64 : public BrowsingDataRemover::Observer, 64 : public content::BrowsingDataRemover::Observer,
65 public OAuth2LoginManager::Observer, 65 public OAuth2LoginManager::Observer,
66 public user_manager::UserManager::UserSessionStateObserver { 66 public user_manager::UserManager::UserSessionStateObserver {
67 public: 67 public:
68 ProfileHelper(); 68 ProfileHelper();
69 ~ProfileHelper() override; 69 ~ProfileHelper() override;
70 70
71 // Returns ProfileHelper instance. This class is not singleton and is owned 71 // Returns ProfileHelper instance. This class is not singleton and is owned
72 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that 72 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that
73 // knowledge in one place. 73 // knowledge in one place.
74 static ProfileHelper* Get(); 74 static ProfileHelper* Get();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Identifies path to active user profile on Chrome OS. 209 // Identifies path to active user profile on Chrome OS.
210 std::string active_user_id_hash_; 210 std::string active_user_id_hash_;
211 211
212 // List of callbacks called after signin profile clearance. 212 // List of callbacks called after signin profile clearance.
213 std::vector<base::Closure> on_clear_callbacks_; 213 std::vector<base::Closure> on_clear_callbacks_;
214 214
215 // Called when a single stage of profile clearing is finished. 215 // Called when a single stage of profile clearing is finished.
216 base::Closure on_clear_profile_stage_finished_; 216 base::Closure on_clear_profile_stage_finished_;
217 217
218 // A currently running browsing data remover. 218 // A currently running browsing data remover.
219 BrowsingDataRemover* browsing_data_remover_; 219 content::BrowsingDataRemover* browsing_data_remover_;
220 220
221 // Used for testing by unit tests and FakeUserManager/MockUserManager. 221 // Used for testing by unit tests and FakeUserManager/MockUserManager.
222 std::map<const user_manager::User*, Profile*> user_to_profile_for_testing_; 222 std::map<const user_manager::User*, Profile*> user_to_profile_for_testing_;
223 223
224 // When this list is not empty GetUserByProfile() will find user that has 224 // When this list is not empty GetUserByProfile() will find user that has
225 // the same user_id as |profile|->GetProfileName(). 225 // the same user_id as |profile|->GetProfileName().
226 user_manager::UserList user_list_for_testing_; 226 user_manager::UserList user_list_for_testing_;
227 227
228 // If true testing code path is used in GetUserByProfile() even if 228 // If true testing code path is used in GetUserByProfile() even if
229 // user_list_for_testing_ list is empty. In that case primary user will always 229 // user_list_for_testing_ list is empty. In that case primary user will always
230 // be returned. 230 // be returned.
231 static bool enable_profile_to_user_testing; 231 static bool enable_profile_to_user_testing;
232 232
233 // If true and enable_profile_to_user_testing is true then primary user will 233 // If true and enable_profile_to_user_testing is true then primary user will
234 // always be returned by GetUserByProfile(). 234 // always be returned by GetUserByProfile().
235 static bool always_return_primary_user_for_testing; 235 static bool always_return_primary_user_for_testing;
236 236
237 std::unique_ptr<FileFlusher> profile_flusher_; 237 std::unique_ptr<FileFlusher> profile_flusher_;
238 238
239 base::WeakPtrFactory<ProfileHelper> weak_factory_; 239 base::WeakPtrFactory<ProfileHelper> weak_factory_;
240 240
241 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); 241 DISALLOW_COPY_AND_ASSIGN(ProfileHelper);
242 }; 242 };
243 243
244 } // namespace chromeos 244 } // namespace chromeos
245 245
246 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 246 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client_unittest.cc ('k') | chrome/browser/chromeos/profiles/profile_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698