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

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_icon_loader.h

Issue 2778053002: Fetch ARC Kiosk app name and icon from Android side. (Closed)
Patch Set: fix tests. 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_ICON_LOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_ICON_LOADER_H_
7
8 #include "base/memory/ref_counted_memory.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/optional.h"
11 #include "base/sequenced_task_runner.h"
12 #include "ui/gfx/image/image_skia.h"
13
14 namespace base {
15 class FilePath;
16 }
17
18 namespace chromeos {
19
20 // Loads locally stored icon data and decodes it.
21 class KioskAppIconLoader {
22 public:
23 enum LoadResult {
24 SUCCESS,
25 FAILED_TO_LOAD,
26 FAILED_TO_DECODE,
27 };
28
29 class Delegate {
30 public:
31 virtual void OnIconLoadSuccess(const gfx::ImageSkia& icon) = 0;
32 virtual void OnIconLoadFailure() = 0;
33
34 protected:
35 virtual ~Delegate() = default;
36 };
37
38 typedef base::Callback<void(base::Optional<gfx::ImageSkia> result)>
Luis Héctor Chávez 2017/04/06 16:16:50 prefer using: using ResultCallback = base::Callba
Sergey Poromov 2017/04/07 02:09:38 Done.
39 ResultCallback;
40
41 explicit KioskAppIconLoader(Delegate* delegate);
42
43 ~KioskAppIconLoader();
44
45 void Start(const base::FilePath& icon_path);
46
47 private:
48 void OnImageDecodingFinished(base::Optional<gfx::ImageSkia> result);
49
50 // Delegate always live longer than this class as it's owned by delegate.
Luis Héctor Chávez 2017/04/06 16:16:50 nit: s/live/lives/
Sergey Poromov 2017/04/07 02:09:38 Done.
51 Delegate* const delegate_;
52
53 scoped_refptr<base::SequencedTaskRunner> task_runner_;
54
55 gfx::ImageSkia icon_;
56
57 base::WeakPtrFactory<KioskAppIconLoader> weak_factory_;
58
59 DISALLOW_COPY_AND_ASSIGN(KioskAppIconLoader);
60 };
61
62 } // namespace chromeos
63
64 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_ICON_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698