| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 101 // Converts |routes| and |joinable_route_ids| into base::ListValue that can be | 103 // Converts |routes| and |joinable_route_ids| into base::ListValue that can be |
| 102 // passed to WebUI. | 104 // passed to WebUI. |
| 103 std::unique_ptr<base::ListValue> RoutesToValue( | 105 std::unique_ptr<base::ListValue> RoutesToValue( |
| 104 const std::vector<MediaRoute>& routes, | 106 const std::vector<MediaRoute>& routes, |
| 105 const std::vector<MediaRoute::Id>& joinable_route_ids) const; | 107 const std::vector<MediaRoute::Id>& joinable_route_ids, |
| 108 const std::unordered_map<MediaRoute::Id, MediaCastMode>& |
| 109 current_cast_modes) const; |
| 106 | 110 |
| 107 // Retrieve the account info for email and domain of signed in users. This is | 111 // 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. | 112 // used when updating sinks to determine if identity should be displayed. |
| 109 // Marked virtual for tests. | 113 // Marked virtual for tests. |
| 110 virtual AccountInfo GetAccountInfo(); | 114 virtual AccountInfo GetAccountInfo(); |
| 111 | 115 |
| 112 // |true| if the associated Profile is off the record. | 116 // |true| if the associated Profile is off the record. |
| 113 bool off_the_record_; | 117 bool off_the_record_; |
| 114 | 118 |
| 115 // Keeps track of whether a command to close the dialog has been issued. | 119 // Keeps track of whether a command to close the dialog has been issued. |
| 116 bool dialog_closing_; | 120 bool dialog_closing_; |
| 117 | 121 |
| 118 MediaRouterUI* media_router_ui_; | 122 MediaRouterUI* media_router_ui_; |
| 119 | 123 |
| 120 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 124 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
| 121 }; | 125 }; |
| 122 | 126 |
| 123 } // namespace media_router | 127 } // namespace media_router |
| 124 | 128 |
| 125 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ | 129 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ |
| OLD | NEW |