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

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

Issue 2721953002: [Media Router] Add "Hide in menu/Show in toolbar" option to Cast toolbar icon (Closed)
Patch Set: Created 3 years, 9 months 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 // The class for the contextual menu for the Media Router action. 14 // The class for the contextual menu for the Media Router action.
15 class MediaRouterContextualMenu : public ui::SimpleMenuModel::Delegate { 15 class MediaRouterContextualMenu : public ui::SimpleMenuModel::Delegate {
16 public: 16 public:
17 explicit MediaRouterContextualMenu(Browser* browser); 17 static std::unique_ptr<MediaRouterContextualMenu> CreateForToolbar(
msw 2017/03/02 03:12:58 nit: add function comments here and below
takumif 2017/03/03 00:10:48 Done.
18 Browser* browser);
18 19
19 // Constructor for injecting values in tests. 20 static std::unique_ptr<MediaRouterContextualMenu> CreateForOverflowMenu(
20 MediaRouterContextualMenu(Browser* browser, bool shown_by_policy); 21 Browser* browser);
22
23 // Constructor called by the static Create* methods above and tests.
24 MediaRouterContextualMenu(Browser* browser,
25 bool is_in_toolbar,
msw 2017/03/02 03:12:58 optional nit: rename this and the new member |is_a
takumif 2017/03/03 00:10:48 Done.
26 bool shown_by_policy);
21 ~MediaRouterContextualMenu() override; 27 ~MediaRouterContextualMenu() override;
22 28
23 ui::MenuModel* menu_model() { return &menu_model_; } 29 ui::SimpleMenuModel* menu_model() { return &menu_model_; }
24 30
25 private: 31 private:
26 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest, 32 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest,
27 ToggleCloudServicesItem); 33 ToggleCloudServicesItem);
28 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest, 34 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest,
29 ToggleAlwaysShowIconItem); 35 ToggleAlwaysShowIconItem);
30 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest, 36 FRIEND_TEST_ALL_PREFIXES(MediaRouterContextualMenuUnitTest,
31 ActionShownByPolicy); 37 ActionShownByPolicy);
32 38
33 // Gets or sets the "Always show icon" option. 39 // Gets or sets the "Always show icon" option.
34 bool GetAlwaysShowActionPref() const; 40 bool GetAlwaysShowActionPref() const;
35 void SetAlwaysShowActionPref(bool always_show); 41 void SetAlwaysShowActionPref(bool always_show);
36 42
37 // ui::SimpleMenuModel::Delegate: 43 // ui::SimpleMenuModel::Delegate:
38 bool IsCommandIdChecked(int command_id) const override; 44 bool IsCommandIdChecked(int command_id) const override;
39 bool IsCommandIdEnabled(int command_id) const override; 45 bool IsCommandIdEnabled(int command_id) const override;
40 bool IsCommandIdVisible(int command_id) const override; 46 bool IsCommandIdVisible(int command_id) const override;
41 void ExecuteCommand(int command_id, int event_flags) override; 47 void ExecuteCommand(int command_id, int event_flags) override;
42 48
43 void ReportIssue(); 49 void ReportIssue();
50 int GetChangeVisibilityTextId();
msw 2017/03/02 03:12:58 nit: add function comments for this and ReportIsss
takumif 2017/03/03 00:10:48 Done.
44 51
45 Browser* const browser_; 52 Browser* const browser_;
46 ui::SimpleMenuModel menu_model_; 53 ui::SimpleMenuModel menu_model_;
47 54
55 // Whether the action icon is in the toolbar, as opposed to the overflow menu.
56 const bool is_in_toolbar_;
57
48 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenu); 58 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenu);
49 }; 59 };
50 60
51 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_ 61 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_CONTEXTUAL_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698