Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_ARC_ARC_KIOSK_APP_DATA_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_DATA_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/files/file_path.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_icon_loader.h" | |
| 13 #include "components/signin/core/account_id/account_id.h" | |
| 14 #include "ui/gfx/image/image_skia.h" | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 // Fetches from Android side and caches ARC kiosk app data such as name and | |
| 19 // icon. | |
| 20 class ArcKioskAppData : public base::SupportsWeakPtr<ArcKioskAppData>, | |
| 21 public KioskAppIconLoader::Delegate { | |
| 22 public: | |
| 23 ArcKioskAppData(const std::string& app_id, | |
| 24 const AccountId& account_id, | |
| 25 const std::string& name); | |
| 26 ~ArcKioskAppData() override; | |
| 27 | |
| 28 bool operator==(const std::string& app_id) const; | |
| 29 | |
| 30 const std::string& app_id() const { return app_id_; } | |
| 31 const AccountId& account_id() const { return account_id_; } | |
| 32 const std::string& name() const { return name_; } | |
| 33 const gfx::ImageSkia& icon() const { return icon_; } | |
| 34 | |
| 35 bool LoadFromCache(); | |
| 36 void SetCache(const std::string& name, const gfx::ImageSkia& icon); | |
| 37 void ClearCache(); | |
| 38 | |
| 39 // Callbacks for KioskAppIconLoader. | |
| 40 void OnIconLoadSuccess(const gfx::ImageSkia& icon) override; | |
| 41 void OnIconLoadFailure() override; | |
| 42 | |
| 43 private: | |
| 44 class IconLoader; | |
| 45 | |
| 46 // TODO(poromov@): Use appropriate app id http://crbug.com/665904 | |
| 47 // Currently app_id is always package_name. | |
| 48 std::string app_id_; | |
| 49 AccountId account_id_; | |
|
khmel
2017/03/29 17:51:22
nit: app_id_ and account_id_ are const.
Sergey Poromov
2017/03/30 15:48:36
Done.
| |
| 50 std::string name_; | |
| 51 gfx::ImageSkia icon_; | |
| 52 | |
| 53 base::FilePath icon_path_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppData); | |
| 56 }; | |
| 57 | |
| 58 } // namespace chromeos | |
| 59 | |
| 60 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_DATA_H_ | |
| OLD | NEW |