Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/android/shortcut_helper.h" | 5 #include "chrome/browser/android/shortcut_helper.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_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 env, java_webapk_package_name); | 261 env, java_webapk_package_name); |
| 262 } | 262 } |
| 263 return webapk_package_name; | 263 return webapk_package_name; |
| 264 } | 264 } |
| 265 | 265 |
| 266 // static | 266 // static |
| 267 bool ShortcutHelper::IsWebApkInstalled( | 267 bool ShortcutHelper::IsWebApkInstalled( |
| 268 content::BrowserContext* browser_context, | 268 content::BrowserContext* browser_context, |
| 269 const GURL& start_url, | 269 const GURL& start_url, |
| 270 const GURL& manifest_url) { | 270 const GURL& manifest_url) { |
| 271 return !QueryWebApkPackage(start_url).empty() || | 271 if (!QueryWebApkPackage(start_url).empty()) |
| 272 WebApkInstallService::Get(browser_context) | 272 return true; |
| 273 ->IsInstallInProgress(manifest_url); | 273 if (!ChromeWebApkHost::AreWebApkEnabled()) |
| 274 return false; | |
| 275 WebApkInstallService* service = WebApkInstallService::Get(browser_context); | |
| 276 return service != nullptr && service->IsInstallInProgress(manifest_url); | |
|
pkotwicz
2017/01/12 15:37:42
This is no longer necessary?
Xi Han
2017/01/12 15:50:36
I am just not 100 presents sure whether it is nece
| |
| 274 } | 277 } |
| 275 | 278 |
| 276 GURL ShortcutHelper::GetScopeFromURL(const GURL& url) { | 279 GURL ShortcutHelper::GetScopeFromURL(const GURL& url) { |
| 277 JNIEnv* env = base::android::AttachCurrentThread(); | 280 JNIEnv* env = base::android::AttachCurrentThread(); |
| 278 ScopedJavaLocalRef<jstring> java_url = | 281 ScopedJavaLocalRef<jstring> java_url = |
| 279 base::android::ConvertUTF8ToJavaString(env, url.spec()); | 282 base::android::ConvertUTF8ToJavaString(env, url.spec()); |
| 280 ScopedJavaLocalRef<jstring> java_scope_url = | 283 ScopedJavaLocalRef<jstring> java_scope_url = |
| 281 Java_ShortcutHelper_getScopeFromUrl(env, java_url); | 284 Java_ShortcutHelper_getScopeFromUrl(env, java_url); |
| 282 return GURL(base::android::ConvertJavaStringToUTF16(env, java_scope_url)); | 285 return GURL(base::android::ConvertJavaStringToUTF16(env, java_scope_url)); |
| 283 } | 286 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 295 DCHECK(jsplash_image_callback); | 298 DCHECK(jsplash_image_callback); |
| 296 base::Closure* splash_image_callback = | 299 base::Closure* splash_image_callback = |
| 297 reinterpret_cast<base::Closure*>(jsplash_image_callback); | 300 reinterpret_cast<base::Closure*>(jsplash_image_callback); |
| 298 splash_image_callback->Run(); | 301 splash_image_callback->Run(); |
| 299 delete splash_image_callback; | 302 delete splash_image_callback; |
| 300 } | 303 } |
| 301 | 304 |
| 302 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { | 305 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { |
| 303 return RegisterNativesImpl(env); | 306 return RegisterNativesImpl(env); |
| 304 } | 307 } |
| OLD | NEW |