Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/ui/toolbar/media_router_contextual_menu.h

Issue 2559323002: Add a policy to always show the Cast toolbar icon (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/base/models/simple_menu_model.h" 10 #include "ui/base/models/simple_menu_model.h"
11 11
12 class Browser; 12 class Browser;
13 13
14 namespace extensions { 14 namespace extensions {
15 class ComponentMigrationHelper; 15 class ComponentMigrationHelper;
16 } // namespace extensions 16 } // namespace extensions
17 17
18 // The class for the contextual menu for the Media Router action. 18 // The class for the contextual menu for the Media Router action.
19 class MediaRouterContextualMenu : public ui::SimpleMenuModel::Delegate { 19 class MediaRouterContextualMenu : public ui::SimpleMenuModel::Delegate {
20 public: 20 public:
21 explicit MediaRouterContextualMenu(Browser* browser); 21 explicit MediaRouterContextualMenu(Browser* browser);
22 // Constructor for injecting values in tests.
imcheng 2016/12/15 19:57:38 nit: empty line above
takumif 2016/12/15 22:04:14 Done.
23 MediaRouterContextualMenu(Browser* browser, bool shown_by_policy);
22 ~MediaRouterContextualMenu() override; 24 ~MediaRouterContextualMenu() override;
23 25
24 ui::MenuModel* menu_model() { return &menu_model_; } 26 ui::MenuModel* menu_model() { return &menu_model_; }
25 27
26 private: 28 private:
27 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest, 29 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest,
28 ToggleCloudServicesItem); 30 ToggleCloudServicesItem);
29 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest, 31 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest,
30 ToggleAlwaysShowIconItem); 32 ToggleAlwaysShowIconItem);
33 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest,
34 ActionShownByPolicy);
31 35
32 // Gets or sets the "Always show icon" option. 36 // Gets or sets the "Always show icon" option.
33 bool GetAlwaysShowActionPref() const; 37 bool GetAlwaysShowActionPref() const;
34 void SetAlwaysShowActionPref(bool always_show); 38 void SetAlwaysShowActionPref(bool always_show);
35 39
36 // ui::SimpleMenuModel::Delegate: 40 // ui::SimpleMenuModel::Delegate:
37 bool IsCommandIdChecked(int command_id) const override; 41 bool IsCommandIdChecked(int command_id) const override;
38 bool IsCommandIdEnabled(int command_id) const override; 42 bool IsCommandIdEnabled(int command_id) const override;
39 bool IsCommandIdVisible(int command_id) const override; 43 bool IsCommandIdVisible(int command_id) const override;
40 void ExecuteCommand(int command_id, int event_flags) override; 44 void ExecuteCommand(int command_id, int event_flags) override;
41 45
42 void ReportIssue(); 46 void ReportIssue();
43 47
44 Browser* const browser_; 48 Browser* const browser_;
45 ui::SimpleMenuModel menu_model_; 49 ui::SimpleMenuModel menu_model_;
46 extensions::ComponentMigrationHelper* const component_migration_helper_; 50 extensions::ComponentMigrationHelper* const component_migration_helper_;
47 51
52 // Whether the media router action is shown by an administrator policy.
53 bool shown_by_policy_;
54
48 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenu); 55 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenu);
49 }; 56 };
50 57
51 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_ 58 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698