| 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 "base/files/file_path.h" |
| 8 #include "chrome/browser/android/shortcut_info.h" | 9 #include "chrome/browser/android/shortcut_info.h" |
| 9 #include "chrome/browser/android/webapk/webapk_install_service_factory.h" | 10 #include "chrome/browser/android/webapk/webapk_install_service_factory.h" |
| 10 #include "chrome/browser/android/webapk/webapk_installer.h" | 11 #include "chrome/browser/android/webapk/webapk_installer.h" |
| 11 | 12 |
| 12 // static | 13 // static |
| 13 WebApkInstallService* WebApkInstallService::Get( | 14 WebApkInstallService* WebApkInstallService::Get( |
| 14 content::BrowserContext* context) { | 15 content::BrowserContext* context) { |
| 15 return WebApkInstallServiceFactory::GetForBrowserContext(context); | 16 return WebApkInstallServiceFactory::GetForBrowserContext(context); |
| 16 } | 17 } |
| 17 | 18 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 installs_.insert(shortcut_info.manifest_url); | 36 installs_.insert(shortcut_info.manifest_url); |
| 36 | 37 |
| 37 WebApkInstaller::InstallAsync( | 38 WebApkInstaller::InstallAsync( |
| 38 browser_context_, shortcut_info, primary_icon, badge_icon, | 39 browser_context_, shortcut_info, primary_icon, badge_icon, |
| 39 base::Bind(&WebApkInstallService::OnFinishedInstall, | 40 base::Bind(&WebApkInstallService::OnFinishedInstall, |
| 40 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url, | 41 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url, |
| 41 finish_callback)); | 42 finish_callback)); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void WebApkInstallService::UpdateAsync( | 45 void WebApkInstallService::UpdateAsync( |
| 45 const std::string& webapk_package, | 46 const base::FilePath& update_request_file, |
| 46 const GURL& start_url, | |
| 47 const base::string16& short_name, | |
| 48 std::unique_ptr<std::vector<uint8_t>> serialized_proto, | |
| 49 const FinishCallback& finish_callback) { | 47 const FinishCallback& finish_callback) { |
| 50 WebApkInstaller::UpdateAsync(browser_context_, webapk_package, start_url, | 48 WebApkInstaller::UpdateAsync(browser_context_, update_request_file, |
| 51 short_name, std::move(serialized_proto), | |
| 52 finish_callback); | 49 finish_callback); |
| 53 } | 50 } |
| 54 | 51 |
| 55 void WebApkInstallService::OnFinishedInstall( | 52 void WebApkInstallService::OnFinishedInstall( |
| 56 const GURL& web_manifest_url, | 53 const GURL& web_manifest_url, |
| 57 const FinishCallback& finish_callback, | 54 const FinishCallback& finish_callback, |
| 58 WebApkInstallResult result, | 55 WebApkInstallResult result, |
| 59 bool relax_updates, | 56 bool relax_updates, |
| 60 const std::string& webapk_package_name) { | 57 const std::string& webapk_package_name) { |
| 61 finish_callback.Run(result, relax_updates, webapk_package_name); | 58 finish_callback.Run(result, relax_updates, webapk_package_name); |
| 62 installs_.erase(web_manifest_url); | 59 installs_.erase(web_manifest_url); |
| 63 } | 60 } |
| OLD | NEW |