Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 class MediaRouterUI; | 25 class MediaRouterUI; |
| 26 | 26 |
| 27 // The handler for Javascript messages related to the media router dialog. | 27 // The handler for Javascript messages related to the media router dialog. |
| 28 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { | 28 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { |
| 29 public: | 29 public: |
| 30 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui); | 30 explicit MediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui); |
| 31 ~MediaRouterWebUIMessageHandler() override; | 31 ~MediaRouterWebUIMessageHandler() override; |
| 32 | 32 |
| 33 // Methods to update the status displayed by the dialog. | 33 // Methods to update the status displayed by the dialog. |
| 34 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); | 34 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); |
| 35 void UpdateRoutes(const std::vector<MediaRoute>& routes); | 35 void UpdateRoutes(const std::vector<MediaRoute>& routes, |
| 36 const std::vector<MediaRoute::Id>& joinable_route_ids); | |
|
apacible
2015/12/09 19:56:25
nit: align indent with the |routes| parameter in t
matt.boetger
2015/12/16 00:21:08
Done.
| |
| 36 void UpdateCastModes(const CastModeSet& cast_modes, | 37 void UpdateCastModes(const CastModeSet& cast_modes, |
| 37 const std::string& source_host); | 38 const std::string& source_host); |
| 38 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id, | 39 void OnCreateRouteResponseReceived(const MediaSink::Id& sink_id, |
| 39 const MediaRoute* route); | 40 const MediaRoute* route); |
| 40 | 41 |
| 41 // Does not take ownership of |issue|. Note that |issue| can be nullptr, when | 42 // Does not take ownership of |issue|. Note that |issue| can be nullptr, when |
| 42 // there are no more issues. | 43 // there are no more issues. |
| 43 void UpdateIssue(const Issue* issue); | 44 void UpdateIssue(const Issue* issue); |
| 44 | 45 |
| 45 // Notifies the dialog that the route creation attempt timed out. | 46 // Notifies the dialog that the route creation attempt timed out. |
| 46 void NotifyRouteCreationTimeout(); | 47 void NotifyRouteCreationTimeout(); |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 // WebUIMessageHandler implementation. | 50 // WebUIMessageHandler implementation. |
| 50 void RegisterMessages() override; | 51 void RegisterMessages() override; |
| 51 | 52 |
| 52 // Handlers for JavaScript messages. | 53 // Handlers for JavaScript messages. |
| 53 // In all cases, |args| consists of a single DictionaryValue containing the | 54 // In all cases, |args| consists of a single DictionaryValue containing the |
| 54 // actual parameters. | 55 // actual parameters. |
| 55 // See media_router_ui_interface.js for documentation on parameters. | 56 // See media_router_ui_interface.js for documentation on parameters. |
| 56 void OnRequestInitialData(const base::ListValue* args); | 57 void OnRequestInitialData(const base::ListValue* args); |
| 57 void OnCreateRoute(const base::ListValue* args); | 58 void OnCreateRoute(const base::ListValue* args); |
| 58 void OnActOnIssue(const base::ListValue* args); | 59 void OnActOnIssue(const base::ListValue* args); |
| 59 void OnCloseRoute(const base::ListValue* args); | 60 void OnCloseRoute(const base::ListValue* args); |
| 61 void OnJoinRoute(const base::ListValue* args); | |
| 60 void OnCloseDialog(const base::ListValue* args); | 62 void OnCloseDialog(const base::ListValue* args); |
| 61 void OnReportSinkCount(const base::ListValue* args); | 63 void OnReportSinkCount(const base::ListValue* args); |
| 62 | 64 |
| 63 // Performs an action for an Issue of |type|. | 65 // Performs an action for an Issue of |type|. |
| 64 // |args| contains additional parameter that varies based on |type|. | 66 // |args| contains additional parameter that varies based on |type|. |
| 65 // Returns |true| if the action was successfully performed. | 67 // Returns |true| if the action was successfully performed. |
| 66 bool ActOnIssueType(const IssueAction::Type& type, | 68 bool ActOnIssueType(const IssueAction::Type& type, |
| 67 const base::DictionaryValue* args); | 69 const base::DictionaryValue* args); |
| 68 | 70 |
| 69 // Keeps track of whether a command to close the dialog has been issued. | 71 // Keeps track of whether a command to close the dialog has been issued. |
| 70 bool dialog_closing_; | 72 bool dialog_closing_; |
| 71 | 73 |
| 72 MediaRouterUI* media_router_ui_; | 74 MediaRouterUI* media_router_ui_; |
| 73 | 75 |
| 74 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 76 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 } // namespace media_router | 79 } // namespace media_router |
| 78 | 80 |
| 79 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ | 81 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ |
| OLD | NEW |