summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/autofill/save_card_icon_view.h
blob: d2a6d03c1d761032c7c1f0e0189e08fb23e8b1f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_

#include "base/macros.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/views/location_bar/bubble_icon_view.h"

class Browser;
class CommandUpdater;

namespace autofill {

class SaveCardBubbleControllerImpl;

// The location bar icon to show the Save Credit Card bubble where the user can
// choose to save the credit card info to use again later without re-entering
// it.
class SaveCardIconView : public BubbleIconView, public TabStripModelObserver {
 public:
  explicit SaveCardIconView(CommandUpdater* command_updater, Browser* browser);
  ~SaveCardIconView() override;

 protected:
  // BubbleIconView:
  void OnExecuting(BubbleIconView::ExecuteSource execute_source) override;
  views::BubbleDialogDelegateView* GetBubble() const override;
  gfx::VectorIconId GetVectorIcon() const override;

  // TabStripModelObserver:
  void TabDeactivated(content::WebContents* contents) override;

 private:
  SaveCardBubbleControllerImpl* GetController() const;

  // May be nullptr.
  Browser* browser_;

  DISALLOW_COPY_AND_ASSIGN(SaveCardIconView);
};

}  // namespace autofill

#endif  // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_