Chromium Code Reviews| 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..27d5033b00980da5df181c62d843ed4e41201e2e 100644 |
| --- a/chrome/browser/extensions/webstore_install_helper.h |
| +++ b/chrome/browser/extensions/webstore_install_helper.h |
| @@ -5,40 +5,38 @@ |
| #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, |
| - public chrome::BitmapFetcherDelegate { |
| +class WebstoreInstallHelper |
| + : public base::RefCountedThreadSafe<WebstoreInstallHelper>, |
|
Marc Treib
2015/05/28 10:03:49
Before, we inherited that via UtilityProcessHostCl
asargent_no_longer_on_chrome
2015/05/28 17:08:47
Agreed - feel free to switch to plain RefCounted.
Marc Treib
2015/05/29 07:48:49
Done.
|
| + public chrome::BitmapFetcherDelegate { |
| public: |
| class Delegate { |
| public: |
| @@ -75,22 +73,19 @@ class WebstoreInstallHelper : public content::UtilityProcessHostClient, |
| void Start(); |
| private: |
| - ~WebstoreInstallHelper() override; |
| - |
| - void StartWorkOnIOThread(); |
| - void ReportResultsIfComplete(); |
| - void ReportResultFromUIThread(); |
| + friend class base::RefCountedThreadSafe<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 +95,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_; |