| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | |
| 10 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h" | 9 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h" |
| 11 | 10 |
| 12 class Browser; | 11 class Browser; |
| 13 class CommandUpdater; | 12 class CommandUpdater; |
| 14 | 13 |
| 15 namespace autofill { | 14 namespace autofill { |
| 16 | 15 |
| 17 class SaveCardBubbleControllerImpl; | 16 class SaveCardBubbleControllerImpl; |
| 18 | 17 |
| 19 // The location bar icon to show the Save Credit Card bubble where the user can | 18 // The location bar icon to show the Save Credit Card bubble where the user can |
| 20 // choose to save the credit card info to use again later without re-entering | 19 // choose to save the credit card info to use again later without re-entering |
| 21 // it. | 20 // it. |
| 22 class SaveCardIconView : public BubbleIconView, public TabStripModelObserver { | 21 class SaveCardIconView : public BubbleIconView { |
| 23 public: | 22 public: |
| 24 explicit SaveCardIconView(CommandUpdater* command_updater, Browser* browser); | 23 explicit SaveCardIconView(CommandUpdater* command_updater, Browser* browser); |
| 25 ~SaveCardIconView() override; | 24 ~SaveCardIconView() override; |
| 26 | 25 |
| 27 protected: | 26 protected: |
| 28 // BubbleIconView: | 27 // BubbleIconView: |
| 29 void OnExecuting(BubbleIconView::ExecuteSource execute_source) override; | 28 void OnExecuting(BubbleIconView::ExecuteSource execute_source) override; |
| 30 views::BubbleDialogDelegateView* GetBubble() const override; | 29 views::BubbleDialogDelegateView* GetBubble() const override; |
| 31 gfx::VectorIconId GetVectorIcon() const override; | 30 gfx::VectorIconId GetVectorIcon() const override; |
| 32 | 31 |
| 33 // TabStripModelObserver: | |
| 34 void TabDeactivated(content::WebContents* contents) override; | |
| 35 | |
| 36 private: | 32 private: |
| 37 SaveCardBubbleControllerImpl* GetController() const; | 33 SaveCardBubbleControllerImpl* GetController() const; |
| 38 | 34 |
| 39 // May be nullptr. | 35 // May be nullptr. |
| 40 Browser* browser_; | 36 Browser* browser_; |
| 41 | 37 |
| 42 DISALLOW_COPY_AND_ASSIGN(SaveCardIconView); | 38 DISALLOW_COPY_AND_ASSIGN(SaveCardIconView); |
| 43 }; | 39 }; |
| 44 | 40 |
| 45 } // namespace autofill | 41 } // namespace autofill |
| 46 | 42 |
| 47 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ | 43 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ |
| OLD | NEW |