Index: chrome/browser/extensions/webstore_install_helper.h |
diff --git a/chrome/browser/extensions/webstore_install_helper.h b/chrome/browser/extensions/webstore_install_helper.h |
index 08debed102e4b3eb4a076b947cdc2e0f252c9ce5..0a24af1d4817a3edbe25a5f290d6ae2f90129803 100644 |
--- a/chrome/browser/extensions/webstore_install_helper.h |
+++ b/chrome/browser/extensions/webstore_install_helper.h |
@@ -5,39 +5,36 @@ |
#ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ |
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ |
-#include <vector> |
+#include <string> |
+#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
-#include "base/memory/weak_ptr.h" |
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" |
-#include "content/public/browser/utility_process_host_client.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
#include "url/gurl.h" |
namespace base { |
class DictionaryValue; |
-class ListValue; |
+class Value; |
} |
namespace chrome { |
class BitmapFetcher; |
} |
-namespace content { |
-class UtilityProcessHost; |
-} |
- |
namespace net { |
class URLRequestContextGetter; |
} |
+class SafeJsonParser; |
+ |
namespace extensions { |
// This is a class to help dealing with webstore-provided data. It manages |
// sending work to the utility process for parsing manifests and |
// fetching/decoding icon data. Clients must implement the |
// WebstoreInstallHelper::Delegate interface to receive the parsed data. |
-class WebstoreInstallHelper : public content::UtilityProcessHostClient, |
+class WebstoreInstallHelper : public base::RefCounted<WebstoreInstallHelper>, |
public chrome::BitmapFetcherDelegate { |
public: |
class Delegate { |
@@ -75,22 +72,19 @@ class WebstoreInstallHelper : public content::UtilityProcessHostClient, |
void Start(); |
private: |
- ~WebstoreInstallHelper() override; |
- |
- void StartWorkOnIOThread(); |
- void ReportResultsIfComplete(); |
- void ReportResultFromUIThread(); |
+ friend class base::RefCounted<WebstoreInstallHelper>; |
- // Implementing pieces of the UtilityProcessHostClient interface. |
- bool OnMessageReceived(const IPC::Message& message) override; |
+ ~WebstoreInstallHelper() override; |
- // Message handlers. |
- void OnJSONParseSucceeded(const base::ListValue& wrapper); |
+ // Callbacks for the SafeJsonParser. |
+ void OnJSONParseSucceeded(scoped_ptr<base::Value> result); |
void OnJSONParseFailed(const std::string& error_message); |
// Implementing the chrome::BitmapFetcherDelegate interface. |
void OnFetchComplete(const GURL& url, const SkBitmap* image) override; |
+ void ReportResultsIfComplete(); |
+ |
// The client who we'll report results back to. |
Delegate* delegate_; |
@@ -100,14 +94,14 @@ class WebstoreInstallHelper : public content::UtilityProcessHostClient, |
// The manifest to parse. |
std::string manifest_; |
+ scoped_refptr<SafeJsonParser> json_parser_; |
+ |
// If |icon_url_| is non-empty, it needs to be fetched and decoded into an |
// SkBitmap. |
GURL icon_url_; |
net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. |
scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; |
- base::WeakPtr<content::UtilityProcessHost> utility_host_; |
- |
// Flags for whether we're done doing icon decoding and manifest parsing. |
bool icon_decode_complete_; |
bool manifest_parse_complete_; |