| 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 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALL_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALL_SERVICE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALL_SERVICE_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALL_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | |
| 13 | 12 |
| 14 #include "base/callback.h" | 13 #include "base/callback.h" |
| 15 #include "base/macros.h" | 14 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 17 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 18 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 19 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 class BrowserContext; | 21 class BrowserContext; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 const SkBitmap& primary_icon, | 63 const SkBitmap& primary_icon, |
| 65 const SkBitmap& badge_icon, | 64 const SkBitmap& badge_icon, |
| 66 const FinishCallback& finish_callback); | 65 const FinishCallback& finish_callback); |
| 67 | 66 |
| 68 // Talks to the Chrome WebAPK server to update a WebAPK on the server and to | 67 // Talks to the Chrome WebAPK server to update a WebAPK on the server and to |
| 69 // the Google Play server to install the downloaded WebAPK. Calls | 68 // the Google Play server to install the downloaded WebAPK. Calls |
| 70 // |finish_callback| once the update completed or failed. | 69 // |finish_callback| once the update completed or failed. |
| 71 void UpdateAsync(const std::string& webapk_package, | 70 void UpdateAsync(const std::string& webapk_package, |
| 72 const GURL& start_url, | 71 const GURL& start_url, |
| 73 const base::string16& short_name, | 72 const base::string16& short_name, |
| 74 std::unique_ptr<std::vector<uint8_t>> serialized_proto, | 73 std::unique_ptr<std::string> serialized_proto, |
| 75 const FinishCallback& finish_callback); | 74 const FinishCallback& finish_callback); |
| 76 | 75 |
| 77 private: | 76 private: |
| 78 // Called once the install/update completed or failed. | 77 // Called once the install/update completed or failed. |
| 79 void OnFinishedInstall(const GURL& web_manifest_url, | 78 void OnFinishedInstall(const GURL& web_manifest_url, |
| 80 const FinishCallback& finish_callback, | 79 const FinishCallback& finish_callback, |
| 81 WebApkInstallResult result, | 80 WebApkInstallResult result, |
| 82 bool relax_updates, | 81 bool relax_updates, |
| 83 const std::string& webapk_package_name); | 82 const std::string& webapk_package_name); |
| 84 | 83 |
| 85 content::BrowserContext* browser_context_; | 84 content::BrowserContext* browser_context_; |
| 86 | 85 |
| 87 // In progress installs. | 86 // In progress installs. |
| 88 std::set<GURL> installs_; | 87 std::set<GURL> installs_; |
| 89 | 88 |
| 90 // Used to get |weak_ptr_|. | 89 // Used to get |weak_ptr_|. |
| 91 base::WeakPtrFactory<WebApkInstallService> weak_ptr_factory_; | 90 base::WeakPtrFactory<WebApkInstallService> weak_ptr_factory_; |
| 92 | 91 |
| 93 DISALLOW_COPY_AND_ASSIGN(WebApkInstallService); | 92 DISALLOW_COPY_AND_ASSIGN(WebApkInstallService); |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALL_SERVICE_H_ | 95 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALL_SERVICE_H_ |
| OLD | NEW |