Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/browser/android/webapk/webapk_install_service.cc

Issue 2676863002: Update WebApkInstaller to support badge icon in installation. (Closed)
Patch Set: addressing comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 11
12 // static 12 // static
13 WebApkInstallService* WebApkInstallService::Get( 13 WebApkInstallService* WebApkInstallService::Get(
14 content::BrowserContext* context) { 14 content::BrowserContext* context) {
15 return WebApkInstallServiceFactory::GetForBrowserContext(context); 15 return WebApkInstallServiceFactory::GetForBrowserContext(context);
16 } 16 }
17 17
18 WebApkInstallService::WebApkInstallService( 18 WebApkInstallService::WebApkInstallService(
19 content::BrowserContext* browser_context) 19 content::BrowserContext* browser_context)
20 : browser_context_(browser_context), 20 : browser_context_(browser_context),
21 weak_ptr_factory_(this) {} 21 weak_ptr_factory_(this) {}
22 22
23 WebApkInstallService::~WebApkInstallService() {} 23 WebApkInstallService::~WebApkInstallService() {}
24 24
25 bool WebApkInstallService::IsInstallInProgress(const GURL& web_manifest_url) { 25 bool WebApkInstallService::IsInstallInProgress(const GURL& web_manifest_url) {
26 return installs_.count(web_manifest_url); 26 return installs_.count(web_manifest_url);
27 } 27 }
28 28
29 void WebApkInstallService::InstallAsync(const ShortcutInfo& shortcut_info, 29 void WebApkInstallService::InstallAsync(const ShortcutInfo& shortcut_info,
30 const SkBitmap& shortcut_icon, 30 const SkBitmap& primary_icon,
31 const SkBitmap& badge_icon,
31 const FinishCallback& finish_callback) { 32 const FinishCallback& finish_callback) {
32 DCHECK(!IsInstallInProgress(shortcut_info.manifest_url)); 33 DCHECK(!IsInstallInProgress(shortcut_info.manifest_url));
33 34
34 installs_.insert(shortcut_info.manifest_url); 35 installs_.insert(shortcut_info.manifest_url);
35 36
36 WebApkInstaller::InstallAsync( 37 WebApkInstaller::InstallAsync(
37 browser_context_, shortcut_info, shortcut_icon, 38 browser_context_, shortcut_info, primary_icon, badge_icon,
38 base::Bind(&WebApkInstallService::OnFinishedInstall, 39 base::Bind(&WebApkInstallService::OnFinishedInstall,
39 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url, 40 weak_ptr_factory_.GetWeakPtr(), shortcut_info.manifest_url,
40 finish_callback)); 41 finish_callback));
41 } 42 }
42 43
43 void WebApkInstallService::UpdateAsync( 44 void WebApkInstallService::UpdateAsync(
44 const ShortcutInfo& shortcut_info, 45 const ShortcutInfo& shortcut_info,
45 const SkBitmap& shortcut_icon, 46 const SkBitmap& shortcut_icon,
46 const std::string& webapk_package, 47 const std::string& webapk_package,
47 int webapk_version, 48 int webapk_version,
(...skipping 14 matching lines...) Expand all
62 63
63 void WebApkInstallService::OnFinishedInstall( 64 void WebApkInstallService::OnFinishedInstall(
64 const GURL& web_manifest_url, 65 const GURL& web_manifest_url,
65 const FinishCallback& finish_callback, 66 const FinishCallback& finish_callback,
66 WebApkInstallResult result, 67 WebApkInstallResult result,
67 bool relax_updates, 68 bool relax_updates,
68 const std::string& webapk_package_name) { 69 const std::string& webapk_package_name) {
69 finish_callback.Run(result, relax_updates, webapk_package_name); 70 finish_callback.Run(result, relax_updates, webapk_package_name);
70 installs_.erase(web_manifest_url); 71 installs_.erase(web_manifest_url);
71 } 72 }
OLDNEW
« no previous file with comments | « chrome/browser/android/webapk/webapk_install_service.h ('k') | chrome/browser/android/webapk/webapk_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698