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 CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
14 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/scoped_ptr.h" | |
18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
21 #include "content/common/presentation/presentation_service.mojom.h" | 21 #include "content/common/presentation/presentation_service.mojom.h" |
22 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
23 #include "content/public/browser/presentation_screen_availability_listener.h" | 23 #include "content/public/browser/presentation_screen_availability_listener.h" |
24 #include "content/public/browser/presentation_service_delegate.h" | 24 #include "content/public/browser/presentation_service_delegate.h" |
25 #include "content/public/browser/web_contents_observer.h" | 25 #include "content/public/browser/web_contents_observer.h" |
26 #include "content/public/common/frame_navigate_params.h" | 26 #include "content/public/common/frame_navigate_params.h" |
27 #include "mojo/public/cpp/bindings/binding.h" | 27 #include "mojo/public/cpp/bindings/binding.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // May be null if embedder does not support Presentation API. | 250 // May be null if embedder does not support Presentation API. |
251 PresentationServiceDelegate* delegate_; | 251 PresentationServiceDelegate* delegate_; |
252 | 252 |
253 // Proxy to the PresentationServiceClient to send results (e.g., screen | 253 // Proxy to the PresentationServiceClient to send results (e.g., screen |
254 // availability) to. | 254 // availability) to. |
255 mojom::PresentationServiceClientPtr client_; | 255 mojom::PresentationServiceClientPtr client_; |
256 | 256 |
257 std::string default_presentation_url_; | 257 std::string default_presentation_url_; |
258 | 258 |
259 using ScreenAvailabilityListenerMap = | 259 using ScreenAvailabilityListenerMap = |
260 std::map<std::string, scoped_ptr<ScreenAvailabilityListenerImpl>>; | 260 std::map<std::string, std::unique_ptr<ScreenAvailabilityListenerImpl>>; |
261 ScreenAvailabilityListenerMap screen_availability_listeners_; | 261 ScreenAvailabilityListenerMap screen_availability_listeners_; |
262 | 262 |
263 // For StartSession requests. | 263 // For StartSession requests. |
264 // Set to a positive value when a StartSession request is being processed. | 264 // Set to a positive value when a StartSession request is being processed. |
265 int start_session_request_id_; | 265 int start_session_request_id_; |
266 scoped_ptr<NewSessionMojoCallbackWrapper> pending_start_session_cb_; | 266 std::unique_ptr<NewSessionMojoCallbackWrapper> pending_start_session_cb_; |
267 | 267 |
268 // For JoinSession requests. | 268 // For JoinSession requests. |
269 base::hash_map<int, linked_ptr<NewSessionMojoCallbackWrapper>> | 269 base::hash_map<int, linked_ptr<NewSessionMojoCallbackWrapper>> |
270 pending_join_session_cbs_; | 270 pending_join_session_cbs_; |
271 | 271 |
272 // RAII binding of |this| to an Presentation interface request. | 272 // RAII binding of |this| to an Presentation interface request. |
273 // The binding is removed when binding_ is cleared or goes out of scope. | 273 // The binding is removed when binding_ is cleared or goes out of scope. |
274 scoped_ptr<mojo::Binding<mojom::PresentationService>> binding_; | 274 std::unique_ptr<mojo::Binding<mojom::PresentationService>> binding_; |
275 | 275 |
276 // There can be only one send message request at a time. | 276 // There can be only one send message request at a time. |
277 scoped_ptr<SendMessageMojoCallback> send_message_callback_; | 277 std::unique_ptr<SendMessageMojoCallback> send_message_callback_; |
278 | 278 |
279 scoped_ptr<SessionMessagesCallback> on_session_messages_callback_; | 279 std::unique_ptr<SessionMessagesCallback> on_session_messages_callback_; |
280 | 280 |
281 // ID of the RenderFrameHost this object is associated with. | 281 // ID of the RenderFrameHost this object is associated with. |
282 int render_process_id_; | 282 int render_process_id_; |
283 int render_frame_id_; | 283 int render_frame_id_; |
284 | 284 |
285 // NOTE: Weak pointers must be invalidated before all other member variables. | 285 // NOTE: Weak pointers must be invalidated before all other member variables. |
286 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 286 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
287 | 287 |
288 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 288 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
289 }; | 289 }; |
290 | 290 |
291 } // namespace content | 291 } // namespace content |
292 | 292 |
293 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 293 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
OLD | NEW |