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

Unified Diff: chromecast/shell/browser/android/cast_window_manager.cc

Issue 638803002: Reorganizes Chromecast code to better reflect functional dependencies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extra DEPS: chromecast/crash/android --> chromecast/common Created 6 years, 2 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/shell/browser/android/cast_window_manager.cc
diff --git a/chromecast/shell/browser/android/cast_window_manager.cc b/chromecast/shell/browser/android/cast_window_manager.cc
deleted file mode 100644
index 481eb4bbffef5052adfcbea01cce9906dfbc61cf..0000000000000000000000000000000000000000
--- a/chromecast/shell/browser/android/cast_window_manager.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2014 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.
-
-#include "chromecast/shell/browser/android/cast_window_manager.h"
-
-#include <jni.h>
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_string.h"
-#include "base/android/scoped_java_ref.h"
-#include "base/bind.h"
-#include "base/lazy_instance.h"
-#include "chromecast/common/chromecast_config.h"
-#include "chromecast/common/pref_names.h"
-#include "chromecast/shell/browser/android/cast_window_android.h"
-#include "chromecast/shell/browser/cast_browser_context.h"
-#include "chromecast/shell/browser/cast_browser_main_parts.h"
-#include "chromecast/shell/browser/cast_browser_process.h"
-#include "chromecast/shell/browser/cast_content_browser_client.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/web_contents.h"
-#include "ipc/ipc_channel.h"
-#include "jni/CastWindowManager_jni.h"
-#include "url/gurl.h"
-
-namespace {
-
-base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> >
- g_window_manager = LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
-namespace chromecast {
-namespace shell {
-
-base::android::ScopedJavaLocalRef<jobject>
-CreateCastWindowView(CastWindowAndroid* shell) {
- JNIEnv* env = base::android::AttachCurrentThread();
- jobject j_window_manager = g_window_manager.Get().obj();
- return Java_CastWindowManager_createCastWindow(env, j_window_manager);
-}
-
-void CloseCastWindowView(jobject shell_wrapper) {
- JNIEnv* env = base::android::AttachCurrentThread();
- jobject j_window_manager = g_window_manager.Get().obj();
- Java_CastWindowManager_closeCastWindow(env, j_window_manager, shell_wrapper);
-}
-
-// Register native methods
-bool RegisterCastWindowManager(JNIEnv* env) {
- return RegisterNativesImpl(env);
-}
-
-void Init(JNIEnv* env, jclass clazz, jobject obj) {
- g_window_manager.Get().Reset(
- base::android::ScopedJavaLocalRef<jobject>(env, obj));
-}
-
-jlong LaunchCastWindow(JNIEnv* env, jclass clazz, jstring jurl) {
- GURL url(base::android::ConvertJavaStringToUTF8(env, jurl));
- return reinterpret_cast<jlong>(
- CastWindowAndroid::CreateNewWindow(
- CastBrowserProcess::GetInstance()->browser_context(),
- url));
-}
-
-void StopCastWindow(JNIEnv* env, jclass clazz,
- jlong nativeCastWindow, jboolean gracefully) {
- CastWindowAndroid* window =
- reinterpret_cast<CastWindowAndroid*>(nativeCastWindow);
- DCHECK(window);
- if (gracefully)
- window->Close();
- else
- window->Destroy();
-}
-
-void EnableDevTools(JNIEnv* env, jclass clazz, jboolean enable) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- // The specific port value doesn't matter since Android uses Unix domain
- // sockets, only whether or not it is zero.
- chromecast::ChromecastConfig::GetInstance()->pref_service()->
- SetInteger(prefs::kRemoteDebuggingPort, enable ? 1 : 0);
-}
-
-} // namespace shell
-} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698