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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.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 { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 const GURL& icon_url, | 72 const GURL& icon_url, |
73 net::URLRequestContextGetter* context_getter); | 73 net::URLRequestContextGetter* context_getter); |
74 void Start(); | 74 void Start(); |
75 | 75 |
76 private: | 76 private: |
77 friend class base::RefCounted<WebstoreInstallHelper>; | 77 friend class base::RefCounted<WebstoreInstallHelper>; |
78 | 78 |
79 ~WebstoreInstallHelper() override; | 79 ~WebstoreInstallHelper() override; |
80 | 80 |
81 // Callbacks for the SafeJsonParser. | 81 // Callbacks for the SafeJsonParser. |
82 void OnJSONParseSucceeded(scoped_ptr<base::Value> result); | 82 void OnJSONParseSucceeded(std::unique_ptr<base::Value> result); |
83 void OnJSONParseFailed(const std::string& error_message); | 83 void OnJSONParseFailed(const std::string& error_message); |
84 | 84 |
85 // Implementing the chrome::BitmapFetcherDelegate interface. | 85 // Implementing the chrome::BitmapFetcherDelegate interface. |
86 void OnFetchComplete(const GURL& url, const SkBitmap* image) override; | 86 void OnFetchComplete(const GURL& url, const SkBitmap* image) override; |
87 | 87 |
88 void ReportResultsIfComplete(); | 88 void ReportResultsIfComplete(); |
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 // If |icon_url_| is non-empty, it needs to be fetched and decoded into an | 99 // If |icon_url_| is non-empty, it needs to be fetched and decoded into an |
100 // SkBitmap. | 100 // SkBitmap. |
101 GURL icon_url_; | 101 GURL icon_url_; |
102 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. | 102 net::URLRequestContextGetter* context_getter_; // Only usable on UI thread. |
103 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; | 103 std::unique_ptr<chrome::BitmapFetcher> icon_fetcher_; |
104 | 104 |
105 // Flags for whether we're done doing icon decoding and manifest parsing. | 105 // Flags for whether we're done doing icon decoding and manifest parsing. |
106 bool icon_decode_complete_; | 106 bool icon_decode_complete_; |
107 bool manifest_parse_complete_; | 107 bool manifest_parse_complete_; |
108 | 108 |
109 // The results of successful decoding/parsing. | 109 // The results of successful decoding/parsing. |
110 SkBitmap icon_; | 110 SkBitmap icon_; |
111 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 111 std::unique_ptr<base::DictionaryValue> parsed_manifest_; |
112 | 112 |
113 // A details string for keeping track of any errors. | 113 // A details string for keeping track of any errors. |
114 std::string error_; | 114 std::string error_; |
115 | 115 |
116 // A code to distinguish between an error with the icon, and an error with the | 116 // A code to distinguish between an error with the icon, and an error with the |
117 // manifest. | 117 // manifest. |
118 Delegate::InstallHelperResultCode parse_error_; | 118 Delegate::InstallHelperResultCode parse_error_; |
119 }; | 119 }; |
120 | 120 |
121 } // namespace extensions | 121 } // namespace extensions |
122 | 122 |
123 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ | 123 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ |
OLD | NEW |