| 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 |
| 8 #include "base/macros.h" | 10 #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" |
| 9 #include "content/public/browser/web_ui_message_handler.h" | 13 #include "content/public/browser/web_ui_message_handler.h" |
| 10 | 14 |
| 11 namespace base { | 15 namespace base { |
| 12 class ListValue; | 16 class ListValue; |
| 13 } // namespace base | 17 } // namespace base |
| 14 | 18 |
| 15 namespace media_router { | 19 namespace media_router { |
| 16 | 20 |
| 21 class Issue; |
| 22 class MediaRoute; |
| 17 class MediaRouterUI; | 23 class MediaRouterUI; |
| 18 | 24 |
| 19 // The handler for Javascript messages related to the media router dialog. | 25 // The handler for Javascript messages related to the media router dialog. |
| 20 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { | 26 class MediaRouterWebUIMessageHandler : public content::WebUIMessageHandler { |
| 21 public: | 27 public: |
| 22 MediaRouterWebUIMessageHandler(); | 28 MediaRouterWebUIMessageHandler(); |
| 23 ~MediaRouterWebUIMessageHandler() override; | 29 ~MediaRouterWebUIMessageHandler() override; |
| 24 | 30 |
| 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: |
| 25 // WebUIMessageHandler implementation. | 43 // WebUIMessageHandler implementation. |
| 26 void RegisterMessages() override; | 44 void RegisterMessages() override; |
| 27 | 45 |
| 28 private: | |
| 29 // Handlers for JavaScript messages. | 46 // Handlers for JavaScript messages. |
| 30 void OnGetInitialSettings(const base::ListValue* args); | 47 void OnGetInitialSettings(const base::ListValue* args); |
| 31 void OnCreateRoute(const base::ListValue* args); | 48 void OnCreateRoute(const base::ListValue* args); |
| 32 void OnActOnIssue(const base::ListValue* args); | 49 void OnActOnIssue(const base::ListValue* args); |
| 33 void OnCloseRoute(const base::ListValue* args); | 50 void OnCloseRoute(const base::ListValue* args); |
| 34 void OnCloseDialog(const base::ListValue* args); | 51 void OnCloseDialog(const base::ListValue* args); |
| 35 | 52 |
| 36 // Helper function for getting a pointer to the corresponding MediaRouterUI. | 53 // Helper function for getting a pointer to the corresponding MediaRouterUI. |
| 37 MediaRouterUI* GetMediaRouterUI() const; | 54 MediaRouterUI* GetMediaRouterUI() const; |
| 38 | 55 |
| 39 // Keeps track of whether a command to close the dialog has been issued. | 56 // Keeps track of whether a command to close the dialog has been issued. |
| 40 bool dialog_closing_; | 57 bool dialog_closing_; |
| 41 | 58 |
| 42 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 59 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
| 43 }; | 60 }; |
| 44 | 61 |
| 45 } // namespace media_router | 62 } // namespace media_router |
| 46 | 63 |
| 47 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ | 64 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ |
| OLD | NEW |