OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/webapk/webapk_install_service.h" | 5 #include "chrome/browser/android/webapk/webapk_install_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/android/shortcut_info.h" | 8 #include "chrome/browser/android/shortcut_info.h" |
9 #include "chrome/browser/android/webapk/webapk_install_service_factory.h" | 9 #include "chrome/browser/android/webapk/webapk_install_service_factory.h" |
10 #include "chrome/browser/android/webapk/webapk_installer.h" | 10 #include "chrome/browser/android/webapk/webapk_installer.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 WebApkInstaller::InstallAsync( | 37 WebApkInstaller::InstallAsync( |
38 browser_context_, shortcut_info, primary_icon, badge_icon, | 38 browser_context_, shortcut_info, primary_icon, badge_icon, |
39 base::Bind(&WebApkInstallService::OnFinishedInstall, | 39 base::Bind(&WebApkInstallService::OnFinishedInstall, |
40 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url, | 40 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url, |
41 finish_callback)); | 41 finish_callback)); |
42 } | 42 } |
43 | 43 |
44 void WebApkInstallService::UpdateAsync( | 44 void WebApkInstallService::UpdateAsync( |
45 const ShortcutInfo& shortcut_info, | 45 const ShortcutInfo& shortcut_info, |
46 const SkBitmap& shortcut_icon, | 46 const SkBitmap& primary_icon, |
| 47 const SkBitmap& badge_icon, |
47 const std::string& webapk_package, | 48 const std::string& webapk_package, |
48 int webapk_version, | 49 int webapk_version, |
49 const std::map<std::string, std::string>& icon_url_to_murmur2_hash, | 50 const std::map<std::string, std::string>& icon_url_to_murmur2_hash, |
50 bool is_manifest_stale, | 51 bool is_manifest_stale, |
51 const FinishCallback& finish_callback) { | 52 const FinishCallback& finish_callback) { |
52 DCHECK(!IsInstallInProgress(shortcut_info.manifest_url)); | 53 DCHECK(!IsInstallInProgress(shortcut_info.manifest_url)); |
53 | 54 |
54 installs_.insert(shortcut_info.manifest_url); | 55 installs_.insert(shortcut_info.manifest_url); |
55 | 56 |
56 WebApkInstaller::UpdateAsync( | 57 WebApkInstaller::UpdateAsync( |
57 browser_context_, shortcut_info, shortcut_icon, webapk_package, | 58 browser_context_, shortcut_info, primary_icon, badge_icon, webapk_package, |
58 webapk_version, icon_url_to_murmur2_hash, is_manifest_stale, | 59 webapk_version, icon_url_to_murmur2_hash, is_manifest_stale, |
59 base::Bind(&WebApkInstallService::OnFinishedInstall, | 60 base::Bind(&WebApkInstallService::OnFinishedInstall, |
60 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url, | 61 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url, |
61 finish_callback)); | 62 finish_callback)); |
62 } | 63 } |
63 | 64 |
64 void WebApkInstallService::OnFinishedInstall( | 65 void WebApkInstallService::OnFinishedInstall( |
65 const GURL& web_manifest_url, | 66 const GURL& web_manifest_url, |
66 const FinishCallback& finish_callback, | 67 const FinishCallback& finish_callback, |
67 WebApkInstallResult result, | 68 WebApkInstallResult result, |
68 bool relax_updates, | 69 bool relax_updates, |
69 const std::string& webapk_package_name) { | 70 const std::string& webapk_package_name) { |
70 finish_callback.Run(result, relax_updates, webapk_package_name); | 71 finish_callback.Run(result, relax_updates, webapk_package_name); |
71 installs_.erase(web_manifest_url); | 72 installs_.erase(web_manifest_url); |
72 } | 73 } |
OLD | NEW |