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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | |
dominickn
2017/06/14 00:14:23
#include <memory> for std::unique_ptr
| |
11 | 12 |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/strings/string16.h" | |
15 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
16 #include "url/gurl.h" | 18 #include "url/gurl.h" |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 class BrowserContext; | 21 class BrowserContext; |
20 } | 22 } |
21 | 23 |
22 struct ShortcutInfo; | 24 struct ShortcutInfo; |
23 class SkBitmap; | 25 class SkBitmap; |
24 | 26 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 // Talks to the Chrome WebAPK server to generate a WebAPK on the server and to | 59 // 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 | 60 // Google Play to install the downloaded WebAPK. Calls |callback| once the |
59 // install completed or failed. | 61 // install completed or failed. |
60 void InstallAsync(const ShortcutInfo& shortcut_info, | 62 void InstallAsync(const ShortcutInfo& shortcut_info, |
61 const SkBitmap& primary_icon, | 63 const SkBitmap& primary_icon, |
62 const SkBitmap& badge_icon, | 64 const SkBitmap& badge_icon, |
63 const FinishCallback& finish_callback); | 65 const FinishCallback& finish_callback); |
64 | 66 |
65 // 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 |
66 // the Google Play server to install the downloaded WebAPK. Calls |callback| | 68 // the Google Play server to install the downloaded WebAPK. Calls |callback| |
67 // after the request to install the WebAPK is sent to Google Play. | 69 // once the update completed or failed. |
68 void UpdateAsync( | 70 void UpdateAsync(const std::string& webapk_package, |
69 const ShortcutInfo& shortcut_info, | 71 const GURL& start_url, |
70 const SkBitmap& shortcut_icon, | 72 const base::string16& short_name, |
71 const std::string& webapk_package, | 73 std::unique_ptr<std::vector<uint8_t>> serialized_proto, |
72 int webapk_version, | 74 const FinishCallback& finish_callback); |
73 const std::map<std::string, std::string>& icon_url_to_murmur2_hash, | |
74 bool is_manifest_stale, | |
75 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 |