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 #include "chrome/browser/extensions/webstore_install_helper.h" | 5 #include "chrome/browser/extensions/webstore_install_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 icon_decode_complete_ = true; | 145 icon_decode_complete_ = true; |
146 error_ = kImageDecodeError; | 146 error_ = kImageDecodeError; |
147 parse_error_ = Delegate::ICON_ERROR; | 147 parse_error_ = Delegate::ICON_ERROR; |
148 ReportResultsIfComplete(); | 148 ReportResultsIfComplete(); |
149 } | 149 } |
150 | 150 |
151 void WebstoreInstallHelper::OnJSONParseSucceeded( | 151 void WebstoreInstallHelper::OnJSONParseSucceeded( |
152 const base::ListValue& wrapper) { | 152 const base::ListValue& wrapper) { |
153 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 153 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
154 manifest_parse_complete_ = true; | 154 manifest_parse_complete_ = true; |
155 const Value* value = NULL; | 155 const base::Value* value = NULL; |
156 CHECK(wrapper.Get(0, &value)); | 156 CHECK(wrapper.Get(0, &value)); |
157 if (value->IsType(Value::TYPE_DICTIONARY)) { | 157 if (value->IsType(base::Value::TYPE_DICTIONARY)) { |
158 parsed_manifest_.reset( | 158 parsed_manifest_.reset( |
159 static_cast<const DictionaryValue*>(value)->DeepCopy()); | 159 static_cast<const base::DictionaryValue*>(value)->DeepCopy()); |
160 } else { | 160 } else { |
161 parse_error_ = Delegate::MANIFEST_ERROR; | 161 parse_error_ = Delegate::MANIFEST_ERROR; |
162 } | 162 } |
163 ReportResultsIfComplete(); | 163 ReportResultsIfComplete(); |
164 } | 164 } |
165 | 165 |
166 void WebstoreInstallHelper::OnJSONParseFailed( | 166 void WebstoreInstallHelper::OnJSONParseFailed( |
167 const std::string& error_message) { | 167 const std::string& error_message) { |
168 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 168 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
169 manifest_parse_complete_ = true; | 169 manifest_parse_complete_ = true; |
(...skipping 22 matching lines...) Expand all Loading... |
192 | 192 |
193 void WebstoreInstallHelper::ReportResultFromUIThread() { | 193 void WebstoreInstallHelper::ReportResultFromUIThread() { |
194 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 194 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
195 if (error_.empty() && parsed_manifest_) | 195 if (error_.empty() && parsed_manifest_) |
196 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); | 196 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); |
197 else | 197 else |
198 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); | 198 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); |
199 } | 199 } |
200 | 200 |
201 } // namespace extensions | 201 } // namespace extensions |
OLD | NEW |