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

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

Issue 2778053002: Fetch ARC Kiosk app name and icon from Android side. (Closed)
Patch Set: move weak_ptr from KioskAppDataBase to KioskAppIconLoader 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_DATA_BASE_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_BASE_H_
7
8 #include <string>
9
10 #include "base/files/file_path.h"
11 #include "chrome/browser/chromeos/app_mode/kiosk_app_icon_loader.h"
12 #include "components/prefs/scoped_user_pref_update.h"
13 #include "components/signin/core/account_id/account_id.h"
14 #include "ui/gfx/image/image_skia.h"
15
16 namespace base {
17 class DictionaryValue;
18 }
19
20 namespace chromeos {
21
22 class KioskAppDataBase : public KioskAppIconLoader::Delegate {
23 public:
24 // Dictionary key for apps.
25 static const char kKeyApps[];
26
27 const std::string& dictionary_name() const { return dictionary_name_; }
28 const std::string& app_id() const { return app_id_; }
29 const AccountId& account_id() const { return account_id_; }
30 const std::string& name() const { return name_; }
31 const gfx::ImageSkia& icon() const { return icon_; }
32
33 // Callbacks for KioskAppIconLoader.
34 void OnIconLoadSuccess(const gfx::ImageSkia& icon) override = 0;
35 void OnIconLoadFailure() override = 0;
36
37 // Clears locally cached data.
38 void ClearCache();
39
40 protected:
41 KioskAppDataBase(const std::string& dictionary_name,
42 const std::string& app_id,
43 const AccountId& account_id);
44 ~KioskAppDataBase() override;
45
46 // Helper to save name and icon to provided dictionary.
47 void SaveToDictionary(DictionaryPrefUpdate& dict_update);
48
49 // Helper to load name and icon from provided dictionary.
50 bool LoadFromDictionary(const base::DictionaryValue* dict);
xiyuan 2017/03/31 15:10:02 nit: prevailing style is to use & with const, i.e.
Sergey Poromov 2017/03/31 18:38:58 Done.
51
52 // Helper to cache |icon| to |cache_dir|.
53 void SaveIcon(const SkBitmap& icon, const base::FilePath& cache_dir);
54
55 std::string name_;
xiyuan 2017/03/31 15:10:02 nit: Put a comment about why these are in protecte
Sergey Poromov 2017/03/31 18:38:58 Done.
56 gfx::ImageSkia icon_;
57
58 // Should be released when callbacks are called.
59 std::unique_ptr<KioskAppIconLoader> kiosk_app_icon_loader_;
xiyuan 2017/03/31 15:10:02 nit: #include <memory>
Sergey Poromov 2017/03/31 18:38:58 Done.
60
61 private:
62 // Name of a dictionary that holds kiosk app info in Local State.
63 const std::string dictionary_name_;
64
65 const std::string app_id_;
66 const AccountId account_id_;
67
68 base::FilePath icon_path_;
69
70 DISALLOW_COPY_AND_ASSIGN(KioskAppDataBase);
71 };
72
73 } // namespace chromeos
74
75 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698