Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / views / profiles / profile_reset_bubble_view.h
blob771822a3f953ea9e83617f8985dc49abcc3541cc
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_RESET_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_RESET_BUBBLE_VIEW_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/values.h"
12 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h"
13 #include "ui/gfx/image/image_skia.h"
14 #include "ui/views/bubble/bubble_delegate.h"
15 #include "ui/views/controls/button/button.h"
16 #include "ui/views/controls/link_listener.h"
18 namespace content {
19 class PageNavigator;
22 namespace views {
23 class Checkbox;
24 class ImageButton;
25 class LabelButton;
26 class Link;
29 class Browser;
30 class Profile;
31 class ProfileResetGlobalError;
32 class ResettableSettingsSnapshot;
34 // ProfileResetBubbleView warns the user that a settings reset might be needed.
35 // It is intended to be used as the content of a bubble anchored off of the
36 // Chrome toolbar.
37 class ProfileResetBubbleView : public views::BubbleDelegateView,
38 public views::ButtonListener,
39 public views::LinkListener,
40 public GlobalErrorBubbleViewBase {
41 public:
42 static ProfileResetBubbleView* ShowBubble(
43 const base::WeakPtr<ProfileResetGlobalError>& global_error,
44 Browser* browser);
46 // views::BubbleDelegateView methods.
47 views::View* GetInitiallyFocusedView() override;
48 void Init() override;
50 // views::WidgetDelegate method.
51 void WindowClosing() override;
53 // GlobalErrorBubbleViewBase:
54 void CloseBubbleView() override;
56 private:
57 ProfileResetBubbleView(
58 const base::WeakPtr<ProfileResetGlobalError>& global_error,
59 views::View* anchor_view,
60 content::PageNavigator* navigator,
61 Profile* profile);
63 ~ProfileResetBubbleView() override;
65 // Reset all child views members and remove children from view hierarchy.
66 void ResetAllChildren();
68 // Sets up the layout manager and set the report checkbox to the value passed
69 // in |report_checked|.
70 void SetupLayoutManager(bool report_checked);
72 // views::ButtonListener method.
73 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
75 // views::LinkListener method.
76 void LinkClicked(views::Link* source, int event_flags) override;
78 // Sets the fully populated feedback data.
79 void UpdateFeedbackDetails();
81 struct Controls {
82 Controls() {
83 Reset();
85 void Reset() {
86 reset_button = NULL;
87 no_thanks_button = NULL;
88 help_button = NULL;
89 report_settings_checkbox = NULL;
92 // Button for the user to confirm a settings reset.
93 views::LabelButton* reset_button;
95 // Button for the user to refuse a settings reset.
96 views::LabelButton* no_thanks_button;
98 // Button for the user to get more info about reporting settings.
99 views::ImageButton* help_button;
101 // Checkbox for the user to choose to report the settings or not.
102 views::Checkbox* report_settings_checkbox;
103 } controls_;
105 // The snapshot is used to show user feedback information.
106 scoped_ptr<ResettableSettingsSnapshot> snapshot_;
108 // A version of the help image that is brighter.
109 gfx::ImageSkia brighter_help_image_;
111 // Used for opening the learn more link.
112 content::PageNavigator* navigator_;
114 // Used to access profile specific stuff like the global error or readable
115 // feedback.
116 Profile* profile_;
118 // The GlobalError this Bubble belongs to.
119 base::WeakPtr<ProfileResetGlobalError> global_error_;
121 // Remembers if we are currently resetting or not.
122 bool resetting_;
124 // Remembers if the reset button was hit before closing the bubble.
125 bool chose_to_reset_;
127 // Toggles when the user clicks on the |help_button_| to identify if we should
128 // show the help pane or not.
129 bool show_help_pane_;
131 // To cancel pending callbacks after destruction.
132 base::WeakPtrFactory<ProfileResetBubbleView> weak_factory_;
134 DISALLOW_COPY_AND_ASSIGN(ProfileResetBubbleView);
137 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_RESET_BUBBLE_VIEW_H_