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

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

Issue 2242473002: Add an about:flag to control WebApk enablement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix last native reference Created 4 years, 4 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void ShortcutHelper::AddToLauncherInBackgroundWithSkBitmap( 67 void ShortcutHelper::AddToLauncherInBackgroundWithSkBitmap(
68 content::BrowserContext* browser_context, 68 content::BrowserContext* browser_context,
69 const ShortcutInfo& info, 69 const ShortcutInfo& info,
70 const std::string& webapp_id, 70 const std::string& webapp_id,
71 const SkBitmap& icon_bitmap, 71 const SkBitmap& icon_bitmap,
72 const base::Closure& splash_image_callback) { 72 const base::Closure& splash_image_callback) {
73 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 73 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
74 74
75 if (info.display == blink::WebDisplayModeStandalone || 75 if (info.display == blink::WebDisplayModeStandalone ||
76 info.display == blink::WebDisplayModeFullscreen) { 76 info.display == blink::WebDisplayModeFullscreen) {
77 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 77 JNIEnv* env = base::android::AttachCurrentThread();
78 switches::kEnableWebApk)) { 78 if (Java_ShortcutHelper_areWebApksEnabled(env)) {
79 InstallWebApkInBackgroundWithSkBitmap(browser_context, info, icon_bitmap); 79 InstallWebApkInBackgroundWithSkBitmap(browser_context, info, icon_bitmap);
80 return; 80 return;
81 } 81 }
82 AddWebappInBackgroundWithSkBitmap(info, webapp_id, icon_bitmap, 82 AddWebappInBackgroundWithSkBitmap(info, webapp_id, icon_bitmap,
83 splash_image_callback); 83 splash_image_callback);
84 return; 84 return;
85 } 85 }
86 AddShortcutInBackgroundWithSkBitmap(info, icon_bitmap); 86 AddShortcutInBackgroundWithSkBitmap(info, icon_bitmap);
87 } 87 }
88 88
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 DCHECK(jsplash_image_callback); 306 DCHECK(jsplash_image_callback);
307 base::Closure* splash_image_callback = 307 base::Closure* splash_image_callback =
308 reinterpret_cast<base::Closure*>(jsplash_image_callback); 308 reinterpret_cast<base::Closure*>(jsplash_image_callback);
309 splash_image_callback->Run(); 309 splash_image_callback->Run();
310 delete splash_image_callback; 310 delete splash_image_callback;
311 } 311 }
312 312
313 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { 313 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) {
314 return RegisterNativesImpl(env); 314 return RegisterNativesImpl(env);
315 } 315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698