summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/chrome_bubble_manager.h
blob: 57c23d85564044a72d6e091e3a1dcd28ba85f1ef (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
48
49
50
51
52
53
54
55
// 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_CHROME_BUBBLE_MANAGER_H_
#define CHROME_BROWSER_UI_CHROME_BUBBLE_MANAGER_H_

#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "components/bubble/bubble_manager.h"
#include "content/public/browser/web_contents_observer.h"

class TabStripModel;

class ChromeBubbleManager : public BubbleManager,
                            public TabStripModelObserver,
                            public content::WebContentsObserver {
 public:
  explicit ChromeBubbleManager(TabStripModel* tab_strip_model);
  ~ChromeBubbleManager() override;

  // TabStripModelObserver:
  void TabDetachedAt(content::WebContents* contents, int index) override;
  void TabDeactivated(content::WebContents* contents) override;
  void ActiveTabChanged(content::WebContents* old_contents,
                        content::WebContents* new_contents,
                        int index,
                        int reason) override;

  // content::WebContentsObserver:
  void DidToggleFullscreenModeForTab(bool entered_fullscreen) override;
  void NavigationEntryCommitted(
      const content::LoadCommittedDetails& load_details) override;

 private:
  class ChromeBubbleMetrics : public BubbleManager::BubbleManagerObserver {
   public:
    ChromeBubbleMetrics() {}
    ~ChromeBubbleMetrics() override {}

    // BubbleManager::BubbleManagerObserver:
    void OnBubbleNeverShown(BubbleReference bubble) override;
    void OnBubbleClosed(BubbleReference bubble,
                        BubbleCloseReason reason) override;

   private:
    DISALLOW_COPY_AND_ASSIGN(ChromeBubbleMetrics);
  };

  TabStripModel* tab_strip_model_;
  ChromeBubbleMetrics chrome_bubble_metrics_;

  DISALLOW_COPY_AND_ASSIGN(ChromeBubbleManager);
};

#endif  // CHROME_BROWSER_UI_CHROME_BUBBLE_MANAGER_H_