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

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

Issue 2862513002: Revert of [Media Router] Custom Controls 3 - add plumbing through MRUI and MRWebUIMessageHandler (Closed)
Patch Set: Created 3 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 <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"
16 #include "components/signin/core/browser/account_info.h" 15 #include "components/signin/core/browser/account_info.h"
17 #include "content/public/browser/web_ui_message_handler.h" 16 #include "content/public/browser/web_ui_message_handler.h"
18 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
19 18
20 namespace base { 19 namespace base {
21 class DictionaryValue; 20 class DictionaryValue;
22 class ListValue; 21 class ListValue;
23 } // namespace base 22 } // namespace base
24 23
25 namespace content { 24 namespace content {
(...skipping 24 matching lines...) Expand all
50 const MediaRoute* route); 49 const MediaRoute* route);
51 void ReturnSearchResult(const std::string& sink_id); 50 void ReturnSearchResult(const std::string& sink_id);
52 51
53 void UpdateIssue(const Issue& issue); 52 void UpdateIssue(const Issue& issue);
54 void ClearIssue(); 53 void ClearIssue();
55 54
56 // Updates the maximum dialog height to allow the WebUI properly scale when 55 // Updates the maximum dialog height to allow the WebUI properly scale when
57 // the browser window changes. 56 // the browser window changes.
58 void UpdateMaxDialogHeight(int height); 57 void UpdateMaxDialogHeight(int height);
59 58
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
67 void SetWebUIForTest(content::WebUI* webui); 59 void SetWebUIForTest(content::WebUI* webui);
68 void set_incognito_for_test(bool incognito) { incognito_ = incognito; } 60 void set_incognito_for_test(bool incognito) { incognito_ = incognito; }
69 61
70 private: 62 private:
71 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, 63 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
72 RecordCastModeSelection); 64 RecordCastModeSelection);
73 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, 65 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
74 RetrieveCastModeSelection); 66 RetrieveCastModeSelection);
75 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
76 OnRouteDetailsOpenedAndClosed);
77 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
78 OnMediaCommandsReceived);
79 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest,
80 OnInvalidMediaCommandsReceived);
81 67
82 // WebUIMessageHandler implementation. 68 // WebUIMessageHandler implementation.
83 void RegisterMessages() override; 69 void RegisterMessages() override;
84 70
85 // Handlers for JavaScript messages. 71 // Handlers for JavaScript messages.
86 // See media_router_ui_interface.js for documentation on parameters. 72 // See media_router_ui_interface.js for documentation on parameters.
87 void OnRequestInitialData(const base::ListValue* args); 73 void OnRequestInitialData(const base::ListValue* args);
88 void OnCreateRoute(const base::ListValue* args); 74 void OnCreateRoute(const base::ListValue* args);
89 void OnAcknowledgeFirstRunFlow(const base::ListValue* args); 75 void OnAcknowledgeFirstRunFlow(const base::ListValue* args);
90 void OnActOnIssue(const base::ListValue* args); 76 void OnActOnIssue(const base::ListValue* args);
91 void OnCloseRoute(const base::ListValue* args); 77 void OnCloseRoute(const base::ListValue* args);
92 void OnJoinRoute(const base::ListValue* args); 78 void OnJoinRoute(const base::ListValue* args);
93 void OnCloseDialog(const base::ListValue* args); 79 void OnCloseDialog(const base::ListValue* args);
94 void OnReportBlur(const base::ListValue* args); 80 void OnReportBlur(const base::ListValue* args);
95 void OnReportClickedSinkIndex(const base::ListValue* args); 81 void OnReportClickedSinkIndex(const base::ListValue* args);
96 void OnReportFilter(const base::ListValue* args); 82 void OnReportFilter(const base::ListValue* args);
97 void OnReportInitialAction(const base::ListValue* args); 83 void OnReportInitialAction(const base::ListValue* args);
98 void OnReportInitialState(const base::ListValue* args); 84 void OnReportInitialState(const base::ListValue* args);
99 void OnReportNavigateToView(const base::ListValue* args); 85 void OnReportNavigateToView(const base::ListValue* args);
100 void OnReportRouteCreation(const base::ListValue* args); 86 void OnReportRouteCreation(const base::ListValue* args);
101 void OnReportRouteCreationOutcome(const base::ListValue* args); 87 void OnReportRouteCreationOutcome(const base::ListValue* args);
102 void OnReportSelectedCastMode(const base::ListValue* args); 88 void OnReportSelectedCastMode(const base::ListValue* args);
103 void OnReportSinkCount(const base::ListValue* args); 89 void OnReportSinkCount(const base::ListValue* args);
104 void OnReportTimeToClickSink(const base::ListValue* args); 90 void OnReportTimeToClickSink(const base::ListValue* args);
105 void OnReportTimeToInitialActionClose(const base::ListValue* args); 91 void OnReportTimeToInitialActionClose(const base::ListValue* args);
106 void OnMediaControllerAvailable(const base::ListValue* args);
107 void OnMediaControllerClosed(const base::ListValue* args);
108 void OnSearchSinksAndCreateRoute(const base::ListValue* args); 92 void OnSearchSinksAndCreateRoute(const base::ListValue* args);
109 void OnInitialDataReceived(const base::ListValue* args); 93 void OnInitialDataReceived(const base::ListValue* args);
110 94
111 // Handlers for JavaScript messages to control the media.
112 void OnPlayCurrentMedia(const base::ListValue* args);
113 void OnPauseCurrentMedia(const base::ListValue* args);
114 void OnSeekCurrentMedia(const base::ListValue* args);
115 void OnSetCurrentMediaMute(const base::ListValue* args);
116 void OnSetCurrentMediaVolume(const base::ListValue* args);
117
118 // Performs an action for an Issue of |type|. 95 // Performs an action for an Issue of |type|.
119 // |args| contains additional parameter that varies based on |type|. 96 // |args| contains additional parameter that varies based on |type|.
120 // Returns |true| if the action was successfully performed. 97 // Returns |true| if the action was successfully performed.
121 bool ActOnIssueType(IssueInfo::Action type, 98 bool ActOnIssueType(IssueInfo::Action type,
122 const base::DictionaryValue* args); 99 const base::DictionaryValue* args);
123 100
124 // May update the first run flow related properties in the WebUI. This is 101 // May update the first run flow related properties in the WebUI. This is
125 // called after the initial data is received to avoid unnecessary work when 102 // called after the initial data is received to avoid unnecessary work when
126 // initializing the WebUI. 103 // initializing the WebUI.
127 void MaybeUpdateFirstRunFlowData(); 104 void MaybeUpdateFirstRunFlowData();
(...skipping 17 matching lines...) Expand all
145 // used when updating sinks to determine if identity should be displayed. 122 // used when updating sinks to determine if identity should be displayed.
146 // Marked virtual for tests. 123 // Marked virtual for tests.
147 virtual AccountInfo GetAccountInfo(); 124 virtual AccountInfo GetAccountInfo();
148 125
149 // |true| if the associated Profile is incognito. 126 // |true| if the associated Profile is incognito.
150 bool incognito_; 127 bool incognito_;
151 128
152 // Keeps track of whether a command to close the dialog has been issued. 129 // Keeps track of whether a command to close the dialog has been issued.
153 bool dialog_closing_; 130 bool dialog_closing_;
154 131
155 // The media status currently shown in the UI.
156 base::Optional<MediaStatus> current_media_status_;
157
158 MediaRouterUI* media_router_ui_; 132 MediaRouterUI* media_router_ui_;
159 133
160 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); 134 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler);
161 }; 135 };
162 136
163 } // namespace media_router 137 } // namespace media_router
164 138
165 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_ 139 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698