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

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

Issue 2731033002: [Media Router] Custom Controls 3 - add plumbing through MRUI and MRWebUIMessageHandler (Closed)
Patch Set: Address Derek's comments Created 3 years, 8 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 <unordered_map> 8 #include <unordered_map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" 12 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h"
13 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" 13 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h"
14 #include "chrome/common/media_router/issue.h" 14 #include "chrome/common/media_router/issue.h"
15 #include "chrome/common/media_router/media_status.h"
15 #include "components/signin/core/browser/account_info.h" 16 #include "components/signin/core/browser/account_info.h"
16 #include "content/public/browser/web_ui_message_handler.h" 17 #include "content/public/browser/web_ui_message_handler.h"
17 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
18 19
19 namespace base { 20 namespace base {
20 class DictionaryValue; 21 class DictionaryValue;
21 class ListValue; 22 class ListValue;
22 } // namespace base 23 } // namespace base
23 24
24 namespace content { 25 namespace content {
(...skipping 24 matching lines...) Expand all
49 const MediaRoute* route); 50 const MediaRoute* route);
50 void ReturnSearchResult(const std::string& sink_id); 51 void ReturnSearchResult(const std::string& sink_id);
51 52
52 void UpdateIssue(const Issue& issue); 53 void UpdateIssue(const Issue& issue);
53 void ClearIssue(); 54 void ClearIssue();
54 55
55 // Updates the maximum dialog height to allow the WebUI properly scale when 56 // Updates the maximum dialog height to allow the WebUI properly scale when
56 // the browser window changes. 57 // the browser window changes.
57 void UpdateMaxDialogHeight(int height); 58 void UpdateMaxDialogHeight(int height);
58 59
60 // Notifies the WebUI with an updated MediaStatus. Overridden in tests.
61 virtual void UpdateMediaRouteStatus(const MediaStatus& status);
62
63 // Notifies the WebUI that the controller for the selected route has been
64 // invalidated.
65 void OnRouteControllerInvalidated();
66
59 void SetWebUIForTest(content::WebUI* webui); 67 void SetWebUIForTest(content::WebUI* webui);
60 void set_incognito_for_test(bool incognito) { incognito_ = incognito; } 68 void set_incognito_for_test(bool incognito) { incognito_ = incognito; }
61 69
62 private: 70 private:
63 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, 71 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
64 RecordCastModeSelection); 72 RecordCastModeSelection);
65 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, 73 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
66 RetrieveCastModeSelection); 74 RetrieveCastModeSelection);
75 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
76 OnRouteDetailsOpenedAndClosed);
77 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
78 OnMediaCommandsReceived);
67 79
68 // WebUIMessageHandler implementation. 80 // WebUIMessageHandler implementation.
69 void RegisterMessages() override; 81 void RegisterMessages() override;
70 82
71 // Handlers for JavaScript messages. 83 // Handlers for JavaScript messages.
72 // See media_router_ui_interface.js for documentation on parameters. 84 // See media_router_ui_interface.js for documentation on parameters.
73 void OnRequestInitialData(const base::ListValue* args); 85 void OnRequestInitialData(const base::ListValue* args);
74 void OnCreateRoute(const base::ListValue* args); 86 void OnCreateRoute(const base::ListValue* args);
75 void OnAcknowledgeFirstRunFlow(const base::ListValue* args); 87 void OnAcknowledgeFirstRunFlow(const base::ListValue* args);
76 void OnActOnIssue(const base::ListValue* args); 88 void OnActOnIssue(const base::ListValue* args);
77 void OnCloseRoute(const base::ListValue* args); 89 void OnCloseRoute(const base::ListValue* args);
78 void OnJoinRoute(const base::ListValue* args); 90 void OnJoinRoute(const base::ListValue* args);
79 void OnCloseDialog(const base::ListValue* args); 91 void OnCloseDialog(const base::ListValue* args);
80 void OnReportBlur(const base::ListValue* args); 92 void OnReportBlur(const base::ListValue* args);
81 void OnReportClickedSinkIndex(const base::ListValue* args); 93 void OnReportClickedSinkIndex(const base::ListValue* args);
82 void OnReportFilter(const base::ListValue* args); 94 void OnReportFilter(const base::ListValue* args);
83 void OnReportInitialAction(const base::ListValue* args); 95 void OnReportInitialAction(const base::ListValue* args);
84 void OnReportInitialState(const base::ListValue* args); 96 void OnReportInitialState(const base::ListValue* args);
85 void OnReportNavigateToView(const base::ListValue* args); 97 void OnReportNavigateToView(const base::ListValue* args);
86 void OnReportRouteCreation(const base::ListValue* args); 98 void OnReportRouteCreation(const base::ListValue* args);
87 void OnReportRouteCreationOutcome(const base::ListValue* args); 99 void OnReportRouteCreationOutcome(const base::ListValue* args);
88 void OnReportSelectedCastMode(const base::ListValue* args); 100 void OnReportSelectedCastMode(const base::ListValue* args);
89 void OnReportSinkCount(const base::ListValue* args); 101 void OnReportSinkCount(const base::ListValue* args);
90 void OnReportTimeToClickSink(const base::ListValue* args); 102 void OnReportTimeToClickSink(const base::ListValue* args);
91 void OnReportTimeToInitialActionClose(const base::ListValue* args); 103 void OnReportTimeToInitialActionClose(const base::ListValue* args);
104 void OnRouteDetailsClosed(const base::ListValue* args);
105 void OnRouteDetailsOpened(const base::ListValue* args);
92 void OnSearchSinksAndCreateRoute(const base::ListValue* args); 106 void OnSearchSinksAndCreateRoute(const base::ListValue* args);
93 void OnInitialDataReceived(const base::ListValue* args); 107 void OnInitialDataReceived(const base::ListValue* args);
94 108
109 // Handlers for JavaScript messages to control media routes.
110 void OnPlayRoute(const base::ListValue* args);
111 void OnPauseRoute(const base::ListValue* args);
112 void OnSeekRoute(const base::ListValue* args);
113 void OnSetRouteMute(const base::ListValue* args);
114 void OnSetRouteVolume(const base::ListValue* args);
115
95 // Performs an action for an Issue of |type|. 116 // Performs an action for an Issue of |type|.
96 // |args| contains additional parameter that varies based on |type|. 117 // |args| contains additional parameter that varies based on |type|.
97 // Returns |true| if the action was successfully performed. 118 // Returns |true| if the action was successfully performed.
98 bool ActOnIssueType(IssueInfo::Action type, 119 bool ActOnIssueType(IssueInfo::Action type,
99 const base::DictionaryValue* args); 120 const base::DictionaryValue* args);
100 121
101 // May update the first run flow related properties in the WebUI. This is 122 // May update the first run flow related properties in the WebUI. This is
102 // called after the initial data is received to avoid unnecessary work when 123 // called after the initial data is received to avoid unnecessary work when
103 // initializing the WebUI. 124 // initializing the WebUI.
104 void MaybeUpdateFirstRunFlowData(); 125 void MaybeUpdateFirstRunFlowData();
(...skipping 25 matching lines...) Expand all
130 bool dialog_closing_; 151 bool dialog_closing_;
131 152
132 MediaRouterUI* media_router_ui_; 153 MediaRouterUI* media_router_ui_;
133 154
134 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); 155 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler);
135 }; 156 };
136 157
137 } // namespace media_router 158 } // namespace media_router
138 159
139 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ 160 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698