| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_PROFILE_RESETTER_PROFILE_RESET_GLOBAL_ERROR_H_ | 5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESET_GLOBAL_ERROR_H_ |
| 6 #define CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESET_GLOBAL_ERROR_H_ | 6 #define CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESET_GLOBAL_ERROR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/ui/global_error/global_error.h" | 10 #include "chrome/browser/ui/global_error/global_error.h" |
| 11 | 11 |
| 12 class AutomaticProfileResetter; |
| 12 class GlobalErrorBubbleViewBase; | 13 class GlobalErrorBubbleViewBase; |
| 13 class Profile; | 14 class Profile; |
| 14 | 15 |
| 15 // Shows preferences reset errors on the wrench menu and exposes a menu item to | 16 // Shows preferences reset errors on the wrench menu and exposes a menu item to |
| 16 // launch a bubble view. | 17 // launch a bubble view. |
| 17 class ProfileResetGlobalError | 18 class ProfileResetGlobalError |
| 18 : public GlobalError, | 19 : public GlobalError, |
| 19 public base::SupportsWeakPtr<ProfileResetGlobalError> { | 20 public base::SupportsWeakPtr<ProfileResetGlobalError> { |
| 20 public: | 21 public: |
| 21 explicit ProfileResetGlobalError(Profile* profile); | 22 explicit ProfileResetGlobalError(Profile* profile); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 virtual string16 MenuItemLabel() OVERRIDE; | 39 virtual string16 MenuItemLabel() OVERRIDE; |
| 39 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; | 40 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; |
| 40 virtual bool HasBubbleView() OVERRIDE; | 41 virtual bool HasBubbleView() OVERRIDE; |
| 41 virtual bool HasShownBubbleView() OVERRIDE; | 42 virtual bool HasShownBubbleView() OVERRIDE; |
| 42 virtual void ShowBubbleView(Browser* browser) OVERRIDE; | 43 virtual void ShowBubbleView(Browser* browser) OVERRIDE; |
| 43 virtual GlobalErrorBubbleViewBase* GetBubbleView() OVERRIDE; | 44 virtual GlobalErrorBubbleViewBase* GetBubbleView() OVERRIDE; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 Profile* profile_; | 47 Profile* profile_; |
| 47 | 48 |
| 48 // The number of times we have shown the bubble so far. This can be >1 if the | 49 // GlobalErrorServic owns us, on which AutomaticProfileResetter depends, so it |
| 49 // user dismissed the bubble, then selected the menu item to show it again. | 50 // can go out of scope before we are destroyed. |
| 50 int num_times_bubble_view_shown_; | 51 base::WeakPtr<AutomaticProfileResetter> automatic_profile_resetter_; |
| 52 |
| 53 // Whether or not we have already shown the bubble. |
| 54 bool has_shown_bubble_view_; |
| 51 | 55 |
| 52 // The reset bubble, if we're currently showing one. | 56 // The reset bubble, if we're currently showing one. |
| 53 GlobalErrorBubbleViewBase* bubble_view_; | 57 GlobalErrorBubbleViewBase* bubble_view_; |
| 54 | 58 |
| 55 DISALLOW_COPY_AND_ASSIGN(ProfileResetGlobalError); | 59 DISALLOW_COPY_AND_ASSIGN(ProfileResetGlobalError); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESET_GLOBAL_ERROR_H_ | 62 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESET_GLOBAL_ERROR_H_ |
| OLD | NEW |