OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ | 5 #ifndef CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ |
6 #define CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ | 6 #define CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chromecast/browser/cast_content_window.h" | 11 #include "chromecast/browser/cast_web_view.h" |
12 #include "chromecast/service/cast_service.h" | 12 #include "chromecast/service/cast_service.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace content { | |
16 class WebContents; | |
17 } | |
18 | |
19 namespace chromecast { | 15 namespace chromecast { |
20 class CastWindowManager; | 16 class CastWindowManager; |
21 | 17 |
22 namespace shell { | 18 namespace shell { |
23 | 19 |
24 class CastServiceSimple : public CastService, | 20 class CastServiceSimple : public CastService, public CastWebView::Delegate { |
25 public CastContentWindow::Delegate { | |
26 public: | 21 public: |
27 CastServiceSimple(content::BrowserContext* browser_context, | 22 CastServiceSimple(content::BrowserContext* browser_context, |
28 PrefService* pref_service, | 23 PrefService* pref_service, |
29 CastWindowManager* window_manager); | 24 CastWindowManager* window_manager); |
30 ~CastServiceSimple() override; | 25 ~CastServiceSimple() override; |
31 | 26 |
32 protected: | 27 protected: |
33 // CastService implementation: | 28 // CastService implementation: |
34 void InitializeInternal() override; | 29 void InitializeInternal() override; |
35 void FinalizeInternal() override; | 30 void FinalizeInternal() override; |
36 void StartInternal() override; | 31 void StartInternal() override; |
37 void StopInternal() override; | 32 void StopInternal() override; |
38 | 33 |
| 34 // CastWebView::Delegate implementation: |
| 35 void OnPageStopped(int error_code) override; |
| 36 void OnLoadingStateChanged(bool loading) override; |
| 37 |
39 // CastContentWindow::Delegate implementation: | 38 // CastContentWindow::Delegate implementation: |
40 void OnWindowDestroyed() override; | 39 void OnWindowDestroyed() override; |
41 void OnKeyEvent(const ui::KeyEvent& key_event) override; | 40 void OnKeyEvent(const ui::KeyEvent& key_event) override; |
42 | 41 |
43 private: | 42 private: |
44 CastWindowManager* const window_manager_; | 43 CastWindowManager* const window_manager_; |
45 std::unique_ptr<CastContentWindow> window_; | 44 std::unique_ptr<CastWebView> cast_web_view_; |
46 std::unique_ptr<content::WebContents> web_contents_; | |
47 GURL startup_url_; | 45 GURL startup_url_; |
48 | 46 |
49 DISALLOW_COPY_AND_ASSIGN(CastServiceSimple); | 47 DISALLOW_COPY_AND_ASSIGN(CastServiceSimple); |
50 }; | 48 }; |
51 | 49 |
52 } // namespace shell | 50 } // namespace shell |
53 } // namespace chromecast | 51 } // namespace chromecast |
54 | 52 |
55 #endif // CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ | 53 #endif // CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ |
OLD | NEW |