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> | |
| 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 |
| 25 // WebUIMessageHandler implementation. | 31 // WebUIMessageHandler implementation. |
| 26 void RegisterMessages() override; | 32 void RegisterMessages() override; |
| 27 | 33 |
| 34 // Updates the list of sinks in the dialog. | |
|
Wez
2015/05/20 17:51:47
None of these comments actually add anything; they
imcheng (use chromium acct)
2015/05/20 22:01:14
Done.
| |
| 35 void UpdateSinks(const std::vector<MediaSinkWithCastModes>& sinks); | |
| 36 | |
| 37 // Updates the list of routes in the dialog. | |
| 38 void UpdateRoutes(const std::vector<MediaRoute>& routes); | |
| 39 | |
| 40 // Updates the cast modes in the dialog. | |
| 41 void UpdateCastModes(const CastModeSet& cast_modes, | |
| 42 const std::string& source_host); | |
| 43 | |
| 44 // Adds a new route to the dialog. | |
| 45 void AddRoute(const MediaRoute& route); | |
| 46 | |
| 47 // Updates the issue to show in the dialog. | |
| 48 void UpdateIssue(const Issue* issue); | |
|
Wez
2015/05/20 17:51:47
Why const Issue* rather than const Issue& ?
imcheng (use chromium acct)
2015/05/20 22:01:14
nullptr is used to indicate there are no more issu
| |
| 49 | |
| 28 private: | 50 private: |
| 29 // Handlers for JavaScript messages. | 51 // Handlers for JavaScript messages. |
| 30 void OnGetInitialSettings(const base::ListValue* args); | 52 void OnGetInitialSettings(const base::ListValue* args); |
| 31 void OnCreateRoute(const base::ListValue* args); | 53 void OnCreateRoute(const base::ListValue* args); |
| 32 void OnActOnIssue(const base::ListValue* args); | 54 void OnActOnIssue(const base::ListValue* args); |
| 33 void OnCloseRoute(const base::ListValue* args); | 55 void OnCloseRoute(const base::ListValue* args); |
| 34 void OnCloseDialog(const base::ListValue* args); | 56 void OnCloseDialog(const base::ListValue* args); |
| 35 | 57 |
| 36 // Helper function for getting a pointer to the corresponding MediaRouterUI. | 58 // Helper function for getting a pointer to the corresponding MediaRouterUI. |
| 37 MediaRouterUI* GetMediaRouterUI() const; | 59 MediaRouterUI* GetMediaRouterUI() const; |
| 38 | 60 |
| 39 // Keeps track of whether a command to close the dialog has been issued. | 61 // Keeps track of whether a command to close the dialog has been issued. |
| 40 bool dialog_closing_; | 62 bool dialog_closing_; |
| 41 | 63 |
| 42 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 64 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
| 43 }; | 65 }; |
| 44 | 66 |
| 45 } // namespace media_router | 67 } // namespace media_router |
| 46 | 68 |
| 47 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ | 69 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ |
| OLD | NEW |