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

Unified Diff: chromecast/browser/android/cast_content_window_android.h

Issue 2570623003: [Chromecast] Turn CastContentWindow into an abstract interface. (Closed)
Patch Set: Remove duplicate dependency Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/browser/android/cast_content_window_android.h
diff --git a/chromecast/browser/android/cast_content_window_android.h b/chromecast/browser/android/cast_content_window_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..b133b9b8ade0caaa1640c58a668de12895333b8d
--- /dev/null
+++ b/chromecast/browser/android/cast_content_window_android.h
@@ -0,0 +1,68 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_
+#define CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_
+
+#include <jni.h>
+
+#include <memory>
+
+#include "base/android/scoped_java_ref.h"
+#include "base/macros.h"
+#include "chromecast/browser/cast_content_window.h"
+#include "content/public/browser/web_contents_observer.h"
+
+namespace content {
+class BrowserContext;
+class WebContents;
+}
+
+namespace chromecast {
+namespace shell {
+
+// Android implementation of CastContentWindow, which displays WebContents in
+// CastWebContentsActivity.
+class CastContentWindowAndroid : public CastContentWindow,
+ public content::WebContentsObserver {
+ public:
+ static bool RegisterJni(JNIEnv* env);
+
+ explicit CastContentWindowAndroid(CastContentWindow::Delegate* delegate);
Wez 2017/01/11 20:47:54 As noted in the Linux impl, it doesn't seem that t
derekjchow1 2017/01/11 21:54:33 Your point on constructor visibility is valid, but
Wez 2017/01/12 21:04:28 Yes, SGTM - thanks. :) (If you would prefer to av
+
+ ~CastContentWindowAndroid() override;
+
+ // CastContentWindow implementation:
+ void SetTransparent() override;
+ void ShowWebContents(content::WebContents* web_contents) override;
+ std::unique_ptr<content::WebContents> CreateWebContents(
+ content::BrowserContext* browser_context) override;
+
+ // content::WebContentsObserver implementation:
+ void DidFirstVisuallyNonEmptyPaint() override;
+ void MediaStoppedPlaying(const MediaPlayerInfo& media_info,
+ const MediaPlayerId& id) override;
+ void MediaStartedPlaying(const MediaPlayerInfo& media_info,
+ const MediaPlayerId& id) override;
+ void RenderViewCreated(content::RenderViewHost* render_view_host) override;
+
+ // Called through JNI.
+ void OnActivityStopped(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jcaller);
+ void OnKeyDown(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jcaller,
+ int keycode);
+
+ private:
+ CastContentWindow::Delegate* const delegate_;
+ bool transparent_;
+ base::android::ScopedJavaGlobalRef<jobject> java_window_;
+
+ DISALLOW_COPY_AND_ASSIGN(CastContentWindowAndroid);
+};
+
+} // namespace shell
+} // namespace chromecast
+
+#endif // CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698