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

Side by Side Diff: chrome/browser/extensions/webstore_install_helper.h

Issue 1140053003: Refactoring: Moving the SafeJsonParser to its own component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Catching up with WebstoreInstallHelper changes Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 class SafeJsonParser; 30 class SafeJsonParser;
31 }
30 32
31 namespace extensions { 33 namespace extensions {
32 34
33 // 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
34 // sending work to the utility process for parsing manifests and 36 // sending work to the utility process for parsing manifests and
35 // fetching/decoding icon data. Clients must implement the 37 // fetching/decoding icon data. Clients must implement the
36 // WebstoreInstallHelper::Delegate interface to receive the parsed data. 38 // WebstoreInstallHelper::Delegate interface to receive the parsed data.
37 class WebstoreInstallHelper : public base::RefCounted<WebstoreInstallHelper>, 39 class WebstoreInstallHelper : public base::RefCounted<WebstoreInstallHelper>,
38 public chrome::BitmapFetcherDelegate { 40 public chrome::BitmapFetcherDelegate {
39 public: 41 public:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 89
88 // The client who we'll report results back to. 90 // The client who we'll report results back to.
89 Delegate* delegate_; 91 Delegate* delegate_;
90 92
91 // The extension id of the manifest we're parsing. 93 // The extension id of the manifest we're parsing.
92 std::string id_; 94 std::string id_;
93 95
94 // The manifest to parse. 96 // The manifest to parse.
95 std::string manifest_; 97 std::string manifest_;
96 98
97 scoped_refptr<SafeJsonParser> json_parser_; 99 scoped_refptr<safe_json_parser::SafeJsonParser> json_parser_;
98 100
99 // 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
100 // SkBitmap. 102 // SkBitmap.
101 GURL icon_url_; 103 GURL icon_url_;
102 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. 104 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread.
103 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; 105 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_;
104 106
105 // 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.
106 bool icon_decode_complete_; 108 bool icon_decode_complete_;
107 bool manifest_parse_complete_; 109 bool manifest_parse_complete_;
108 110
109 // The results of successful decoding/parsing. 111 // The results of successful decoding/parsing.
110 SkBitmap icon_; 112 SkBitmap icon_;
111 scoped_ptr<base::DictionaryValue> parsed_manifest_; 113 scoped_ptr<base::DictionaryValue> parsed_manifest_;
112 114
113 // A details string for keeping track of any errors. 115 // A details string for keeping track of any errors.
114 std::string error_; 116 std::string error_;
115 117
116 // 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
117 // manifest. 119 // manifest.
118 Delegate::InstallHelperResultCode parse_error_; 120 Delegate::InstallHelperResultCode parse_error_;
119 }; 121 };
120 122
121 } // namespace extensions 123 } // namespace extensions
122 124
123 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ 125 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_data_fetcher.cc ('k') | chrome/browser/extensions/webstore_install_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698