| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 if (data_fetcher_->is_ready()) { | 70 if (data_fetcher_->is_ready()) { |
| 71 // If the fetcher isn't ready yet, the shortcut will be added when it is | 71 // If the fetcher isn't ready yet, the shortcut will be added when it is |
| 72 // via OnDataAvailable(); | 72 // via OnDataAvailable(); |
| 73 AddShortcut(data_fetcher_->shortcut_info(), data_fetcher_->primary_icon()); | 73 AddShortcut(data_fetcher_->shortcut_info(), data_fetcher_->primary_icon()); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 void AddToHomescreenManager::Start(content::WebContents* web_contents) { | 77 void AddToHomescreenManager::Start(content::WebContents* web_contents) { |
| 78 bool check_webapk_compatible = false; | 78 bool check_webapk_compatible = false; |
| 79 if (ChromeWebApkHost::AreWebApkEnabled() && | 79 if (ChromeWebApkHost::CanInstallWebApk() && |
| 80 InstallableManager::IsContentSecure(web_contents)) { | 80 InstallableManager::IsContentSecure(web_contents)) { |
| 81 check_webapk_compatible = true; | 81 check_webapk_compatible = true; |
| 82 } else { | 82 } else { |
| 83 ShowDialog(); | 83 ShowDialog(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 data_fetcher_ = new AddToHomescreenDataFetcher( | 86 data_fetcher_ = new AddToHomescreenDataFetcher( |
| 87 web_contents, ShortcutHelper::GetIdealHomescreenIconSizeInPx(), | 87 web_contents, ShortcutHelper::GetIdealHomescreenIconSizeInPx(), |
| 88 ShortcutHelper::GetMinimumHomescreenIconSizeInPx(), | 88 ShortcutHelper::GetMinimumHomescreenIconSizeInPx(), |
| 89 ShortcutHelper::GetIdealSplashImageSizeInPx(), | 89 ShortcutHelper::GetIdealSplashImageSizeInPx(), |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground( | 200 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground( |
| 201 const SkBitmap& bitmap, | 201 const SkBitmap& bitmap, |
| 202 const GURL& url, | 202 const GURL& url, |
| 203 bool* is_generated) { | 203 bool* is_generated) { |
| 204 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 204 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 205 | 205 |
| 206 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url, | 206 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url, |
| 207 is_generated); | 207 is_generated); |
| 208 } | 208 } |
| OLD | NEW |