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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOCHECKOUT_BUBBLE_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOCHECKOUT_BUBBLE_VIEWS_H_ 7 8 #include "base/callback_forward.h" 9 #include "base/memory/scoped_ptr.h" 10 #include "chrome/browser/ui/autofill/autocheckout_bubble.h" 11 #include "ui/views/bubble/bubble_delegate.h" 12 #include "ui/views/controls/button/button.h" 13 14 namespace views { 15 class LabelButton; 16 } 17 18 namespace autofill { 19 20 class AutocheckoutBubbleController; 21 22 // A bubble for prompting a user to use Autocheckout to fill forms for them. 23 // The bubble is only displayed when the Autofill server hints that the current 24 // page is the start of an Autocheckout flow. 25 class AutocheckoutBubbleViews : public views::BubbleDelegateView, 26 public views::ButtonListener, 27 public AutocheckoutBubble { 28 public: 29 AutocheckoutBubbleViews(scoped_ptr<AutocheckoutBubbleController> controller, 30 views::View* anchor_view); 31 32 // AutocheckoutBubble: 33 virtual void ShowBubble() OVERRIDE; 34 virtual void HideBubble() OVERRIDE; 35 36 private: 37 virtual ~AutocheckoutBubbleViews(); 38 39 // views::BubbleDelegateView: 40 virtual void Init() OVERRIDE; 41 virtual gfx::Rect GetAnchorRect() OVERRIDE; 42 virtual void OnWidgetBoundsChanged(views::Widget* widget, 43 const gfx::Rect& new_bounds) OVERRIDE; 44 45 // views::ButtonListener: 46 virtual void ButtonPressed(views::Button* sender, 47 const ui::Event& event) OVERRIDE; 48 49 scoped_ptr<AutocheckoutBubbleController> controller_; 50 views::Button* ok_button_; // weak 51 views::LabelButton* cancel_button_; // weak 52 53 DISALLOW_COPY_AND_ASSIGN(AutocheckoutBubbleViews); 54 }; 55 56 } // namespace autofill 57 58 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOCHECKOUT_BUBBLE_VIEWS_H_ 59