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

Unified Diff: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_data.h

Issue 2778053002: Fetch ARC Kiosk app name and icon from Android side. (Closed)
Patch Set: cleanup KioskAppIconLoader Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_data.h
diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_data.h b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..fe8767badc1148ef877570e64c4fb904fed8f406
--- /dev/null
+++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_data.h
@@ -0,0 +1,60 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_DATA_H_
+#define CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_DATA_H_
+
+#include <string>
+
+#include "base/files/file_path.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/app_mode/kiosk_app_icon_loader.h"
+#include "components/signin/core/account_id/account_id.h"
+#include "ui/gfx/image/image_skia.h"
+
+namespace chromeos {
+
+// Fetches from Android side and caches ARC kiosk app data such as name and
+// icon.
+class ArcKioskAppData : public base::SupportsWeakPtr<ArcKioskAppData>,
+ public KioskAppIconLoader::Delegate {
+ public:
+ ArcKioskAppData(const std::string& app_id,
+ const AccountId& account_id,
+ const std::string& name);
+ ~ArcKioskAppData() override;
+
+ bool operator==(const std::string& app_id) const;
+
+ const std::string& app_id() const { return app_id_; }
+ const AccountId& account_id() const { return account_id_; }
+ const std::string& name() const { return name_; }
+ const gfx::ImageSkia& icon() const { return icon_; }
+
+ bool LoadFromCache();
+ void SetCache(const std::string& name, const gfx::ImageSkia& icon);
+ void ClearCache();
+
+ // Callbacks for KioskAppIconLoader.
+ void OnIconLoadSuccess(const gfx::ImageSkia& icon) override;
+ void OnIconLoadFailure() override;
+
+ private:
+ class IconLoader;
+
+ // TODO(poromov@): Use appropriate app id http://crbug.com/665904
+ // Currently app_id is always package_name.
+ std::string app_id_;
+ 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.
+ std::string name_;
+ gfx::ImageSkia icon_;
+
+ base::FilePath icon_path_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcKioskAppData);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_DATA_H_

Powered by Google App Engine
This is Rietveld 408576698