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

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

Issue 2176613003: [Media Router] Clean up issues related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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_ACTION_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/optional.h"
12 #include "base/scoped_observer.h" 13 #include "base/scoped_observer.h"
13 #include "chrome/browser/media/router/issues_observer.h" 14 #include "chrome/browser/media/router/issues_observer.h"
14 #include "chrome/browser/media/router/media_routes_observer.h" 15 #include "chrome/browser/media/router/media_routes_observer.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
16 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" 17 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h"
17 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" 18 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
18 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" 19 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
19 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h" 20 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h"
20 #include "ui/gfx/vector_icons_public.h" 21 #include "ui/gfx/vector_icons_public.h"
21 22
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool WantsToRun(content::WebContents* web_contents) const override; 55 bool WantsToRun(content::WebContents* web_contents) const override;
55 bool HasPopup(content::WebContents* web_contents) const override; 56 bool HasPopup(content::WebContents* web_contents) const override;
56 void HidePopup() override; 57 void HidePopup() override;
57 gfx::NativeView GetPopupNativeView() override; 58 gfx::NativeView GetPopupNativeView() override;
58 ui::MenuModel* GetContextMenu() override; 59 ui::MenuModel* GetContextMenu() override;
59 bool ExecuteAction(bool by_user) override; 60 bool ExecuteAction(bool by_user) override;
60 void UpdateState() override; 61 void UpdateState() override;
61 bool DisabledClickOpensMenu() const override; 62 bool DisabledClickOpensMenu() const override;
62 63
63 // media_router::IssuesObserver: 64 // media_router::IssuesObserver:
64 void OnIssueUpdated(const media_router::Issue* issue) override; 65 void OnIssue(const media_router::Issue& issue) override;
66 void OnIssuesCleared() override;
65 67
66 // media_router::MediaRoutesObserver: 68 // media_router::MediaRoutesObserver:
67 void OnRoutesUpdated(const std::vector<media_router::MediaRoute>& routes, 69 void OnRoutesUpdated(const std::vector<media_router::MediaRoute>& routes,
68 const std::vector<media_router::MediaRoute::Id>& 70 const std::vector<media_router::MediaRoute::Id>&
69 joinable_route_ids) override; 71 joinable_route_ids) override;
70 72
71 // ToolbarStripModelObserver: 73 // ToolbarStripModelObserver:
72 void ActiveTabChanged(content::WebContents* old_contents, 74 void ActiveTabChanged(content::WebContents* old_contents,
73 content::WebContents* new_contents, 75 content::WebContents* new_contents,
74 int index, 76 int index,
(...skipping 29 matching lines...) Expand all
104 // Checks if the current icon of MediaRouterAction has changed. If so, 106 // Checks if the current icon of MediaRouterAction has changed. If so,
105 // updates |current_icon_|. 107 // updates |current_icon_|.
106 void MaybeUpdateIcon(); 108 void MaybeUpdateIcon();
107 109
108 gfx::VectorIconId GetCurrentIcon() const; 110 gfx::VectorIconId GetCurrentIcon() const;
109 111
110 // The current icon to show. This is updated based on the current issues and 112 // The current icon to show. This is updated based on the current issues and
111 // routes since |this| is an IssueObserver and MediaRoutesObserver. 113 // routes since |this| is an IssueObserver and MediaRoutesObserver.
112 gfx::VectorIconId current_icon_; 114 gfx::VectorIconId current_icon_;
113 115
114 // The current issue shown in the Media Router WebUI. Can be null. It is set 116 // The current issue shown in the Media Router WebUI, or not set if there are
115 // in OnIssueUpdated(), which is called by the IssueManager. 117 // no issues currently.
116 std::unique_ptr<media_router::Issue> issue_; 118 // Set in OnIssueUpdated(), which is called by the IssueManager.
119 base::Optional<media_router::IssueInfo> current_issue_;
117 120
118 // Whether a local displayable active route exists. 121 // Whether a local displayable active route exists.
119 bool has_local_display_route_; 122 bool has_local_display_route_;
120 123
121 // Whether the Media Router dialog is shown in the current tab. 124 // Whether the Media Router dialog is shown in the current tab.
122 // This should only be updated in OnDialogShown() and OnDialogHidden(). 125 // This should only be updated in OnDialogShown() and OnDialogHidden().
123 bool has_dialog_; 126 bool has_dialog_;
124 127
125 ToolbarActionViewDelegate* delegate_; 128 ToolbarActionViewDelegate* delegate_;
126 129
127 Browser* const browser_; 130 Browser* const browser_;
128 ToolbarActionsBar* const toolbar_actions_bar_; 131 ToolbarActionsBar* const toolbar_actions_bar_;
129 132
130 // The delegate to handle platform-specific implementations. 133 // The delegate to handle platform-specific implementations.
131 std::unique_ptr<MediaRouterActionPlatformDelegate> platform_delegate_; 134 std::unique_ptr<MediaRouterActionPlatformDelegate> platform_delegate_;
132 135
133 MediaRouterContextualMenu contextual_menu_; 136 MediaRouterContextualMenu contextual_menu_;
134 137
135 ScopedObserver<TabStripModel, TabStripModelObserver> 138 ScopedObserver<TabStripModel, TabStripModelObserver>
136 tab_strip_model_observer_; 139 tab_strip_model_observer_;
137 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> 140 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver>
138 toolbar_actions_bar_observer_; 141 toolbar_actions_bar_observer_;
139 142
140 base::WeakPtrFactory<MediaRouterAction> weak_ptr_factory_; 143 base::WeakPtrFactory<MediaRouterAction> weak_ptr_factory_;
141 144
142 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); 145 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction);
143 }; 146 };
144 147
145 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ 148 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698