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

Side by Side Diff: chromecast/browser/android/cast_content_window_android.h

Issue 2626863006: [Chromecast] Add CastWebContents (Closed)
Patch Set: [Chromecast] Add CastWebContents Created 3 years, 10 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 | « chromecast/browser/BUILD.gn ('k') | chromecast/browser/android/cast_content_window_android.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_ 5 #ifndef CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_
6 #define CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_ 6 #define CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chromecast/browser/cast_content_window.h" 14 #include "chromecast/browser/cast_content_window.h"
15 #include "content/public/browser/web_contents_observer.h"
16 15
17 namespace content { 16 namespace content {
18 class BrowserContext;
19 class WebContents; 17 class WebContents;
20 } 18 }
21 19
22 namespace chromecast { 20 namespace chromecast {
23 namespace shell { 21 namespace shell {
24 22
25 // Android implementation of CastContentWindow, which displays WebContents in 23 // Android implementation of CastContentWindow, which displays WebContents in
26 // CastWebContentsActivity. 24 // CastWebContentsActivity.
27 class CastContentWindowAndroid : public CastContentWindow, 25 class CastContentWindowAndroid : public CastContentWindow {
28 public content::WebContentsObserver {
29 public: 26 public:
30 static bool RegisterJni(JNIEnv* env); 27 static bool RegisterJni(JNIEnv* env);
31 28
32 ~CastContentWindowAndroid() override; 29 ~CastContentWindowAndroid() override;
33 30
34 // CastContentWindow implementation: 31 // CastContentWindow implementation:
35 void SetTransparent() override; 32 void SetTransparent() override;
36 void ShowWebContents(content::WebContents* web_contents, 33 void ShowWebContents(content::WebContents* web_contents,
37 CastWindowManager* window_manager) override; 34 CastWindowManager* window_manager) override;
38 std::unique_ptr<content::WebContents> CreateWebContents(
39 content::BrowserContext* browser_context,
40 scoped_refptr<content::SiteInstance> site_instance) override;
41
42 // content::WebContentsObserver implementation:
43 void DidFirstVisuallyNonEmptyPaint() override;
44 void MediaStartedPlaying(const MediaPlayerInfo& media_info,
45 const MediaPlayerId& id) override;
46 void MediaStoppedPlaying(const MediaPlayerInfo& media_info,
47 const MediaPlayerId& id) override;
48 void RenderViewCreated(content::RenderViewHost* render_view_host) override;
49 35
50 // Called through JNI. 36 // Called through JNI.
51 void OnActivityStopped(JNIEnv* env, 37 void OnActivityStopped(JNIEnv* env,
52 const base::android::JavaParamRef<jobject>& jcaller); 38 const base::android::JavaParamRef<jobject>& jcaller);
53 void OnKeyDown(JNIEnv* env, 39 void OnKeyDown(JNIEnv* env,
54 const base::android::JavaParamRef<jobject>& jcaller, 40 const base::android::JavaParamRef<jobject>& jcaller,
55 int keycode); 41 int keycode);
56 42
57 private: 43 private:
58 friend class CastContentWindow; 44 friend class CastContentWindow;
59 45
60 // This class should only be instantiated by CastContentWindow::Create. 46 // This class should only be instantiated by CastContentWindow::Create.
61 explicit CastContentWindowAndroid(CastContentWindow::Delegate* delegate); 47 explicit CastContentWindowAndroid(CastContentWindow::Delegate* delegate);
62 48
63 CastContentWindow::Delegate* const delegate_; 49 CastContentWindow::Delegate* const delegate_;
64 bool transparent_;
65 base::android::ScopedJavaGlobalRef<jobject> java_window_; 50 base::android::ScopedJavaGlobalRef<jobject> java_window_;
66 51
67 DISALLOW_COPY_AND_ASSIGN(CastContentWindowAndroid); 52 DISALLOW_COPY_AND_ASSIGN(CastContentWindowAndroid);
68 }; 53 };
69 54
70 } // namespace shell 55 } // namespace shell
71 } // namespace chromecast 56 } // namespace chromecast
72 57
73 #endif // CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_ 58 #endif // CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_
OLDNEW
« no previous file with comments | « chromecast/browser/BUILD.gn ('k') | chromecast/browser/android/cast_content_window_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698