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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h" | 14 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h" |
15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
| 16 #include "url/gurl.h" |
16 | 17 |
17 class Profile; | 18 class Profile; |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class RefCountedString; | 21 class RefCountedString; |
21 } | 22 } |
22 | 23 |
23 namespace extensions { | 24 namespace extensions { |
24 class Extension; | 25 class Extension; |
25 class WebstoreDataFetcher; | 26 class WebstoreDataFetcher; |
(...skipping 18 matching lines...) Expand all Loading... |
44 public: | 45 public: |
45 enum Status { | 46 enum Status { |
46 STATUS_INIT, // Data initialized with app id. | 47 STATUS_INIT, // Data initialized with app id. |
47 STATUS_LOADING, // Loading data from cache or web store. | 48 STATUS_LOADING, // Loading data from cache or web store. |
48 STATUS_LOADED, // Data loaded. | 49 STATUS_LOADED, // Data loaded. |
49 STATUS_ERROR, // Failed to load data. | 50 STATUS_ERROR, // Failed to load data. |
50 }; | 51 }; |
51 | 52 |
52 KioskAppData(KioskAppDataDelegate* delegate, | 53 KioskAppData(KioskAppDataDelegate* delegate, |
53 const std::string& app_id, | 54 const std::string& app_id, |
54 const std::string& user_id); | 55 const std::string& user_id, |
| 56 const GURL& update_url); |
55 virtual ~KioskAppData(); | 57 virtual ~KioskAppData(); |
56 | 58 |
57 // Loads app data from cache. If there is no cached data, fetches it | 59 // Loads app data from cache. If there is no cached data, fetches it |
58 // from web store. | 60 // from web store. |
59 void Load(); | 61 void Load(); |
60 | 62 |
61 // Clears locally cached data. | 63 // Clears locally cached data. |
62 void ClearCache(); | 64 void ClearCache(); |
63 | 65 |
64 // Loads app data from the app installed in the given profile. | 66 // Loads app data from the app installed in the given profile. |
65 void LoadFromInstalledApp(Profile* profile, const extensions::Extension* app); | 67 void LoadFromInstalledApp(Profile* profile, const extensions::Extension* app); |
66 | 68 |
67 // Returns true if web store data fetching is in progress. | 69 // Returns true if web store data fetching is in progress. |
68 bool IsLoading() const; | 70 bool IsLoading() const; |
69 | 71 |
70 const std::string& app_id() const { return app_id_; } | 72 const std::string& app_id() const { return app_id_; } |
71 const std::string& user_id() const { return user_id_; } | 73 const std::string& user_id() const { return user_id_; } |
72 const std::string& name() const { return name_; } | 74 const std::string& name() const { return name_; } |
| 75 const GURL& update_url() const { return update_url_; } |
73 const gfx::ImageSkia& icon() const { return icon_; } | 76 const gfx::ImageSkia& icon() const { return icon_; } |
74 const base::RefCountedString* raw_icon() const { | 77 const base::RefCountedString* raw_icon() const { |
75 return raw_icon_.get(); | 78 return raw_icon_.get(); |
76 } | 79 } |
77 Status status() const { return status_; } | 80 Status status() const { return status_; } |
78 | 81 |
79 private: | 82 private: |
80 class IconLoader; | 83 class IconLoader; |
81 class WebstoreDataParser; | 84 class WebstoreDataParser; |
82 | 85 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 bool CheckResponseKeyValue(const base::DictionaryValue* response, | 125 bool CheckResponseKeyValue(const base::DictionaryValue* response, |
123 const char* key, | 126 const char* key, |
124 std::string* value); | 127 std::string* value); |
125 | 128 |
126 KioskAppDataDelegate* delegate_; // not owned. | 129 KioskAppDataDelegate* delegate_; // not owned. |
127 Status status_; | 130 Status status_; |
128 | 131 |
129 std::string app_id_; | 132 std::string app_id_; |
130 std::string user_id_; | 133 std::string user_id_; |
131 std::string name_; | 134 std::string name_; |
| 135 GURL update_url_; |
132 gfx::ImageSkia icon_; | 136 gfx::ImageSkia icon_; |
133 scoped_refptr<base::RefCountedString> raw_icon_; | 137 scoped_refptr<base::RefCountedString> raw_icon_; |
134 | 138 |
135 scoped_ptr<extensions::WebstoreDataFetcher> webstore_fetcher_; | 139 scoped_ptr<extensions::WebstoreDataFetcher> webstore_fetcher_; |
136 base::FilePath icon_path_; | 140 base::FilePath icon_path_; |
137 | 141 |
138 DISALLOW_COPY_AND_ASSIGN(KioskAppData); | 142 DISALLOW_COPY_AND_ASSIGN(KioskAppData); |
139 }; | 143 }; |
140 | 144 |
141 } // namespace chromeos | 145 } // namespace chromeos |
142 | 146 |
143 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ | 147 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ |
OLD | NEW |