OLD | NEW |
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_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
7 | 7 |
| 8 #include <set> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 11 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
10 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
12 | 14 |
13 class BrowserDistribution; | 15 class BrowserDistribution; |
14 | 16 |
15 // Internal free-standing functions that are exported here for testing. | 17 // Internal free-standing functions that are exported here for testing. |
16 namespace profiles { | 18 namespace profiles { |
17 namespace internal { | 19 namespace internal { |
18 | 20 |
19 // Returns the full path to the profile icon file. | 21 // Returns the full path to the profile icon file. |
20 base::FilePath GetProfileIconPath(const base::FilePath& profile_path); | 22 base::FilePath GetProfileIconPath(const base::FilePath& profile_path); |
21 | 23 |
22 // Returns the default shortcut filename for the given profile name, | 24 // Returns the default shortcut filename for the given profile name, |
23 // given |distribution|. Returns a filename appropriate for a | 25 // given |distribution|. Returns a filename appropriate for a |
24 // single-user installation if |profile_name| is empty. | 26 // single-user installation if |profile_name| is empty. |
25 base::string16 GetShortcutFilenameForProfile(const base::string16& profile_name, | 27 base::string16 GetShortcutFilenameForProfile(const base::string16& profile_name, |
26 BrowserDistribution* distribution); | 28 BrowserDistribution* distribution); |
27 | 29 |
| 30 // The same as GetShortcutFilenameForProfile but uniqueness is guaranteed. |
| 31 base::string16 GetUniqueShortcutFilenameForProfile( |
| 32 const base::string16& profile_name, |
| 33 BrowserDistribution* distribution, |
| 34 const std::set<base::FilePath>& excludes); |
| 35 |
| 36 // This class checks that shortcut filename matches certain profile. |
| 37 class ShortcutFilenameMatcher { |
| 38 public: |
| 39 ShortcutFilenameMatcher(const base::string16& profile_name, |
| 40 BrowserDistribution* distribution); |
| 41 |
| 42 // Check that shortcut filename has a name given by us (by |
| 43 // GetShortcutFilenameForProfile or GetUniqueShortcutFilenameForProfile). |
| 44 bool IsCanonical(const base::string16& filename) const; |
| 45 |
| 46 private: |
| 47 const base::string16 profile_shortcut_filename_; |
| 48 const base::StringPiece16 lnk_ext_; |
| 49 base::StringPiece16 profile_shortcut_name_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ShortcutFilenameMatcher); |
| 52 }; |
| 53 |
28 // Returns the command-line flags to launch Chrome with the given profile. | 54 // Returns the command-line flags to launch Chrome with the given profile. |
29 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); | 55 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); |
30 | 56 |
31 } // namespace internal | 57 } // namespace internal |
32 } // namespace profiles | 58 } // namespace profiles |
33 | 59 |
34 class ProfileShortcutManagerWin : public ProfileShortcutManager, | 60 class ProfileShortcutManagerWin : public ProfileShortcutManager, |
35 public ProfileInfoCacheObserver, | 61 public ProfileInfoCacheObserver, |
36 public content::NotificationObserver { | 62 public content::NotificationObserver { |
37 public: | 63 public: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 NonProfileShortcutAction action); | 116 NonProfileShortcutAction action); |
91 | 117 |
92 ProfileManager* profile_manager_; | 118 ProfileManager* profile_manager_; |
93 | 119 |
94 content::NotificationRegistrar registrar_; | 120 content::NotificationRegistrar registrar_; |
95 | 121 |
96 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); | 122 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); |
97 }; | 123 }; |
98 | 124 |
99 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 125 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
OLD | NEW |