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

Side by Side Diff: chromecast/shell/browser/android/cast_window_manager.cc

Issue 601293002: Chromecast: call ClosePage(), wait 50ms before deleting WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment nit, rebase 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 unified diff | Download patch
OLDNEW
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 #include "chromecast/shell/browser/android/cast_window_manager.h" 5 #include "chromecast/shell/browser/android/cast_window_manager.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 jlong LaunchCastWindow(JNIEnv* env, jclass clazz, jstring jurl) { 60 jlong LaunchCastWindow(JNIEnv* env, jclass clazz, jstring jurl) {
61 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); 61 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl));
62 return reinterpret_cast<jlong>( 62 return reinterpret_cast<jlong>(
63 CastWindowAndroid::CreateNewWindow( 63 CastWindowAndroid::CreateNewWindow(
64 CastBrowserProcess::GetInstance()->browser_context(), 64 CastBrowserProcess::GetInstance()->browser_context(),
65 url)); 65 url));
66 } 66 }
67 67
68 void StopCastWindow(JNIEnv* env, jclass clazz, jlong nativeCastWindow) { 68 void StopCastWindow(JNIEnv* env, jclass clazz,
69 jlong nativeCastWindow, jboolean gracefully) {
69 CastWindowAndroid* window = 70 CastWindowAndroid* window =
70 reinterpret_cast<CastWindowAndroid*>(nativeCastWindow); 71 reinterpret_cast<CastWindowAndroid*>(nativeCastWindow);
71 DCHECK(window); 72 DCHECK(window);
72 window->Close(); 73 if (gracefully)
74 window->Close();
75 else
76 window->Destroy();
73 } 77 }
74 78
75 void EnableDevTools(JNIEnv* env, jclass clazz, jboolean enable) { 79 void EnableDevTools(JNIEnv* env, jclass clazz, jboolean enable) {
76 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
77 // The specific port value doesn't matter since Android uses Unix domain 81 // The specific port value doesn't matter since Android uses Unix domain
78 // sockets, only whether or not it is zero. 82 // sockets, only whether or not it is zero.
79 chromecast::ChromecastConfig::GetInstance()->pref_service()-> 83 chromecast::ChromecastConfig::GetInstance()->pref_service()->
80 SetInteger(prefs::kRemoteDebuggingPort, enable ? 1 : 0); 84 SetInteger(prefs::kRemoteDebuggingPort, enable ? 1 : 0);
81 } 85 }
82 86
83 } // namespace shell 87 } // namespace shell
84 } // namespace chromecast 88 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/shell/browser/android/cast_window_android.cc ('k') | chromecast/shell/browser/cast_browser_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698