blob: 6cc6073cf8ca7248525faab2f2efbcf26108f187 [file] [log] [blame]
apacible86792f62015-04-19 03:40:001// Copyright 2015 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_TOOLBAR_MEDIA_ROUTER_ACTION_H_
6#define CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_
7
apaciblee3aa66652015-07-23 22:18:248#include "chrome/browser/ui/toolbar/media_router_contextual_menu.h"
apacible86792f62015-04-19 03:40:009#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
10
apacible4b1690352015-07-20 16:32:3611class Browser;
12class MediaRouterActionPlatformDelegate;
13
imcheng12fcff42015-06-04 18:37:1214namespace media_router {
avayvod69b3a41f2015-07-29 16:58:1715class MediaRouterDialogController;
imcheng12fcff42015-06-04 18:37:1216} // namespace media_router
17
apacible86792f62015-04-19 03:40:0018// The class for the Media Router component action that will be shown in
19// the toolbar.
20class MediaRouterAction : public ToolbarActionViewController {
21 public:
apacible4b1690352015-07-20 16:32:3622 explicit MediaRouterAction(Browser* browser);
apacible86792f62015-04-19 03:40:0023 ~MediaRouterAction() override;
24
25 // ToolbarActionViewController implementation.
26 const std::string& GetId() const override;
27 void SetDelegate(ToolbarActionViewDelegate* delegate) override;
rdevlin.cronin3a57a7f2015-07-06 21:22:4328 gfx::Image GetIcon(content::WebContents* web_contents,
29 const gfx::Size& size) override;
apacible86792f62015-04-19 03:40:0030 base::string16 GetActionName() const override;
31 base::string16 GetAccessibleName(content::WebContents* web_contents)
32 const override;
33 base::string16 GetTooltip(content::WebContents* web_contents)
34 const override;
35 bool IsEnabled(content::WebContents* web_contents) const override;
36 bool WantsToRun(content::WebContents* web_contents) const override;
37 bool HasPopup(content::WebContents* web_contents) const override;
38 void HidePopup() override;
39 gfx::NativeView GetPopupNativeView() override;
40 ui::MenuModel* GetContextMenu() override;
apacible86792f62015-04-19 03:40:0041 bool CanDrag() const override;
42 bool ExecuteAction(bool by_user) override;
43 void UpdateState() override;
rdevlin.croninac27cf32015-07-09 17:12:3444 bool DisabledClickOpensMenu() const override;
apacible86792f62015-04-19 03:40:0045
46 private:
imcheng12fcff42015-06-04 18:37:1247 // Returns a reference to the MediaRouterDialogController associated with
48 // |delegate_|'s current WebContents. Guaranteed to be non-null.
49 // |delegate_| and its current WebContents must not be null.
avayvod69b3a41f2015-07-29 16:58:1750 media_router::MediaRouterDialogController* GetMediaRouterDialogController();
imcheng12fcff42015-06-04 18:37:1251
apacible86792f62015-04-19 03:40:0052 const std::string id_;
53 const base::string16 name_;
54
55 // Cached icons.
56 gfx::Image media_router_idle_icon_;
57
58 ToolbarActionViewDelegate* delegate_;
59
apacible4b1690352015-07-20 16:32:3660 // The delegate to handle platform-specific implementations.
61 scoped_ptr<MediaRouterActionPlatformDelegate> platform_delegate_;
62
apaciblee3aa66652015-07-23 22:18:2463 MediaRouterContextualMenu contextual_menu_;
64
apacible86792f62015-04-19 03:40:0065 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction);
66};
67
68#endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_