OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/webapps/add_to_homescreen_manager.h" | 5 #include "chrome/browser/android/webapps/add_to_homescreen_manager.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" | 14 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
15 #include "chrome/browser/android/shortcut_helper.h" | 15 #include "chrome/browser/android/shortcut_helper.h" |
16 #include "chrome/browser/android/webapk/chrome_webapk_host.h" | 16 #include "chrome/browser/android/webapk/chrome_webapk_host.h" |
| 17 #include "chrome/browser/android/webapk/webapk_metrics.h" |
17 #include "chrome/browser/banners/app_banner_settings_helper.h" | 18 #include "chrome/browser/banners/app_banner_settings_helper.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 #include "content/public/common/origin_util.h" | 21 #include "content/public/common/origin_util.h" |
21 #include "jni/AddToHomescreenManager_jni.h" | 22 #include "jni/AddToHomescreenManager_jni.h" |
22 #include "ui/gfx/android/java_bitmap.h" | 23 #include "ui/gfx/android/java_bitmap.h" |
23 | 24 |
24 using base::android::JavaParamRef; | 25 using base::android::JavaParamRef; |
25 using base::android::ScopedJavaLocalRef; | 26 using base::android::ScopedJavaLocalRef; |
26 | 27 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (add_shortcut_pending_) | 167 if (add_shortcut_pending_) |
167 AddShortcut(info, icon); | 168 AddShortcut(info, icon); |
168 } | 169 } |
169 | 170 |
170 void AddToHomescreenManager::CreateInfoBarForWebAPK(const ShortcutInfo& info, | 171 void AddToHomescreenManager::CreateInfoBarForWebAPK(const ShortcutInfo& info, |
171 const SkBitmap& icon) { | 172 const SkBitmap& icon) { |
172 banners::AppBannerInfoBarDelegateAndroid::Create( | 173 banners::AppBannerInfoBarDelegateAndroid::Create( |
173 data_fetcher_->web_contents(), nullptr, info.user_title, | 174 data_fetcher_->web_contents(), nullptr, info.user_title, |
174 base::MakeUnique<ShortcutInfo>(info), base::MakeUnique<SkBitmap>(icon), | 175 base::MakeUnique<ShortcutInfo>(info), base::MakeUnique<SkBitmap>(icon), |
175 -1 /* event_request_id */, true /* is_webapk */, | 176 -1 /* event_request_id */, true /* is_webapk */, |
176 true /* start_install_webapk */); | 177 webapk::INSTALL_SOURCE_MENU); |
177 } | 178 } |
178 | 179 |
179 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground( | 180 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground( |
180 const SkBitmap& bitmap, | 181 const SkBitmap& bitmap, |
181 const GURL& url, | 182 const GURL& url, |
182 bool* is_generated) { | 183 bool* is_generated) { |
183 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 184 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
184 | 185 |
185 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url, | 186 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url, |
186 is_generated); | 187 is_generated); |
187 } | 188 } |
OLD | NEW |