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

Side by Side Diff: chrome/browser/android/service_tab_launcher.cc

Issue 897673002: First step in enabling creating tabs without an Activity on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a-base-mounir
Patch Set: Created 5 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/service_tab_launcher.h"
6
7 #include "base/android/jni_string.h"
8 #include "base/callback.h"
9 #include "content/public/browser/page_navigator.h"
10 #include "jni/ServiceTabLauncher_jni.h"
11
12 using base::android::AttachCurrentThread;
13 using base::android::ConvertUTF8ToJavaString;
14 using base::android::GetApplicationContext;
15
16 namespace chrome {
17 namespace android {
18
19 // static
20 ServiceTabLauncher* ServiceTabLauncher::GetInstance() {
21 return Singleton<ServiceTabLauncher>::get();
22 }
23
24 ServiceTabLauncher::ServiceTabLauncher() {
25 java_object_.Reset(
26 Java_ServiceTabLauncher_create(
27 AttachCurrentThread(),
28 reinterpret_cast<intptr_t>(this),
29 GetApplicationContext()));
30 }
31
32 ServiceTabLauncher::~ServiceTabLauncher() {}
33
34 void ServiceTabLauncher::LaunchTab(
35 content::BrowserContext* browser_context,
36 const content::OpenURLParams& params,
37 base::Callback<void(content::WebContents*)> callback) {
38 JNIEnv* env = AttachCurrentThread();
39 ScopedJavaLocalRef<jstring> url = ConvertUTF8ToJavaString(
40 env, params.url.spec());
mlamouri (slow - plz ping) 2015/02/09 12:07:37 Why not pass some other params value? if not all?
Peter Beverloo 2015/02/10 17:49:37 There are only very few of them we can do somethin
mlamouri (slow - plz ping) 2015/02/11 13:50:23 Given my comment above, you might want to at least
Peter Beverloo 2015/02/11 16:18:26 Done.
41
42 Java_ServiceTabLauncher_launchTab(env, java_object_.obj(), url.obj());
43
44 // TODO(peter): We need to wait for the Android Activity to reply to the
45 // launch intent with the ID of the launched Web Contents, so that the Java
46 // side can invoke a method on the native side with the request id and the
47 // WebContents enabling us to invoke |callback|. See https://crbug.com/454809.
48 }
49
50 bool ServiceTabLauncher::RegisterServiceTabLauncher(JNIEnv* env) {
51 return RegisterNativesImpl(env);
52 }
53
54 } // namespace android
55 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698