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_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Router to handle presentation API calls forwarded from | 39 // Router to handle presentation API calls forwarded from |
40 // PresentationServiceImpl. In addition, it also | 40 // PresentationServiceImpl. In addition, it also |
41 // provides default presentation URL that is required for creating | 41 // provides default presentation URL that is required for creating |
42 // browser-initiated sessions. | 42 // browser-initiated sessions. |
43 // It is scoped to the lifetime of a WebContents, and is managed by the | 43 // It is scoped to the lifetime of a WebContents, and is managed by the |
44 // associated WebContents. | 44 // associated WebContents. |
45 class PresentationServiceDelegateImpl | 45 class PresentationServiceDelegateImpl |
46 : public content::WebContentsUserData<PresentationServiceDelegateImpl>, | 46 : public content::WebContentsUserData<PresentationServiceDelegateImpl>, |
47 public content::PresentationServiceDelegate { | 47 public content::PresentationServiceDelegate { |
48 public: | 48 public: |
| 49 // Retrieves the instance of PresentationServiceDelegateImpl that was attached |
| 50 // to the specified WebContents. If no instance was attached, creates one, |
| 51 // and attaches it to the specified WebContents. |
| 52 static PresentationServiceDelegateImpl* GetOrCreateForWebContents( |
| 53 content::WebContents* web_contents); |
| 54 |
49 ~PresentationServiceDelegateImpl() override; | 55 ~PresentationServiceDelegateImpl() override; |
50 | 56 |
51 // content::PresentationServiceDelegate implementation. | 57 // content::PresentationServiceDelegate implementation. |
52 void AddObserver( | 58 void AddObserver( |
53 int render_process_id, | 59 int render_process_id, |
54 int render_frame_id, | 60 int render_frame_id, |
55 content::PresentationServiceDelegate::Observer* observer) override; | 61 content::PresentationServiceDelegate::Observer* observer) override; |
56 void RemoveObserver(int render_process_id, int render_frame_id) override; | 62 void RemoveObserver(int render_process_id, int render_frame_id) override; |
57 bool AddScreenAvailabilityListener( | 63 bool AddScreenAvailabilityListener( |
58 int render_process_id, | 64 int render_process_id, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 scoped_ptr<PresentationFrameManager> frame_manager_; | 170 scoped_ptr<PresentationFrameManager> frame_manager_; |
165 | 171 |
166 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; | 172 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; |
167 | 173 |
168 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); | 174 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); |
169 }; | 175 }; |
170 | 176 |
171 } // namespace media_router | 177 } // namespace media_router |
172 | 178 |
173 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 179 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
OLD | NEW |