OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 class KioskAppData : public base::SupportsWeakPtr<KioskAppData>, | 35 class KioskAppData : public base::SupportsWeakPtr<KioskAppData>, |
36 public extensions::WebstoreDataFetcherDelegate { | 36 public extensions::WebstoreDataFetcherDelegate { |
37 public: | 37 public: |
38 enum Status { | 38 enum Status { |
39 STATUS_INIT, // Data initialized with app id. | 39 STATUS_INIT, // Data initialized with app id. |
40 STATUS_LOADING, // Loading data from cache or web store. | 40 STATUS_LOADING, // Loading data from cache or web store. |
41 STATUS_LOADED, // Data loaded. | 41 STATUS_LOADED, // Data loaded. |
42 STATUS_ERROR, // Failed to load data. | 42 STATUS_ERROR, // Failed to load data. |
43 }; | 43 }; |
44 | 44 |
45 KioskAppData(KioskAppDataDelegate* delegate, const std::string& app_id); | 45 KioskAppData(KioskAppDataDelegate* delegate, |
| 46 const std::string& app_id, |
| 47 const std::string& user_id); |
46 virtual ~KioskAppData(); | 48 virtual ~KioskAppData(); |
47 | 49 |
48 // Loads app data from cache. If there is no cached data, fetches it | 50 // Loads app data from cache. If there is no cached data, fetches it |
49 // from web store. | 51 // from web store. |
50 void Load(); | 52 void Load(); |
51 | 53 |
52 // Clears locally cached data. | 54 // Clears locally cached data. |
53 void ClearCache(); | 55 void ClearCache(); |
54 | 56 |
55 // Returns true if web store data fetching is in progress. | 57 // Returns true if web store data fetching is in progress. |
56 bool IsLoading() const; | 58 bool IsLoading() const; |
57 | 59 |
58 const std::string& id() const { return id_; } | 60 const std::string& app_id() const { return app_id_; } |
| 61 const std::string& user_id() const { return user_id_; } |
59 const std::string& name() const { return name_; } | 62 const std::string& name() const { return name_; } |
60 const gfx::ImageSkia& icon() const { return icon_; } | 63 const gfx::ImageSkia& icon() const { return icon_; } |
61 const base::RefCountedString* raw_icon() const { | 64 const base::RefCountedString* raw_icon() const { |
62 return raw_icon_.get(); | 65 return raw_icon_.get(); |
63 } | 66 } |
64 Status status() const { return status_; } | 67 Status status() const { return status_; } |
65 | 68 |
66 private: | 69 private: |
67 class IconLoader; | 70 class IconLoader; |
68 class WebstoreDataParser; | 71 class WebstoreDataParser; |
(...skipping 24 matching lines...) Expand all Loading... |
93 // extensions::WebstoreDataFetcherDelegate overrides: | 96 // extensions::WebstoreDataFetcherDelegate overrides: |
94 virtual void OnWebstoreRequestFailure() OVERRIDE; | 97 virtual void OnWebstoreRequestFailure() OVERRIDE; |
95 virtual void OnWebstoreResponseParseSuccess( | 98 virtual void OnWebstoreResponseParseSuccess( |
96 base::DictionaryValue* webstore_data) OVERRIDE; | 99 base::DictionaryValue* webstore_data) OVERRIDE; |
97 virtual void OnWebstoreResponseParseFailure( | 100 virtual void OnWebstoreResponseParseFailure( |
98 const std::string& error) OVERRIDE; | 101 const std::string& error) OVERRIDE; |
99 | 102 |
100 KioskAppDataDelegate* delegate_; // not owned. | 103 KioskAppDataDelegate* delegate_; // not owned. |
101 Status status_; | 104 Status status_; |
102 | 105 |
103 std::string id_; | 106 std::string app_id_; |
| 107 std::string user_id_; |
104 std::string name_; | 108 std::string name_; |
105 gfx::ImageSkia icon_; | 109 gfx::ImageSkia icon_; |
106 scoped_refptr<base::RefCountedString> raw_icon_; | 110 scoped_refptr<base::RefCountedString> raw_icon_; |
107 | 111 |
108 scoped_ptr<extensions::WebstoreDataFetcher> webstore_fetcher_; | 112 scoped_ptr<extensions::WebstoreDataFetcher> webstore_fetcher_; |
109 base::FilePath icon_path_; | 113 base::FilePath icon_path_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(KioskAppData); | 115 DISALLOW_COPY_AND_ASSIGN(KioskAppData); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace chromeos | 118 } // namespace chromeos |
115 | 119 |
116 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ | 120 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ |
OLD | NEW |