| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "content/browser/utility_process_host.h" | 9 #include "content/browser/utility_process_host.h" |
| 10 #include "content/public/common/url_fetcher_delegate.h" | 10 #include "content/public/common/url_fetcher_delegate.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 virtual ~WebstoreInstallHelper(); | 64 virtual ~WebstoreInstallHelper(); |
| 65 | 65 |
| 66 void StartWorkOnIOThread(); | 66 void StartWorkOnIOThread(); |
| 67 void StartFetchedImageDecode(); | 67 void StartFetchedImageDecode(); |
| 68 void ReportResultsIfComplete(); | 68 void ReportResultsIfComplete(); |
| 69 void ReportResultFromUIThread(); | 69 void ReportResultFromUIThread(); |
| 70 | 70 |
| 71 // Implementing the content::URLFetcherDelegate interface. | 71 // Implementing the content::URLFetcherDelegate interface. |
| 72 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 72 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| 73 | 73 |
| 74 // Implementing pieces of the UtilityProcessHost::Client interface. | 74 // Implementing pieces of the UtilityProcessHost::Client interface. |
| 75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 76 | 76 |
| 77 // Message handlers. | 77 // Message handlers. |
| 78 void OnDecodeImageSucceeded(const SkBitmap& decoded_image); | 78 void OnDecodeImageSucceeded(const SkBitmap& decoded_image); |
| 79 void OnDecodeImageFailed(); | 79 void OnDecodeImageFailed(); |
| 80 void OnJSONParseSucceeded(const base::ListValue& wrapper); | 80 void OnJSONParseSucceeded(const base::ListValue& wrapper); |
| 81 void OnJSONParseFailed(const std::string& error_message); | 81 void OnJSONParseFailed(const std::string& error_message); |
| 82 | 82 |
| 83 // The client who we'll report results back to. | 83 // The client who we'll report results back to. |
| 84 Delegate* delegate_; | 84 Delegate* delegate_; |
| 85 | 85 |
| 86 // The manifest to parse. | 86 // The manifest to parse. |
| 87 std::string manifest_; | 87 std::string manifest_; |
| 88 | 88 |
| 89 // Only one of these should be non-empty. If |icon_base64_data_| is non-emtpy, | 89 // Only one of these should be non-empty. If |icon_base64_data_| is non-emtpy, |
| 90 // it's a base64-encoded string that needs to be parsed into an SkBitmap. If | 90 // it's a base64-encoded string that needs to be parsed into an SkBitmap. If |
| 91 // |icon_url_| is non-empty, it needs to be fetched and decoded into an | 91 // |icon_url_| is non-empty, it needs to be fetched and decoded into an |
| 92 // SkBitmap. | 92 // SkBitmap. |
| 93 std::string icon_base64_data_; | 93 std::string icon_base64_data_; |
| 94 GURL icon_url_; | 94 GURL icon_url_; |
| 95 std::vector<unsigned char> fetched_icon_data_; | 95 std::vector<unsigned char> fetched_icon_data_; |
| 96 | 96 |
| 97 // For fetching the icon, if needed. | 97 // For fetching the icon, if needed. |
| 98 scoped_ptr<URLFetcher> url_fetcher_; | 98 scoped_ptr<content::URLFetcher> url_fetcher_; |
| 99 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. | 99 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. |
| 100 | 100 |
| 101 UtilityProcessHost* utility_host_; | 101 UtilityProcessHost* utility_host_; |
| 102 | 102 |
| 103 // Flags for whether we're done doing icon decoding and manifest parsing. | 103 // Flags for whether we're done doing icon decoding and manifest parsing. |
| 104 bool icon_decode_complete_; | 104 bool icon_decode_complete_; |
| 105 bool manifest_parse_complete_; | 105 bool manifest_parse_complete_; |
| 106 | 106 |
| 107 // The results of succesful decoding/parsing. | 107 // The results of succesful decoding/parsing. |
| 108 SkBitmap icon_; | 108 SkBitmap icon_; |
| 109 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 109 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
| 110 | 110 |
| 111 // A details string for keeping track of any errors. | 111 // A details string for keeping track of any errors. |
| 112 std::string error_; | 112 std::string error_; |
| 113 | 113 |
| 114 // A code to distinguish between an error with the icon, and an error with the | 114 // A code to distinguish between an error with the icon, and an error with the |
| 115 // manifest. | 115 // manifest. |
| 116 Delegate::InstallHelperResultCode parse_error_; | 116 Delegate::InstallHelperResultCode parse_error_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ | 119 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ |
| OLD | NEW |