Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chrome/browser/ui/webui/media_router/media_router_webui_message_handler.h

Issue 1139203003: [Media Router] MediaRouterUI + WebUI handler implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile' Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.
Wez 2015/05/21 22:58:37 nit: Clarify _why_ |issue| may be nullptr.
imcheng (use chromium acct) 2015/05/22 00:02:01 Done.
39 void UpdateIssue(const Issue* issue);
40
41 private:
25 // WebUIMessageHandler implementation. 42 // WebUIMessageHandler implementation.
26 void RegisterMessages() override; 43 void RegisterMessages() override;
27 44
28 private:
29 // Handlers for JavaScript messages. 45 // Handlers for JavaScript messages.
30 void OnGetInitialSettings(const base::ListValue* args); 46 void OnGetInitialSettings(const base::ListValue* args);
31 void OnCreateRoute(const base::ListValue* args); 47 void OnCreateRoute(const base::ListValue* args);
32 void OnActOnIssue(const base::ListValue* args); 48 void OnActOnIssue(const base::ListValue* args);
33 void OnCloseRoute(const base::ListValue* args); 49 void OnCloseRoute(const base::ListValue* args);
34 void OnCloseDialog(const base::ListValue* args); 50 void OnCloseDialog(const base::ListValue* args);
35 51
36 // Helper function for getting a pointer to the corresponding MediaRouterUI. 52 // Helper function for getting a pointer to the corresponding MediaRouterUI.
37 MediaRouterUI* GetMediaRouterUI() const; 53 MediaRouterUI* GetMediaRouterUI() const;
38 54
39 // Keeps track of whether a command to close the dialog has been issued. 55 // Keeps track of whether a command to close the dialog has been issued.
40 bool dialog_closing_; 56 bool dialog_closing_;
41 57
42 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); 58 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler);
43 }; 59 };
44 60
45 } // namespace media_router 61 } // namespace media_router
46 62
47 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ 63 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698