Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4993)

Unified Diff: chrome/browser/profile_resetter/profile_reset_global_error.h

Issue 62193002: Integrate UI and reset logic into AutomaticProfileResetter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win compile error introduce by rebase. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profile_resetter/profile_reset_global_error.h
diff --git a/chrome/browser/profile_resetter/profile_reset_global_error.h b/chrome/browser/profile_resetter/profile_reset_global_error.h
index 8b356962f817d376b8d3feabc25c5c63a9023aa1..3bdc29544db57a4b2013b87345ed860363a2a86f 100644
--- a/chrome/browser/profile_resetter/profile_reset_global_error.h
+++ b/chrome/browser/profile_resetter/profile_reset_global_error.h
@@ -7,13 +7,16 @@
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
+#include "base/timer/elapsed_timer.h"
#include "chrome/browser/ui/global_error/global_error.h"
+class AutomaticProfileResetter;
class GlobalErrorBubbleViewBase;
class Profile;
-// Shows preferences reset errors on the wrench menu and exposes a menu item to
-// launch a bubble view.
+// Encapsulates UI-related functionality for the one-time profile settings reset
+// prompt. The UI consists of two parts: (1.) the profile reset (pop-up) bubble,
+// and (2.) a menu item in the wrench menu (provided by us being a GlobalError).
class ProfileResetGlobalError
: public GlobalError,
public base::SupportsWeakPtr<ProfileResetGlobalError> {
@@ -21,6 +24,9 @@ class ProfileResetGlobalError
explicit ProfileResetGlobalError(Profile* profile);
virtual ~ProfileResetGlobalError();
+ // Returns whether or not the reset prompt is supported on this platform.
+ static bool IsSupportedOnPlatform();
+
// Called by the bubble view when it is closed.
void OnBubbleViewDidClose();
@@ -45,9 +51,17 @@ class ProfileResetGlobalError
private:
Profile* profile_;
- // The number of times we have shown the bubble so far. This can be >1 if the
- // user dismissed the bubble, then selected the menu item to show it again.
- int num_times_bubble_view_shown_;
+ // GlobalErrorService owns us, on which AutomaticProfileResetter depends, so
+ // during shutdown, it may get destroyed before we are.
+ // Note: the AutomaticProfileResetter expects call-backs from us to always be
+ // synchronous, so that there will be no call-backs once we are destroyed.
+ base::WeakPtr<AutomaticProfileResetter> automatic_profile_resetter_;
+
+ // Used to measure the delay before the bubble actually gets shown.
+ base::ElapsedTimer timer_;
+
+ // Whether or not we have already shown the bubble.
+ bool has_shown_bubble_view_;
// The reset bubble, if we're currently showing one.
GlobalErrorBubbleViewBase* bubble_view_;

Powered by Google App Engine
This is Rietveld 408576698