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_UI_NETWORK_PROFILE_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_UI_NETWORK_PROFILE_BUBBLE_H_ |
6 #define CHROME_BROWSER_UI_NETWORK_PROFILE_BUBBLE_H_ | 6 #define CHROME_BROWSER_UI_NETWORK_PROFILE_BUBBLE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 class Browser; | 10 class Browser; |
11 class PrefRegistrySyncable; | |
12 class Profile; | 11 class Profile; |
13 | 12 |
14 namespace base { | 13 namespace base { |
15 class FilePath; | 14 class FilePath; |
16 } | 15 } |
17 | 16 |
| 17 namespace user_prefs { |
| 18 class PrefRegistrySyncable; |
| 19 } |
| 20 |
18 // This class will try to detect if the profile is on a network share and if | 21 // This class will try to detect if the profile is on a network share and if |
19 // this is the case notify the user with an info bubble. | 22 // this is the case notify the user with an info bubble. |
20 class NetworkProfileBubble { | 23 class NetworkProfileBubble { |
21 public: | 24 public: |
22 enum MetricNetworkedProfileCheck { | 25 enum MetricNetworkedProfileCheck { |
23 // Check was suppressed by command line flag. | 26 // Check was suppressed by command line flag. |
24 METRIC_CHECK_SUPPRESSED, | 27 METRIC_CHECK_SUPPRESSED, |
25 // WTSQuerySessionInformation call failed. | 28 // WTSQuerySessionInformation call failed. |
26 METRIC_CHECK_FAILED, | 29 METRIC_CHECK_FAILED, |
27 // File access in profile dir failed. | 30 // File access in profile dir failed. |
(...skipping 23 matching lines...) Expand all Loading... |
51 // Verifies that the profile folder is not located on a network share, and if | 54 // Verifies that the profile folder is not located on a network share, and if |
52 // it is shows the warning bubble to the user. | 55 // it is shows the warning bubble to the user. |
53 static void CheckNetworkProfile(const base::FilePath& profile_folder); | 56 static void CheckNetworkProfile(const base::FilePath& profile_folder); |
54 | 57 |
55 // Shows the notification bubble using the provided |browser|. | 58 // Shows the notification bubble using the provided |browser|. |
56 static void ShowNotification(Browser* browser); | 59 static void ShowNotification(Browser* browser); |
57 | 60 |
58 static void SetNotificationShown(bool shown); | 61 static void SetNotificationShown(bool shown); |
59 | 62 |
60 // Register the pref that controls whether the bubble should be shown anymore. | 63 // Register the pref that controls whether the bubble should be shown anymore. |
61 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 64 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
62 | 65 |
63 // Helper function wrapping the UMA_HISTOGRAM_ENUMERATION macro. | 66 // Helper function wrapping the UMA_HISTOGRAM_ENUMERATION macro. |
64 static void RecordUmaEvent(MetricNetworkedProfileCheck event); | 67 static void RecordUmaEvent(MetricNetworkedProfileCheck event); |
65 | 68 |
66 private: | 69 private: |
67 // This function creates the notification bubble, attaches it to the | 70 // This function creates the notification bubble, attaches it to the |
68 // |anchor| View and then shows it to the user. | 71 // |anchor| View and then shows it to the user. |
69 static void NotifyNetworkProfileDetected(); | 72 static void NotifyNetworkProfileDetected(); |
70 | 73 |
71 // Set to true once the notification check has been performed to avoid showing | 74 // Set to true once the notification check has been performed to avoid showing |
72 // the notification more than once per browser run. | 75 // the notification more than once per browser run. |
73 // This flag is not thread-safe and should only be accessed on the UI thread! | 76 // This flag is not thread-safe and should only be accessed on the UI thread! |
74 static bool notification_shown_; | 77 static bool notification_shown_; |
75 | 78 |
76 DISALLOW_IMPLICIT_CONSTRUCTORS(NetworkProfileBubble); | 79 DISALLOW_IMPLICIT_CONSTRUCTORS(NetworkProfileBubble); |
77 }; | 80 }; |
78 | 81 |
79 #endif // CHROME_BROWSER_UI_NETWORK_PROFILE_BUBBLE_H_ | 82 #endif // CHROME_BROWSER_UI_NETWORK_PROFILE_BUBBLE_H_ |
OLD | NEW |