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