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

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

Issue 2620403002: Fix WebApkInstallService::IsInstallInProgress() crash. (Closed)
Patch Set: Handle the incognito mode. 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 unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698