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> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chrome/browser/media/router/issue.h" | 11 #include "chrome/browser/media/router/issue.h" |
| 12 #include "chrome/browser/media/router/media_status.h" |
12 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" | 13 #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" | 14 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" |
14 #include "components/signin/core/browser/account_info.h" | 15 #include "components/signin/core/browser/account_info.h" |
15 #include "content/public/browser/web_ui_message_handler.h" | 16 #include "content/public/browser/web_ui_message_handler.h" |
16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class DictionaryValue; | 20 class DictionaryValue; |
20 class ListValue; | 21 class ListValue; |
21 } // namespace base | 22 } // namespace base |
(...skipping 26 matching lines...) Expand all Loading... |
48 const MediaRoute* route); | 49 const MediaRoute* route); |
49 void ReturnSearchResult(const std::string& sink_id); | 50 void ReturnSearchResult(const std::string& sink_id); |
50 | 51 |
51 void UpdateIssue(const Issue& issue); | 52 void UpdateIssue(const Issue& issue); |
52 void ClearIssue(); | 53 void ClearIssue(); |
53 | 54 |
54 // 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 |
55 // the browser window changes. | 56 // the browser window changes. |
56 void UpdateMaxDialogHeight(int height); | 57 void UpdateMaxDialogHeight(int height); |
57 | 58 |
| 59 // Notifies the WebUI with an updated MediaStatus. |
| 60 void UpdateMediaRouteStatus(const MediaStatus& status); |
| 61 |
58 void SetWebUIForTest(content::WebUI* webui); | 62 void SetWebUIForTest(content::WebUI* webui); |
59 void set_incognito_for_test(bool incognito) { incognito_ = incognito; } | 63 void set_incognito_for_test(bool incognito) { incognito_ = incognito; } |
60 | 64 |
61 private: | 65 private: |
62 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, | 66 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, |
63 RecordCastModeSelection); | 67 RecordCastModeSelection); |
64 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, | 68 FRIEND_TEST_ALL_PREFIXES(MediaRouterWebUIMessageHandlerTest, |
65 RetrieveCastModeSelection); | 69 RetrieveCastModeSelection); |
66 | 70 |
67 // WebUIMessageHandler implementation. | 71 // WebUIMessageHandler implementation. |
(...skipping 13 matching lines...) Expand all Loading... |
81 void OnReportFilter(const base::ListValue* args); | 85 void OnReportFilter(const base::ListValue* args); |
82 void OnReportInitialAction(const base::ListValue* args); | 86 void OnReportInitialAction(const base::ListValue* args); |
83 void OnReportInitialState(const base::ListValue* args); | 87 void OnReportInitialState(const base::ListValue* args); |
84 void OnReportNavigateToView(const base::ListValue* args); | 88 void OnReportNavigateToView(const base::ListValue* args); |
85 void OnReportRouteCreation(const base::ListValue* args); | 89 void OnReportRouteCreation(const base::ListValue* args); |
86 void OnReportRouteCreationOutcome(const base::ListValue* args); | 90 void OnReportRouteCreationOutcome(const base::ListValue* args); |
87 void OnReportSelectedCastMode(const base::ListValue* args); | 91 void OnReportSelectedCastMode(const base::ListValue* args); |
88 void OnReportSinkCount(const base::ListValue* args); | 92 void OnReportSinkCount(const base::ListValue* args); |
89 void OnReportTimeToClickSink(const base::ListValue* args); | 93 void OnReportTimeToClickSink(const base::ListValue* args); |
90 void OnReportTimeToInitialActionClose(const base::ListValue* args); | 94 void OnReportTimeToInitialActionClose(const base::ListValue* args); |
| 95 void OnRouteDetailsClosed(const base::ListValue* args); |
| 96 void OnRouteDetailsOpened(const base::ListValue* args); |
91 void OnSearchSinksAndCreateRoute(const base::ListValue* args); | 97 void OnSearchSinksAndCreateRoute(const base::ListValue* args); |
92 void OnInitialDataReceived(const base::ListValue* args); | 98 void OnInitialDataReceived(const base::ListValue* args); |
93 | 99 |
| 100 // Handlers for JavaScript messages to control media routes. |
| 101 void OnPlayRoute(const base::ListValue* args); |
| 102 void OnPauseRoute(const base::ListValue* args); |
| 103 void OnSeekRoute(const base::ListValue* args); |
| 104 void OnSetRouteMute(const base::ListValue* args); |
| 105 void OnSetRouteVolume(const base::ListValue* args); |
| 106 |
94 // Performs an action for an Issue of |type|. | 107 // Performs an action for an Issue of |type|. |
95 // |args| contains additional parameter that varies based on |type|. | 108 // |args| contains additional parameter that varies based on |type|. |
96 // Returns |true| if the action was successfully performed. | 109 // Returns |true| if the action was successfully performed. |
97 bool ActOnIssueType(IssueInfo::Action type, | 110 bool ActOnIssueType(IssueInfo::Action type, |
98 const base::DictionaryValue* args); | 111 const base::DictionaryValue* args); |
99 | 112 |
100 // May update the first run flow related properties in the WebUI. This is | 113 // May update the first run flow related properties in the WebUI. This is |
101 // called after the initial data is received to avoid unnecessary work when | 114 // called after the initial data is received to avoid unnecessary work when |
102 // initializing the WebUI. | 115 // initializing the WebUI. |
103 void MaybeUpdateFirstRunFlowData(); | 116 void MaybeUpdateFirstRunFlowData(); |
(...skipping 25 matching lines...) Expand all Loading... |
129 bool dialog_closing_; | 142 bool dialog_closing_; |
130 | 143 |
131 MediaRouterUI* media_router_ui_; | 144 MediaRouterUI* media_router_ui_; |
132 | 145 |
133 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); | 146 DISALLOW_COPY_AND_ASSIGN(MediaRouterWebUIMessageHandler); |
134 }; | 147 }; |
135 | 148 |
136 } // namespace media_router | 149 } // namespace media_router |
137 | 150 |
138 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ | 151 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_WEBUI_MESSAGE_HANDL
ER_H_ |
OLD | NEW |