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

Side by Side Diff: chrome/browser/ui/webui/media_router/media_router_webui_message_handler.h

Issue 2040883002: [Media Router] Assign each route a current cast mode if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase for WebUI::CallJavascriptFunction rename Created 4 years, 6 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_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDLER_ H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDLER_ H_
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDLER_ H_ 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDLER_ H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 21 matching lines...) Expand all
32 32
33 // The handler for Javascript messages related to the media router dialog. 33 // The handler for Javascript messages related to the media router dialog.
34 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { 34 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler {
35 public: 35 public:
36 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui); 36 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui);
37 ~MediaRouterWebUIMessageHandler() override; 37 ~MediaRouterWebUIMessageHandler() override;
38 38
39 // Methods to update the status displayed by the dialog. 39 // Methods to update the status displayed by the dialog.
40 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); 40 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks);
41 void UpdateRoutes(const std::vector<MediaRoute>& routes, 41 void UpdateRoutes(const std::vector<MediaRoute>& routes,
42 const std::vector<MediaRoute::Id>& joinable_route_ids); 42 const std::vector<MediaRoute::Id>& joinable_route_ids,
43 const std::unordered_map<MediaRoute::Id, MediaCastMode>&
44 current_cast_modes);
43 void UpdateCastModes(const CastModeSet& cast_modes, 45 void UpdateCastModes(const CastModeSet& cast_modes,
44 const std::string& source_host); 46 const std::string& source_host);
45 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id, 47 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id,
46 const MediaRoute* route); 48 const MediaRoute* route);
47 void ReturnSearchResult(const std::string& sink_id); 49 void ReturnSearchResult(const std::string& sink_id);
48 50
49 // Does not take ownership of |issue|. Note that |issue| can be nullptr, when 51 // Does not take ownership of |issue|. Note that |issue| can be nullptr, when
50 // there are no more issues. 52 // there are no more issues.
51 void UpdateIssue(const Issue* issue); 53 void UpdateIssue(const Issue* issue);
52 54
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // |args| contains additional parameter that varies based on |type|. 93 // |args| contains additional parameter that varies based on |type|.
92 // Returns |true| if the action was successfully performed. 94 // Returns |true| if the action was successfully performed.
93 bool ActOnIssueType(const IssueAction::Type& type, 95 bool ActOnIssueType(const IssueAction::Type& type,
94 const base::DictionaryValue* args); 96 const base::DictionaryValue* args);
95 97
96 // May update the first run flow related properties in the WebUI. This is 98 // May update the first run flow related properties in the WebUI. This is
97 // called after the initial data is received to avoid unnecessary work when 99 // called after the initial data is received to avoid unnecessary work when
98 // initializing the WebUI. 100 // initializing the WebUI.
99 void MaybeUpdateFirstRunFlowData(); 101 void MaybeUpdateFirstRunFlowData();
100 102
103 // Returns the current cast mode for the route with ID |route_id| or -1 if the
104 // route has no current cast mode.
105 int CurrentCastModeForRouteId(
106 const MediaRoute::Id& route_id,
107 const std::unordered_map<MediaRoute::Id, MediaCastMode>&
108 current_cast_modes) const;
109
101 // Converts |routes| and |joinable_route_ids| into base::ListValue that can be 110 // Converts |routes| and |joinable_route_ids| into base::ListValue that can be
102 // passed to WebUI. 111 // passed to WebUI.
103 std::unique_ptr<base::ListValue> RoutesToValue( 112 std::unique_ptr<base::ListValue> RoutesToValue(
104 const std::vector<MediaRoute>& routes, 113 const std::vector<MediaRoute>& routes,
105 const std::vector<MediaRoute::Id>& joinable_route_ids) const; 114 const std::vector<MediaRoute::Id>& joinable_route_ids,
115 const std::unordered_map<MediaRoute::Id, MediaCastMode>&
116 current_cast_modes) const;
106 117
107 // Retrieve the account info for email and domain of signed in users. This is 118 // Retrieve the account info for email and domain of signed in users. This is
108 // used when updating sinks to determine if identity should be displayed. 119 // used when updating sinks to determine if identity should be displayed.
109 // Marked virtual for tests. 120 // Marked virtual for tests.
110 virtual AccountInfo GetAccountInfo(); 121 virtual AccountInfo GetAccountInfo();
111 122
112 // |true| if the associated Profile is off the record. 123 // |true| if the associated Profile is off the record.
113 bool off_the_record_; 124 bool off_the_record_;
114 125
115 // Keeps track of whether a command to close the dialog has been issued. 126 // Keeps track of whether a command to close the dialog has been issued.
116 bool dialog_closing_; 127 bool dialog_closing_;
117 128
118 MediaRouterUI* media_router_ui_; 129 MediaRouterUI* media_router_ui_;
119 130
120 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); 131 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler);
121 }; 132 };
122 133
123 } // namespace media_router 134 } // namespace media_router
124 135
125 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ 136 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698