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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/common/presentation/presentation_service.mojom.h" | 15 #include "content/common/presentation/presentation_service.mojom.h" |
16 #include "content/common/presentation/presentation_session.mojom.h" | |
16 #include "content/public/browser/navigation_details.h" | 17 #include "content/public/browser/navigation_details.h" |
17 #include "content/public/browser/presentation_screen_availability_listener.h" | 18 #include "content/public/browser/presentation_screen_availability_listener.h" |
18 #include "content/public/browser/presentation_service_delegate.h" | 19 #include "content/public/browser/presentation_service_delegate.h" |
19 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
20 #include "content/public/common/frame_navigate_params.h" | 21 #include "content/public/common/frame_navigate_params.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 struct FrameNavigateParams; | 25 struct FrameNavigateParams; |
25 struct LoadCommittedDetails; | 26 struct LoadCommittedDetails; |
(...skipping 17 matching lines...) Expand all Loading... | |
43 | 44 |
44 // Static factory method to create an instance of PresentationServiceImpl. | 45 // Static factory method to create an instance of PresentationServiceImpl. |
45 // |render_frame_host|: The RFH the instance is associated with. | 46 // |render_frame_host|: The RFH the instance is associated with. |
46 // |request|: The instance will be bound to this request. Used for Mojo setup. | 47 // |request|: The instance will be bound to this request. Used for Mojo setup. |
47 static void CreateMojoService( | 48 static void CreateMojoService( |
48 RenderFrameHost* render_frame_host, | 49 RenderFrameHost* render_frame_host, |
49 mojo::InterfaceRequest<presentation::PresentationService> request); | 50 mojo::InterfaceRequest<presentation::PresentationService> request); |
50 | 51 |
51 private: | 52 private: |
52 typedef mojo::Callback<void(bool)> ScreenAvailabilityMojoCallback; | 53 typedef mojo::Callback<void(bool)> ScreenAvailabilityMojoCallback; |
54 typedef mojo::Callback<void(presentation::PresentationSessionInfoPtr, | |
mlamouri (slow - plz ping)
2015/02/23 14:07:39
What about using `using Foo = Bar;` C++11 FTW :)
whywhat
2015/02/25 14:12:41
Done.
| |
55 presentation::PresentationErrorPtr)> NewSessionMojoCallback; | |
53 | 56 |
54 friend class PresentationServiceImplTest; | 57 friend class PresentationServiceImplTest; |
55 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, RemoveAllListeners); | 58 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, RemoveAllListeners); |
56 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 59 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
57 DidNavigateThisFrame); | 60 DidNavigateThisFrame); |
58 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 61 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
59 DidNavigateNotThisFrame); | 62 DidNavigateNotThisFrame); |
60 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 63 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
61 ThisRenderFrameDeleted); | 64 ThisRenderFrameDeleted); |
62 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 65 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
63 NotThisRenderFrameDeleted); | 66 NotThisRenderFrameDeleted); |
64 | 67 |
65 // |render_frame_host|: The RFH this instance is associated with. | 68 // |render_frame_host|: The RFH this instance is associated with. |
66 // |web_contents|: The WebContents to observe. | 69 // |web_contents|: The WebContents to observe. |
67 // |delegate|: Where Presentation API requests are delegated to. Not owned | 70 // |delegate|: Where Presentation API requests are delegated to. Not owned |
68 // by this class. | 71 // by this class. |
69 PresentationServiceImpl( | 72 PresentationServiceImpl( |
70 RenderFrameHost* render_frame_host, | 73 RenderFrameHost* render_frame_host, |
71 WebContents* web_contents, | 74 WebContents* web_contents, |
72 PresentationServiceDelegate* delegate); | 75 PresentationServiceDelegate* delegate); |
73 | 76 |
74 // PresentationService implementation. | 77 // PresentationService implementation. |
75 void GetScreenAvailability( | 78 void GetScreenAvailability( |
76 const mojo::String& presentation_url, | 79 const mojo::String& presentation_url, |
77 const ScreenAvailabilityMojoCallback& callback) override; | 80 const ScreenAvailabilityMojoCallback& callback) override; |
78 void OnScreenAvailabilityListenerRemoved() override; | 81 void OnScreenAvailabilityListenerRemoved() override; |
82 void StartSession( | |
83 const mojo::String& presentation_url, | |
84 const mojo::String& presentation_id, | |
85 const NewSessionMojoCallback& callback) override; | |
86 void JoinSession( | |
87 const mojo::String& presentation_url, | |
88 const mojo::String& presentation_id, | |
89 const NewSessionMojoCallback& callback) override; | |
79 | 90 |
80 // mojo::InterfaceImpl override. | 91 // mojo::InterfaceImpl override. |
81 // Note that this is called when the RenderFrameHost is deleted. | 92 // Note that this is called when the RenderFrameHost is deleted. |
82 void OnConnectionError() override; | 93 void OnConnectionError() override; |
83 | 94 |
84 // WebContentsObserver override. | 95 // WebContentsObserver override. |
85 void DidNavigateAnyFrame( | 96 void DidNavigateAnyFrame( |
86 content::RenderFrameHost* render_frame_host, | 97 content::RenderFrameHost* render_frame_host, |
87 const content::LoadCommittedDetails& details, | 98 const content::LoadCommittedDetails& details, |
88 const content::FrameNavigateParams& params) override; | 99 const content::FrameNavigateParams& params) override; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 availability_contexts_; | 154 availability_contexts_; |
144 | 155 |
145 std::string default_presentation_url_; | 156 std::string default_presentation_url_; |
146 | 157 |
147 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 158 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
148 }; | 159 }; |
149 | 160 |
150 } // namespace content | 161 } // namespace content |
151 | 162 |
152 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 163 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
OLD | NEW |