| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 void WebstoreInstallHelper::OnDecodeImageFailed() { | 144 void WebstoreInstallHelper::OnDecodeImageFailed() { |
| 145 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 145 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 146 icon_decode_complete_ = true; | 146 icon_decode_complete_ = true; |
| 147 error_ = kImageDecodeError; | 147 error_ = kImageDecodeError; |
| 148 parse_error_ = Delegate::ICON_ERROR; | 148 parse_error_ = Delegate::ICON_ERROR; |
| 149 ReportResultsIfComplete(); | 149 ReportResultsIfComplete(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void WebstoreInstallHelper::OnJSONParseSucceeded(const ListValue& wrapper) { | 152 void WebstoreInstallHelper::OnJSONParseSucceeded( |
| 153 const base::ListValue& wrapper) { |
| 153 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 154 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 154 manifest_parse_complete_ = true; | 155 manifest_parse_complete_ = true; |
| 155 const Value* value = NULL; | 156 const Value* value = NULL; |
| 156 CHECK(wrapper.Get(0, &value)); | 157 CHECK(wrapper.Get(0, &value)); |
| 157 if (value->IsType(Value::TYPE_DICTIONARY)) { | 158 if (value->IsType(Value::TYPE_DICTIONARY)) { |
| 158 parsed_manifest_.reset( | 159 parsed_manifest_.reset( |
| 159 static_cast<const DictionaryValue*>(value)->DeepCopy()); | 160 static_cast<const DictionaryValue*>(value)->DeepCopy()); |
| 160 } else { | 161 } else { |
| 161 parse_error_ = Delegate::MANIFEST_ERROR; | 162 parse_error_ = Delegate::MANIFEST_ERROR; |
| 162 } | 163 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 192 | 193 |
| 193 void WebstoreInstallHelper::ReportResultFromUIThread() { | 194 void WebstoreInstallHelper::ReportResultFromUIThread() { |
| 194 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 195 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 195 if (error_.empty() && parsed_manifest_) | 196 if (error_.empty() && parsed_manifest_) |
| 196 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); | 197 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); |
| 197 else | 198 else |
| 198 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); | 199 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace extensions | 202 } // namespace extensions |
| OLD | NEW |