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