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

Unified Diff: chrome/browser/ui/views/sync/one_click_signin_bubble_view.h

Issue 13979003: Win: Display a native bubble (instead of the JS one) after the web signin flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months 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/sync/one_click_signin_bubble_view.h
diff --git a/chrome/browser/ui/views/sync/one_click_signin_bubble_view.h b/chrome/browser/ui/views/sync/one_click_signin_bubble_view.h
index e8a2c9f679394ab49773e3748753dfe61e32d612..4683dbcbdfe0e3f918f67ce176f5ba9ef7b720c5 100644
--- a/chrome/browser/ui/views/sync/one_click_signin_bubble_view.h
+++ b/chrome/browser/ui/views/sync/one_click_signin_bubble_view.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_
+#include <string>
+
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
@@ -37,6 +39,7 @@ class OneClickSigninBubbleView : public views::BubbleDelegateView,
// to start sync.
static void ShowBubble(BrowserWindow::OneClickSigninBubbleType type,
const string16& email,
+ const string16& error_message,
ToolbarView* toolbar_view,
const BrowserWindow::StartSyncCallback& start_sync);
@@ -51,11 +54,37 @@ class OneClickSigninBubbleView : public views::BubbleDelegateView,
protected:
// Creates a OneClickSigninBubbleView.
OneClickSigninBubbleView(
+ content::WebContents* web_contents,
views::View* anchor_view,
- const BrowserWindow::StartSyncCallback& start_sync_callback);
+ const string16& error_message,
+ const string16& email,
+ const BrowserWindow::StartSyncCallback& start_sync_callback,
+ bool is_sync_dialog);
virtual ~OneClickSigninBubbleView();
+ private:
+ friend class OneClickSigninBubbleViewBrowserTest;
+
+ FRIEND_TEST_ALL_PREFIXES(
+ OneClickSigninBubbleViewBrowserTest, BubbleOkButton);
+ FRIEND_TEST_ALL_PREFIXES(
+ OneClickSigninBubbleViewBrowserTest, DialogOkButton);
+ FRIEND_TEST_ALL_PREFIXES(
+ OneClickSigninBubbleViewBrowserTest, DialogUndoButton);
+ FRIEND_TEST_ALL_PREFIXES(
+ OneClickSigninBubbleViewBrowserTest, BubbleAdvancedLink);
+ FRIEND_TEST_ALL_PREFIXES(
+ OneClickSigninBubbleViewBrowserTest, DialogAdvancedLink);
+ FRIEND_TEST_ALL_PREFIXES(
+ OneClickSigninBubbleViewBrowserTest, BubbleLearnMoreLink);
+ FRIEND_TEST_ALL_PREFIXES(
+ OneClickSigninBubbleViewBrowserTest, DialogLearnMoreLink);
+
+ // Overridden from views::BubbleDelegateView:
+ virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
+ virtual void Init() OVERRIDE;
+
// Overridden from views::LinkListener:
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
@@ -63,56 +92,64 @@ class OneClickSigninBubbleView : public views::BubbleDelegateView,
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
- private:
- friend class OneClickSigninBubbleViewBrowserTest;
+ // Overridden from views::View:
+ virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
- FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleViewBrowserTest, OkButton);
- FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleViewBrowserTest, UndoButton);
- FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleViewBrowserTest, AdvancedLink);
+ // Overridden from views::WidgetDelegate:
+ virtual void WindowClosing() OVERRIDE;
+ virtual ui::ModalType GetModalType() const OVERRIDE;
- // views::BubbleDelegateView methods:
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
- virtual void Init() OVERRIDE;
+ // Builds a popup bubble anchored under the wrench menu
+ void InitBubbleContent(views::GridLayout* layout);
- // Method to build the main part of the bubble. Derived classes should
- // reimplement this function.
- virtual void InitContent(views::GridLayout* layout);
+ // Builds a modal dialog aligned center top
+ void InitDialogContent(views::GridLayout* layout);
- // Creates OK and Undo buttons to be used at the bottom of the bubble.
- // Derived classes can reimplement to have buttons with different labels,
- // colours, or sizes. The caller of this function owns the returned buttons.
- virtual void GetButtons(views::LabelButton** ok_button,
+ // Initializes the OK/Undo buttons to be used at the bottom of the bubble.
+ void InitButtons(views::GridLayout* layout);
+ void GetButtons(views::LabelButton** ok_button,
views::LabelButton** undo_button);
+ // Creates learn more link to be used at the bottom of the bubble.
+ void InitLearnMoreLink();
+
// Creates advanced link to be used at the bottom of the bubble.
- // Derived classes can reimplement. The caller of this function owns the
- // returned link.
- virtual views::Link* GetAdvancedLink();
+ void InitAdvancedLink();
- // views::WidgetDelegate method:
- virtual void WindowClosing() OVERRIDE;
+ // The bubble/dialog will always outlive the web_content, so this is ok
+ content::WebContents* web_contents_;
- // views::View method:
- virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
+ // Alternate error message to be displayed
+ string16 error_message_;
sky 2013/04/25 16:04:04 const
- // The bubble, if we're showing one.
- static OneClickSigninBubbleView* bubble_view_;
+ const string16 email_;
+
+ // This callback is nulled once its called, so that it is called only once.
+ // It will be called when the bubble is closed if it has not been called
+ // and nulled earlier.
+ BrowserWindow::StartSyncCallback start_sync_callback_;
+
+ bool is_sync_dialog_;
sky 2013/04/25 16:04:04 const
// Link to sync setup advanced page.
views::Link* advanced_link_;
+ // Link to the Learn More details page
+ views::Link* learn_more_link_;
+
// Controls at bottom of bubble.
views::LabelButton* ok_button_;
views::LabelButton* undo_button_;
- // This callback is nulled once its called, so that it is called only once.
- // It will be called when the bubble is closed if it has not been called
- // and nulled earlier.
- BrowserWindow::StartSyncCallback start_sync_callback_;
+ // Close button for the modal dialog
+ views::ImageButton* close_button_;
// A message loop used only with unit tests.
base::MessageLoop* message_loop_for_testing_;
+ // The bubble, if we're showing one.
+ static OneClickSigninBubbleView* bubble_view_;
+
DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleView);
};
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/sync/one_click_signin_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698