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

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

Issue 2259093003: Move native "enable-webapk" check to ChromeWebApkHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error. 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"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "chrome/browser/android/webapk/chrome_webapk_host.h"
17 #include "chrome/browser/android/webapk/webapk_installer.h" 18 #include "chrome/browser/android/webapk/webapk_installer.h"
18 #include "chrome/browser/manifest/manifest_icon_downloader.h" 19 #include "chrome/browser/manifest/manifest_icon_downloader.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "jni/ShortcutHelper_jni.h" 23 #include "jni/ShortcutHelper_jni.h"
23 #include "ui/gfx/android/java_bitmap.h" 24 #include "ui/gfx/android/java_bitmap.h"
24 #include "ui/gfx/color_analysis.h" 25 #include "ui/gfx/color_analysis.h"
25 #include "url/gurl.h" 26 #include "url/gurl.h"
26 27
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 66
66 // static 67 // static
67 void ShortcutHelper::AddToLauncherWithSkBitmap( 68 void ShortcutHelper::AddToLauncherWithSkBitmap(
68 content::BrowserContext* browser_context, 69 content::BrowserContext* browser_context,
69 const ShortcutInfo& info, 70 const ShortcutInfo& info,
70 const std::string& webapp_id, 71 const std::string& webapp_id,
71 const SkBitmap& icon_bitmap, 72 const SkBitmap& icon_bitmap,
72 const base::Closure& splash_image_callback) { 73 const base::Closure& splash_image_callback) {
73 if (info.display == blink::WebDisplayModeStandalone || 74 if (info.display == blink::WebDisplayModeStandalone ||
74 info.display == blink::WebDisplayModeFullscreen) { 75 info.display == blink::WebDisplayModeFullscreen) {
75 JNIEnv* env = base::android::AttachCurrentThread(); 76 if (ChromeWebApkHost::AreWebApkEnabled()) {
76 if (Java_ShortcutHelper_areWebApksEnabled(env)) {
77 InstallWebApkWithSkBitmap(browser_context, info, icon_bitmap); 77 InstallWebApkWithSkBitmap(browser_context, info, icon_bitmap);
78 return; 78 return;
79 } 79 }
80 AddWebappWithSkBitmap(info, webapp_id, icon_bitmap, splash_image_callback); 80 AddWebappWithSkBitmap(info, webapp_id, icon_bitmap, splash_image_callback);
81 return; 81 return;
82 } 82 }
83 AddShortcutWithSkBitmap(info, icon_bitmap); 83 AddShortcutWithSkBitmap(info, icon_bitmap);
84 } 84 }
85 85
86 // static 86 // static
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 DCHECK(jsplash_image_callback); 287 DCHECK(jsplash_image_callback);
288 base::Closure* splash_image_callback = 288 base::Closure* splash_image_callback =
289 reinterpret_cast<base::Closure*>(jsplash_image_callback); 289 reinterpret_cast<base::Closure*>(jsplash_image_callback);
290 splash_image_callback->Run(); 290 splash_image_callback->Run();
291 delete splash_image_callback; 291 delete splash_image_callback;
292 } 292 }
293 293
294 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { 294 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) {
295 return RegisterNativesImpl(env); 295 return RegisterNativesImpl(env);
296 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698