summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.h
blob: 6f126eeb48216fa3bb0efff426006522f217ff5e (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
56
// Copyright 2019 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_WEBUI_TAB_STRIP_TAB_STRIP_UI_H_
#define CHROME_BROWSER_UI_WEBUI_TAB_STRIP_TAB_STRIP_UI_H_

#include <memory>

#include "base/macros.h"
#include "chrome/browser/ui/webui/tab_strip/thumbnail_tracker.h"
#include "content/public/browser/web_ui_controller.h"

class Browser;

namespace gfx {
class Point;
}

namespace ui {
class MenuModel;
}

// The WebUI version of the tab strip in the browser. It is currently only
// supported on ChromeOS in tablet mode.
class TabStripUI : public content::WebUIController {
 public:
  // Interface to be implemented by the embedder. Provides native UI
  // functionality such as showing context menus.
  class Embedder {
   public:
    Embedder() = default;
    virtual ~Embedder() {}

    virtual void CloseContainer() = 0;

    virtual void ShowContextMenuAtPoint(
        gfx::Point point,
        std::unique_ptr<ui::MenuModel> menu_model) = 0;
  };

  explicit TabStripUI(content::WebUI* web_ui);
  ~TabStripUI() override;

  // Initialize TabStripUI with its embedder and the Browser it's running in.
  // Must be called exactly once. The WebUI won't work until this is called.
  void Initialize(Browser* browser, Embedder* embedder);

 private:
  void HandleThumbnailUpdate(int extension_tab_id,
                             ThumbnailTracker::CompressedThumbnailData image);

  DISALLOW_COPY_AND_ASSIGN(TabStripUI);
};

#endif  // CHROME_BROWSER_UI_WEBUI_TAB_STRIP_TAB_STRIP_UI_H_