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

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

Issue 2549323002: [Media Router] Unit tests for sticky cast modes (Closed)
Patch Set: Rebase Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/media_router/media_router_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // ownership of it. Must not be null. 88 // ownership of it. Must not be null.
89 void InitWithPresentationSessionRequest( 89 void InitWithPresentationSessionRequest(
90 content::WebContents* initiator, 90 content::WebContents* initiator,
91 PresentationServiceDelegateImpl* delegate, 91 PresentationServiceDelegateImpl* delegate,
92 std::unique_ptr<CreatePresentationConnectionRequest> 92 std::unique_ptr<CreatePresentationConnectionRequest>
93 presentation_request); 93 presentation_request);
94 94
95 // Closes the media router UI. 95 // Closes the media router UI.
96 void Close(); 96 void Close();
97 97
98 // Notifies this instance that the UI has been initialized. 98 // Notifies this instance that the UI has been initialized. Marked virtual for
99 void UIInitialized(); 99 // tests.
100 virtual void UIInitialized();
100 101
101 // Requests a route be created from the source mapped to 102 // Requests a route be created from the source mapped to
102 // |cast_mode|, to the sink given by |sink_id|. 103 // |cast_mode|, to the sink given by |sink_id|.
103 // Returns true if a route request is successfully submitted. 104 // Returns true if a route request is successfully submitted.
104 // |OnRouteResponseReceived()| will be invoked when the route request 105 // |OnRouteResponseReceived()| will be invoked when the route request
105 // completes. 106 // completes.
106 bool CreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode); 107 bool CreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode);
107 108
108 // Calls MediaRouter to join the given route. 109 // Calls MediaRouter to join the given route.
109 bool ConnectRoute(const MediaSink::Id& sink_id, 110 bool ConnectRoute(const MediaSink::Id& sink_id,
(...skipping 10 matching lines...) Expand all
120 121
121 // Calls MediaRouter to search route providers for sinks matching 122 // Calls MediaRouter to search route providers for sinks matching
122 // |search_criteria| with the source that is currently associated with 123 // |search_criteria| with the source that is currently associated with
123 // |cast_mode|. The user's domain |domain| is also used. 124 // |cast_mode|. The user's domain |domain| is also used.
124 void SearchSinksAndCreateRoute(const MediaSink::Id& sink_id, 125 void SearchSinksAndCreateRoute(const MediaSink::Id& sink_id,
125 const std::string& search_criteria, 126 const std::string& search_criteria,
126 const std::string& domain, 127 const std::string& domain,
127 MediaCastMode cast_mode); 128 MediaCastMode cast_mode);
128 129
129 // Returns true if the cast mode last chosen for the current origin is tab 130 // Returns true if the cast mode last chosen for the current origin is tab
130 // mirroring. 131 // mirroring. Marked virtual for tests.
131 bool UserSelectedTabMirroringForCurrentOrigin() const; 132 virtual bool UserSelectedTabMirroringForCurrentOrigin() const;
132 133
133 // Records the cast mode selection for the current origin, unless the cast 134 // Records the cast mode selection for the current origin, unless the cast
134 // mode is MediaCastMode::DESKTOP_MIRROR. 135 // mode is MediaCastMode::DESKTOP_MIRROR. Marked virtual for tests.
135 void RecordCastModeSelection(MediaCastMode cast_mode); 136 virtual void RecordCastModeSelection(MediaCastMode cast_mode);
136 137
137 // Returns the hostname of the default source's parent frame URL. 138 // Returns the hostname of the default source's parent frame URL.
138 std::string GetPresentationRequestSourceName() const; 139 std::string GetPresentationRequestSourceName() const;
139 std::string GetTruncatedPresentationRequestSourceName() const; 140 std::string GetTruncatedPresentationRequestSourceName() const;
140 bool HasPendingRouteRequest() const { 141 bool HasPendingRouteRequest() const {
141 return current_route_request_id_ != -1; 142 return current_route_request_id_ != -1;
142 } 143 }
143 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } 144 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; }
144 const std::vector<MediaRoute>& routes() const { return routes_; } 145 const std::vector<MediaRoute>& routes() const { return routes_; }
145 const std::vector<MediaRoute::Id>& joinable_route_ids() const { 146 const std::vector<MediaRoute::Id>& joinable_route_ids() const {
146 return joinable_route_ids_; 147 return joinable_route_ids_;
147 } 148 }
148 const std::set<MediaCastMode>& cast_modes() const { return cast_modes_; } 149 // Marked virtual for tests.
150 virtual const std::set<MediaCastMode>& cast_modes() const;
149 const std::unordered_map<MediaRoute::Id, MediaCastMode>& 151 const std::unordered_map<MediaRoute::Id, MediaCastMode>&
150 routes_and_cast_modes() const { 152 routes_and_cast_modes() const {
151 return routes_and_cast_modes_; 153 return routes_and_cast_modes_;
152 } 154 }
153 const content::WebContents* initiator() const { return initiator_; } 155 const content::WebContents* initiator() const { return initiator_; }
154 156
155 // Marked virtual for tests. 157 // Marked virtual for tests.
156 virtual const std::string& GetRouteProviderExtensionId() const; 158 virtual const std::string& GetRouteProviderExtensionId() const;
157 159
158 // Called to track UI metrics. 160 // Called to track UI metrics.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // NOTE: Weak pointers must be invalidated before all other member variables. 351 // NOTE: Weak pointers must be invalidated before all other member variables.
350 // Therefore |weak_factory_| must be placed at the end. 352 // Therefore |weak_factory_| must be placed at the end.
351 base::WeakPtrFactory<MediaRouterUI> weak_factory_; 353 base::WeakPtrFactory<MediaRouterUI> weak_factory_;
352 354
353 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); 355 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI);
354 }; 356 };
355 357
356 } // namespace media_router 358 } // namespace media_router
357 359
358 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ 360 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/media_router/media_router_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698