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

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: xiyuan@ 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
(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 <memory>
9 #include <string>
10
11 #include "base/files/file_path.h"
12 #include "chrome/browser/chromeos/app_mode/kiosk_app_icon_loader.h"
13 #include "components/prefs/scoped_user_pref_update.h"
14 #include "components/signin/core/account_id/account_id.h"
15 #include "ui/gfx/image/image_skia.h"
16
17 namespace base {
18 class DictionaryValue;
19 }
20
21 namespace chromeos {
22
23 class KioskAppDataBase : public KioskAppIconLoader::Delegate {
Luis Héctor Chávez 2017/04/03 22:58:55 nit: KioskAppDatabase. (I could not find any other
Sergey Poromov 2017/04/06 10:29:58 This is really Base class for KioskAppData classes
Luis Héctor Chávez 2017/04/06 16:16:49 D'Oh. Sorry for the noise.
24 public:
25 // Dictionary key for apps.
26 static const char kKeyApps[];
27
28 const std::string& dictionary_name() const { return dictionary_name_; }
29 const std::string& app_id() const { return app_id_; }
30 const AccountId& account_id() const { return account_id_; }
31 const std::string& name() const { return name_; }
32 const gfx::ImageSkia& icon() const { return icon_; }
33
34 // Callbacks for KioskAppIconLoader.
35 void OnIconLoadSuccess(const gfx::ImageSkia& icon) override = 0;
36 void OnIconLoadFailure() override = 0;
37
38 // Clears locally cached data.
39 void ClearCache();
40
41 protected:
42 KioskAppDataBase(const std::string& dictionary_name,
43 const std::string& app_id,
44 const AccountId& account_id);
45 ~KioskAppDataBase() override;
46
47 // Helper to save name and icon to provided dictionary.
48 void SaveToDictionary(DictionaryPrefUpdate& dict_update);
49
50 // Helper to load name and icon from provided dictionary.
51 bool LoadFromDictionary(const base::DictionaryValue& dict);
52
53 // Helper to cache |icon| to |cache_dir|.
54 void SaveIcon(const SkBitmap& icon, const base::FilePath& cache_dir);
55
56 // In protected section to allow derived classes to modify.
57 std::string name_;
58 gfx::ImageSkia icon_;
59
60 // Should be released when callbacks are called.
61 std::unique_ptr<KioskAppIconLoader> kiosk_app_icon_loader_;
62
63 private:
64 // Name of a dictionary that holds kiosk app info in Local State.
65 const std::string dictionary_name_;
66
67 const std::string app_id_;
68 const AccountId account_id_;
69
70 base::FilePath icon_path_;
71
72 DISALLOW_COPY_AND_ASSIGN(KioskAppDataBase);
73 };
74
75 } // namespace chromeos
76
77 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698