| 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> | |
| 9 | |
| 10 #include "base/macros.h" | 8 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" | |
| 12 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" | |
| 13 #include "content/public/browser/web_ui_message_handler.h" | 9 #include "content/public/browser/web_ui_message_handler.h" |
| 14 | 10 |
| 15 namespace base { | 11 namespace base { |
| 16 class ListValue; | 12 class ListValue; |
| 17 } // namespace base | 13 } // namespace base |
| 18 | 14 |
| 19 namespace media_router { | 15 namespace media_router { |
| 20 | 16 |
| 21 class Issue; | |
| 22 class MediaRoute; | |
| 23 class MediaRouterUI; | 17 class MediaRouterUI; |
| 24 | 18 |
| 25 // The handler for Javascript messages related to the media router dialog. | 19 // The handler for Javascript messages related to the media router dialog. |
| 26 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { | 20 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { |
| 27 public: | 21 public: |
| 28 MediaRouterWebUIMessageHandler(); | 22 MediaRouterWebUIMessageHandler(); |
| 29 ~MediaRouterWebUIMessageHandler() override; | 23 ~MediaRouterWebUIMessageHandler() override; |
| 30 | 24 |
| 31 // Methods to update the status displayed by the dialog. | |
| 32 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); | |
| 33 void UpdateRoutes(const std::vector<MediaRoute>& routes); | |
| 34 void UpdateCastModes(const CastModeSet& cast_modes, | |
| 35 const std::string& source_host); | |
| 36 void AddRoute(const MediaRoute& route); | |
| 37 | |
| 38 // Does not take ownership of |issue|. Note that |issue| can be nullptr, when | |
| 39 // there are no more issues. | |
| 40 void UpdateIssue(const Issue* issue); | |
| 41 | |
| 42 private: | |
| 43 // WebUIMessageHandler implementation. | 25 // WebUIMessageHandler implementation. |
| 44 void RegisterMessages() override; | 26 void RegisterMessages() override; |
| 45 | 27 |
| 28 private: |
| 46 // Handlers for JavaScript messages. | 29 // Handlers for JavaScript messages. |
| 47 void OnGetInitialSettings(const base::ListValue* args); | 30 void OnGetInitialSettings(const base::ListValue* args); |
| 48 void OnCreateRoute(const base::ListValue* args); | 31 void OnCreateRoute(const base::ListValue* args); |
| 49 void OnActOnIssue(const base::ListValue* args); | 32 void OnActOnIssue(const base::ListValue* args); |
| 50 void OnCloseRoute(const base::ListValue* args); | 33 void OnCloseRoute(const base::ListValue* args); |
| 51 void OnCloseDialog(const base::ListValue* args); | 34 void OnCloseDialog(const base::ListValue* args); |
| 52 | 35 |
| 53 // Helper function for getting a pointer to the corresponding MediaRouterUI. | 36 // Helper function for getting a pointer to the corresponding MediaRouterUI. |
| 54 MediaRouterUI* GetMediaRouterUI() const; | 37 MediaRouterUI* GetMediaRouterUI() const; |
| 55 | 38 |
| 56 // Keeps track of whether a command to close the dialog has been issued. | 39 // Keeps track of whether a command to close the dialog has been issued. |
| 57 bool dialog_closing_; | 40 bool dialog_closing_; |
| 58 | 41 |
| 59 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 42 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
| 60 }; | 43 }; |
| 61 | 44 |
| 62 } // namespace media_router | 45 } // namespace media_router |
| 63 | 46 |
| 64 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ | 47 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ |
| OLD | NEW |