OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This class encapsulates the implementation of multiple profiles by using | 5 // This class encapsulates the implementation of multiple profiles by using |
6 // the user-data-dir functionality. | 6 // the user-data-dir functionality. |
7 | 7 |
8 #ifndef CHROME_BROWSER_USER_DATA_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_USER_DATA_MANAGER_H_ |
9 #define CHROME_BROWSER_USER_DATA_MANAGER_H_ | 9 #define CHROME_BROWSER_USER_DATA_MANAGER_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
16 | 16 |
| 17 class FilePath; |
17 class MessageLoop; | 18 class MessageLoop; |
18 | 19 |
19 // Provides an abstraction of profiles on top of the user data directory | 20 // Provides an abstraction of profiles on top of the user data directory |
20 // feature. Given the root of the user data directories, it provides | 21 // feature. Given the root of the user data directories, it provides |
21 // functionality to enumerate the existing profiles and start Chrome in a | 22 // functionality to enumerate the existing profiles and start Chrome in a |
22 // given profile. | 23 // given profile. |
23 // Also holds a shared instance of its own for convenience though it's not a | 24 // Also holds a shared instance of its own for convenience though it's not a |
24 // singleton class. The shared instance should be created by the main thread, | 25 // singleton class. The shared instance should be created by the main thread, |
25 // then other threads can access and use the shared instance. | 26 // then other threads can access and use the shared instance. |
26 class UserDataManager { | 27 class UserDataManager { |
(...skipping 17 matching lines...) Expand all Loading... |
44 | 45 |
45 // Returns whether the current profile is the default profile or not. | 46 // Returns whether the current profile is the default profile or not. |
46 bool is_current_profile_default() const { | 47 bool is_current_profile_default() const { |
47 return is_current_profile_default_; | 48 return is_current_profile_default_; |
48 } | 49 } |
49 | 50 |
50 // Populates the given vector with a list of all the profiles. | 51 // Populates the given vector with a list of all the profiles. |
51 // This function should be called on the file thread. | 52 // This function should be called on the file thread. |
52 void GetProfiles(std::vector<std::wstring>* profiles) const; | 53 void GetProfiles(std::vector<std::wstring>* profiles) const; |
53 | 54 |
| 55 // Creates a shortcut for the given profile name in |folder|. |
| 56 // Returns false if the shortcut creation fails; true otherwise. |
| 57 bool CreateShortcutForProfileInFolder(const FilePath& folder, |
| 58 const std::wstring& profile_name) const; |
| 59 |
54 // Creates a desktop shortcut for the given profile name. | 60 // Creates a desktop shortcut for the given profile name. |
55 // Returns false if the shortcut creation fails; true otherwise. | 61 // Returns false if the shortcut creation fails; true otherwise. |
56 bool CreateDesktopShortcutForProfile(const std::wstring& profile_name) const; | 62 bool CreateDesktopShortcutForProfile(const std::wstring& profile_name) const; |
57 | 63 |
58 // Starts a new Chrome instance in the given profile name. | 64 // Starts a new Chrome instance in the given profile name. |
59 void LaunchChromeForProfile(const std::wstring& profile_name) const; | 65 void LaunchChromeForProfile(const std::wstring& profile_name) const; |
60 | 66 |
61 // Starts a new Chrome instance in the profile with the given index. The | 67 // Starts a new Chrome instance in the profile with the given index. The |
62 // index is zero based, and refers to the position of the profile in the | 68 // index is zero based, and refers to the position of the profile in the |
63 // list of profile names in alphabetical order. | 69 // list of profile names in alphabetical order. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 150 |
145 // Delegate to call. | 151 // Delegate to call. |
146 Delegate* delegate_; | 152 Delegate* delegate_; |
147 // Message loop to post tasks on completion of loading profiles. | 153 // Message loop to post tasks on completion of loading profiles. |
148 MessageLoop* message_loop_; | 154 MessageLoop* message_loop_; |
149 | 155 |
150 DISALLOW_COPY_AND_ASSIGN(GetProfilesHelper); | 156 DISALLOW_COPY_AND_ASSIGN(GetProfilesHelper); |
151 }; | 157 }; |
152 | 158 |
153 #endif // CHROME_BROWSER_USER_DATA_MANAGER_H_ | 159 #endif // CHROME_BROWSER_USER_DATA_MANAGER_H_ |
OLD | NEW |