| 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 20 matching lines...) Expand all Loading... |
| 31 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui); | 31 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui); |
| 32 ~MediaRouterWebUIMessageHandler() override; | 32 ~MediaRouterWebUIMessageHandler() override; |
| 33 | 33 |
| 34 // Methods to update the status displayed by the dialog. | 34 // Methods to update the status displayed by the dialog. |
| 35 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); | 35 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); |
| 36 void UpdateRoutes(const std::vector<MediaRoute>& routes, | 36 void UpdateRoutes(const std::vector<MediaRoute>& routes, |
| 37 const std::vector<MediaRoute::Id>& joinable_route_ids); | 37 const std::vector<MediaRoute::Id>& joinable_route_ids); |
| 38 void UpdateCastModes(const CastModeSet& cast_modes, | 38 void UpdateCastModes(const CastModeSet& cast_modes, |
| 39 const std::string& source_host); | 39 const std::string& source_host); |
| 40 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id, | 40 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id, |
| 41 const MediaRoute* route); | 41 const MediaRoute::Id& route_id); |
| 42 | 42 |
| 43 // Does not take ownership of |issue|. Note that |issue| can be nullptr, when | 43 // Does not take ownership of |issue|. Note that |issue| can be nullptr, when |
| 44 // there are no more issues. | 44 // there are no more issues. |
| 45 void UpdateIssue(const Issue* issue); | 45 void UpdateIssue(const Issue* issue); |
| 46 | 46 |
| 47 // Updates the maximum dialog height to allow the WebUI properly scale when | 47 // Updates the maximum dialog height to allow the WebUI properly scale when |
| 48 // the browser window changes. | 48 // the browser window changes. |
| 49 void UpdateMaxDialogHeight(int height); | 49 void UpdateMaxDialogHeight(int height); |
| 50 | 50 |
| 51 // Notifies the dialog that the route creation attempt timed out. | 51 // Notifies the dialog that the route creation attempt timed out. |
| 52 void NotifyRouteCreationTimeout(); | 52 void NotifyRouteCreationTimeout(); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 // WebUIMessageHandler implementation. | 55 // WebUIMessageHandler implementation. |
| 56 void RegisterMessages() override; | 56 void RegisterMessages() override; |
| 57 | 57 |
| 58 // Handlers for JavaScript messages. | 58 // Handlers for JavaScript messages. |
| 59 // See media_router_ui_interface.js for documentation on parameters. | 59 // See media_router_ui_interface.js for documentation on parameters. |
| 60 void OnRequestInitialData(const base::ListValue* args); | 60 void OnRequestInitialData(const base::ListValue* args); |
| 61 void OnCreateRoute(const base::ListValue* args); | 61 void OnCreateRoute(const base::ListValue* args); |
| 62 void OnAcknowledgeFirstRunFlow(const base::ListValue* args); | 62 void OnAcknowledgeFirstRunFlow(const base::ListValue* args); |
| 63 void OnActOnIssue(const base::ListValue* args); | 63 void OnActOnIssue(const base::ListValue* args); |
| 64 void OnCloseRoute(const base::ListValue* args); | 64 void OnCloseRoute(const base::ListValue* args); |
| 65 void OnJoinRoute(const base::ListValue* args); | 65 void OnJoinRoute(const base::ListValue* args); |
| 66 void OnCloseDialog(const base::ListValue* args); | 66 void OnCloseDialog(const base::ListValue* args); |
| 67 void OnReportClickedSinkIndex(const base::ListValue* args); | 67 void OnReportClickedSinkIndex(const base::ListValue* args); |
| 68 void OnReportInitialAction(const base::ListValue* args); | 68 void OnReportInitialAction(const base::ListValue* args); |
| 69 void OnReportInitialState(const base::ListValue* args); | 69 void OnReportInitialState(const base::ListValue* args); |
| 70 void OnReportNavigateToView(const base::ListValue* args); | 70 void OnReportNavigateToView(const base::ListValue* args); |
| 71 void OnReportRouteCreation(const base::ListValue* args); |
| 71 void OnReportSelectedCastMode(const base::ListValue* args); | 72 void OnReportSelectedCastMode(const base::ListValue* args); |
| 72 void OnReportSinkCount(const base::ListValue* args); | 73 void OnReportSinkCount(const base::ListValue* args); |
| 73 void OnReportTimeToClickSink(const base::ListValue* args); | 74 void OnReportTimeToClickSink(const base::ListValue* args); |
| 74 void OnReportTimeToInitialActionClose(const base::ListValue* args); | 75 void OnReportTimeToInitialActionClose(const base::ListValue* args); |
| 75 void OnInitialDataReceived(const base::ListValue* args); | 76 void OnInitialDataReceived(const base::ListValue* args); |
| 76 | 77 |
| 77 // Performs an action for an Issue of |type|. | 78 // Performs an action for an Issue of |type|. |
| 78 // |args| contains additional parameter that varies based on |type|. | 79 // |args| contains additional parameter that varies based on |type|. |
| 79 // Returns |true| if the action was successfully performed. | 80 // Returns |true| if the action was successfully performed. |
| 80 bool ActOnIssueType(const IssueAction::Type& type, | 81 bool ActOnIssueType(const IssueAction::Type& type, |
| 81 const base::DictionaryValue* args); | 82 const base::DictionaryValue* args); |
| 82 | 83 |
| 83 // Keeps track of whether a command to close the dialog has been issued. | 84 // Keeps track of whether a command to close the dialog has been issued. |
| 84 bool dialog_closing_; | 85 bool dialog_closing_; |
| 85 | 86 |
| 86 MediaRouterUI* media_router_ui_; | 87 MediaRouterUI* media_router_ui_; |
| 87 | 88 |
| 88 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 89 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 } // namespace media_router | 92 } // namespace media_router |
| 92 | 93 |
| 93 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ | 94 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ |
| OLD | NEW |