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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.h

Issue 55243005: Implement learn more bubble on views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 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/ui/views/autofill/autofill_dialog_views.h
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.h b/chrome/browser/ui/views/autofill/autofill_dialog_views.h
index defdb5293f83c5323c632da2f73d2f68aad6a3df..a6b1fdca2c744816cb1171949c90416f725b1f02 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.h
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.h
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h"
+#include "chrome/browser/ui/views/autofill/learn_more_icon.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/menu_button.h"
@@ -68,7 +69,8 @@ class AutofillDialogViews : public AutofillDialogView,
public views::FocusChangeListener,
public views::ComboboxListener,
public views::StyledLabelListener,
- public views::MenuButtonListener {
+ public views::MenuButtonListener,
+ public LearnMoreIconDelegate {
public:
explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate);
virtual ~AutofillDialogViews();
@@ -170,6 +172,10 @@ class AutofillDialogViews : public AutofillDialogView,
virtual void OnMenuButtonClicked(views::View* source,
const gfx::Point& point) OVERRIDE;
+ // LearnMoreIconDelegate implementation.
+ virtual void OnLearnMoreIconMouseEntered(LearnMoreIcon* icon) OVERRIDE;
+ virtual void OnLearnMoreIconMouseExited(LearnMoreIcon* icon) OVERRIDE;
+
protected:
// Exposed for testing.
views::View* GetLoadingShieldForTesting();
@@ -187,12 +193,12 @@ class AutofillDialogViews : public AutofillDialogView,
};
// A class that creates and manages a widget for error messages.
- class ErrorBubble : public views::BubbleDelegateView {
+ class InfoBubble : public views::BubbleDelegateView {
public:
- ErrorBubble(views::View* anchor,
- views::View* anchor_container,
- const base::string16& message);
- virtual ~ErrorBubble();
+ InfoBubble(views::View* anchor,
+ const base::string16& message,
+ bool snap_to_grid);
+ virtual ~InfoBubble();
// Updates the position of the bubble.
void UpdatePosition();
@@ -227,8 +233,9 @@ class AutofillDialogViews : public AutofillDialogView,
// Whether the bubble should be shown above the anchor (default is below).
const bool show_above_anchor_;
+ const bool snap_to_grid_;
- DISALLOW_COPY_AND_ASSIGN(ErrorBubble);
+ DISALLOW_COPY_AND_ASSIGN(InfoBubble);
};
// A View which displays the currently selected account and lets the user
@@ -312,7 +319,9 @@ class AutofillDialogViews : public AutofillDialogView,
// An area for notifications. Some notifications point at the account chooser.
class NotificationArea : public views::View {
public:
- explicit NotificationArea(AutofillDialogViewDelegate* delegate);
+ explicit NotificationArea(
+ AutofillDialogViewDelegate* delegate,
+ const base::WeakPtr<LearnMoreIconDelegate>& icon_delegate);
virtual ~NotificationArea();
// Displays the given notifications.
@@ -338,6 +347,10 @@ class AutofillDialogViews : public AutofillDialogView,
// Used to report when checkboxes change their values.
AutofillDialogViewDelegate* delegate_; // weak
+ // A weak pointer to the delegate that should be passed to any created
+ // LearnMoreIcons (see: |SetNotifications()|).
+ base::WeakPtr<LearnMoreIconDelegate> icon_delegate_;
+
// If HasArrow() is true, the arrow should point at this.
base::WeakPtr<views::View> arrow_centering_anchor_;
@@ -586,8 +599,12 @@ class AutofillDialogViews : public AutofillDialogView,
// |validity_map_|.
void ShowErrorBubbleForViewIfNecessary(views::View* view);
- // Hides |error_bubble_| (if it exists).
+ // Shows an informational "learn more" bubble pointing at |icon|.
+ void ShowLearnMoreBubbleIfNecessary(LearnMoreIcon* icon);
+
+ // Hides |error_bubble_| or |learn_more_bubble_| (if they exist).
void HideErrorBubble();
+ void HideLearnMoreBubble();
// Updates validity of the inputs in |section| with new |validity_messages|.
// Fields are only updated with unsure messages if |overwrite_valid| is true.
@@ -711,8 +728,9 @@ class AutofillDialogViews : public AutofillDialogView,
// The focus manager for |window_|.
views::FocusManager* focus_manager_;
- // The object that manages the error bubble widget.
- ErrorBubble* error_bubble_; // Weak; owns itself.
+ // Bubbles to show validation errors or informational messages.
+ InfoBubble* error_bubble_; // Weak; owns itself.
+ InfoBubble* learn_more_bubble_; // Weak; owns itself.
// Map from input view (textfield or combobox) to error string.
std::map<views::View*, base::string16> validity_map_;
@@ -722,6 +740,8 @@ class AutofillDialogViews : public AutofillDialogView,
// Delegate for the sign-in dialog's webview.
scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_;
+ base::WeakPtrFactory<AutofillDialogViews> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews);
};

Powered by Google App Engine
This is Rietveld 408576698