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

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

Issue 2570623003: [Chromecast] Turn CastContentWindow into an abstract interface. (Closed)
Patch Set: Fix browser test 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..ff94bc516f270b571044c131f19ed64f68ab7134
--- /dev/null
+++ b/chromecast/browser/android/cast_content_window_android.h
@@ -0,0 +1,71 @@
+// 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);
+
+ ~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 MediaStartedPlaying(const MediaPlayerInfo& media_info,
+ const MediaPlayerId& id) override;
+ void MediaStoppedPlaying(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:
+ friend class CastContentWindow;
+
+ // This class should only be instantiated by CastContentWindow::Create.
+ explicit CastContentWindowAndroid(CastContentWindow::Delegate* delegate);
+
+ 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