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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/android/jni_array.h" | 11 #include "base/android/jni_array.h" |
12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/guid.h" | 15 #include "base/guid.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
19 #include "chrome/browser/android/webapk/chrome_webapk_host.h" | 19 #include "chrome/browser/android/webapk/chrome_webapk_host.h" |
20 #include "chrome/browser/android/webapk/webapk_install_service.h" | 20 #include "chrome/browser/android/webapk/webapk_install_service.h" |
21 #include "chrome/browser/android/webapk/webapk_metrics.h" | 21 #include "chrome/browser/android/webapk/webapk_metrics.h" |
22 #include "chrome/browser/manifest/manifest_icon_downloader.h" | |
23 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/manifest_icon_downloader.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "jni/ShortcutHelper_jni.h" | 26 #include "jni/ShortcutHelper_jni.h" |
27 #include "ui/gfx/android/java_bitmap.h" | 27 #include "ui/gfx/android/java_bitmap.h" |
28 #include "ui/gfx/color_analysis.h" | 28 #include "ui/gfx/color_analysis.h" |
29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
30 | 30 |
31 using base::android::JavaParamRef; | 31 using base::android::JavaParamRef; |
32 using base::android::ScopedJavaLocalRef; | 32 using base::android::ScopedJavaLocalRef; |
33 using content::Manifest; | 33 using content::Manifest; |
34 | 34 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 // static | 203 // static |
204 void ShortcutHelper::FetchSplashScreenImage( | 204 void ShortcutHelper::FetchSplashScreenImage( |
205 content::WebContents* web_contents, | 205 content::WebContents* web_contents, |
206 const GURL& image_url, | 206 const GURL& image_url, |
207 const int ideal_splash_image_size_in_px, | 207 const int ideal_splash_image_size_in_px, |
208 const int minimum_splash_image_size_in_px, | 208 const int minimum_splash_image_size_in_px, |
209 const std::string& webapp_id) { | 209 const std::string& webapp_id) { |
210 // This is a fire and forget task. It is not vital for the splash screen image | 210 // This is a fire and forget task. It is not vital for the splash screen image |
211 // to be downloaded so if the downloader returns false there is no fallback. | 211 // to be downloaded so if the downloader returns false there is no fallback. |
212 ManifestIconDownloader::Download( | 212 content::ManifestIconDownloader::Download( |
213 web_contents, image_url, ideal_splash_image_size_in_px, | 213 web_contents, image_url, ideal_splash_image_size_in_px, |
214 minimum_splash_image_size_in_px, | 214 minimum_splash_image_size_in_px, |
215 base::Bind(&ShortcutHelper::StoreWebappSplashImage, webapp_id)); | 215 base::Bind(&ShortcutHelper::StoreWebappSplashImage, webapp_id)); |
216 } | 216 } |
217 | 217 |
218 // static | 218 // static |
219 void ShortcutHelper::StoreWebappSplashImage(const std::string& webapp_id, | 219 void ShortcutHelper::StoreWebappSplashImage(const std::string& webapp_id, |
220 const SkBitmap& splash_image) { | 220 const SkBitmap& splash_image) { |
221 if (splash_image.drawsNothing()) | 221 if (splash_image.drawsNothing()) |
222 return; | 222 return; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 409 |
410 ShortcutHelper::WebApkInfoCallback* webapk_list_callback = | 410 ShortcutHelper::WebApkInfoCallback* webapk_list_callback = |
411 reinterpret_cast<ShortcutHelper::WebApkInfoCallback*>(jcallback_pointer); | 411 reinterpret_cast<ShortcutHelper::WebApkInfoCallback*>(jcallback_pointer); |
412 webapk_list_callback->Run(webapk_list); | 412 webapk_list_callback->Run(webapk_list); |
413 delete webapk_list_callback; | 413 delete webapk_list_callback; |
414 } | 414 } |
415 | 415 |
416 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { | 416 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { |
417 return RegisterNativesImpl(env); | 417 return RegisterNativesImpl(env); |
418 } | 418 } |
OLD | NEW |