OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" | 12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 class Value; | 18 class Value; |
19 } | 19 } |
20 | 20 |
21 namespace chrome { | 21 namespace chrome { |
22 class BitmapFetcher; | 22 class BitmapFetcher; |
23 } | 23 } |
24 | 24 |
25 namespace net { | 25 namespace net { |
26 class URLRequestContextGetter; | 26 class URLRequestContextGetter; |
27 } | 27 } |
28 | 28 |
29 namespace safe_json_parser { | 29 namespace safe_json { |
30 class SafeJsonParser; | 30 class SafeJsonParser; |
31 } | 31 } |
32 | 32 |
33 namespace extensions { | 33 namespace extensions { |
34 | 34 |
35 // This is a class to help dealing with webstore-provided data. It manages | 35 // This is a class to help dealing with webstore-provided data. It manages |
36 // sending work to the utility process for parsing manifests and | 36 // sending work to the utility process for parsing manifests and |
37 // fetching/decoding icon data. Clients must implement the | 37 // fetching/decoding icon data. Clients must implement the |
38 // WebstoreInstallHelper::Delegate interface to receive the parsed data. | 38 // WebstoreInstallHelper::Delegate interface to receive the parsed data. |
39 class WebstoreInstallHelper : public base::RefCounted<WebstoreInstallHelper>, | 39 class WebstoreInstallHelper : public base::RefCounted<WebstoreInstallHelper>, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // The client who we'll report results back to. | 90 // The client who we'll report results back to. |
91 Delegate* delegate_; | 91 Delegate* delegate_; |
92 | 92 |
93 // The extension id of the manifest we're parsing. | 93 // The extension id of the manifest we're parsing. |
94 std::string id_; | 94 std::string id_; |
95 | 95 |
96 // The manifest to parse. | 96 // The manifest to parse. |
97 std::string manifest_; | 97 std::string manifest_; |
98 | 98 |
99 scoped_refptr<safe_json_parser::SafeJsonParser> json_parser_; | 99 scoped_refptr<safe_json::SafeJsonParser> json_parser_; |
100 | 100 |
101 // If |icon_url_| is non-empty, it needs to be fetched and decoded into an | 101 // If |icon_url_| is non-empty, it needs to be fetched and decoded into an |
102 // SkBitmap. | 102 // SkBitmap. |
103 GURL icon_url_; | 103 GURL icon_url_; |
104 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. | 104 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. |
105 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; | 105 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; |
106 | 106 |
107 // Flags for whether we're done doing icon decoding and manifest parsing. | 107 // Flags for whether we're done doing icon decoding and manifest parsing. |
108 bool icon_decode_complete_; | 108 bool icon_decode_complete_; |
109 bool manifest_parse_complete_; | 109 bool manifest_parse_complete_; |
110 | 110 |
111 // The results of successful decoding/parsing. | 111 // The results of successful decoding/parsing. |
112 SkBitmap icon_; | 112 SkBitmap icon_; |
113 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 113 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
114 | 114 |
115 // A details string for keeping track of any errors. | 115 // A details string for keeping track of any errors. |
116 std::string error_; | 116 std::string error_; |
117 | 117 |
118 // A code to distinguish between an error with the icon, and an error with the | 118 // A code to distinguish between an error with the icon, and an error with the |
119 // manifest. | 119 // manifest. |
120 Delegate::InstallHelperResultCode parse_error_; | 120 Delegate::InstallHelperResultCode parse_error_; |
121 }; | 121 }; |
122 | 122 |
123 } // namespace extensions | 123 } // namespace extensions |
124 | 124 |
125 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ | 125 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ |
OLD | NEW |