OLD | NEW |
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 <unordered_map> | 8 #include <unordered_map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/optional.h" |
12 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" | 13 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" |
13 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" | 14 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" |
14 #include "chrome/common/media_router/issue.h" | 15 #include "chrome/common/media_router/issue.h" |
15 #include "chrome/common/media_router/media_status.h" | 16 #include "chrome/common/media_router/media_status.h" |
16 #include "components/signin/core/browser/account_info.h" | 17 #include "components/signin/core/browser/account_info.h" |
17 #include "content/public/browser/web_ui_message_handler.h" | 18 #include "content/public/browser/web_ui_message_handler.h" |
18 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class DictionaryValue; | 22 class DictionaryValue; |
(...skipping 15 matching lines...) Expand all Loading... |
37 public: | 38 public: |
38 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui); | 39 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui); |
39 ~MediaRouterWebUIMessageHandler() override; | 40 ~MediaRouterWebUIMessageHandler() override; |
40 | 41 |
41 // Methods to update the status displayed by the dialog. | 42 // Methods to update the status displayed by the dialog. |
42 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); | 43 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); |
43 void UpdateRoutes(const std::vector<MediaRoute>& routes, | 44 void UpdateRoutes(const std::vector<MediaRoute>& routes, |
44 const std::vector<MediaRoute::Id>& joinable_route_ids, | 45 const std::vector<MediaRoute::Id>& joinable_route_ids, |
45 const std::unordered_map<MediaRoute::Id, MediaCastMode>& | 46 const std::unordered_map<MediaRoute::Id, MediaCastMode>& |
46 current_cast_modes); | 47 current_cast_modes); |
47 void UpdateCastModes(const CastModeSet& cast_modes, | 48 // Overridden in tests. |
48 const std::string& source_host); | 49 virtual void UpdateCastModes(const CastModeSet& cast_modes, |
| 50 const std::string& source_host, |
| 51 base::Optional<MediaCastMode> forced_cast_mode); |
49 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id, | 52 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id, |
50 const MediaRoute* route); | 53 const MediaRoute* route); |
51 void ReturnSearchResult(const std::string& sink_id); | 54 void ReturnSearchResult(const std::string& sink_id); |
52 | 55 |
53 void UpdateIssue(const Issue& issue); | 56 void UpdateIssue(const Issue& issue); |
54 void ClearIssue(); | 57 void ClearIssue(); |
55 | 58 |
56 // Updates the maximum dialog height to allow the WebUI properly scale when | 59 // Updates the maximum dialog height to allow the WebUI properly scale when |
57 // the browser window changes. | 60 // the browser window changes. |
58 void UpdateMaxDialogHeight(int height); | 61 void UpdateMaxDialogHeight(int height); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 base::Optional<MediaStatus> current_media_status_; | 159 base::Optional<MediaStatus> current_media_status_; |
157 | 160 |
158 MediaRouterUI* media_router_ui_; | 161 MediaRouterUI* media_router_ui_; |
159 | 162 |
160 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 163 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
161 }; | 164 }; |
162 | 165 |
163 } // namespace media_router | 166 } // namespace media_router |
164 | 167 |
165 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ | 168 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ |
OLD | NEW |