| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
| 10 #include "components/safe_json/safe_json_parser.h" | 10 #include "components/safe_json/safe_json_parser.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 error_ = kImageDecodeError; | 76 error_ = kImageDecodeError; |
| 77 parse_error_ = Delegate::ICON_ERROR; | 77 parse_error_ = Delegate::ICON_ERROR; |
| 78 } | 78 } |
| 79 icon_fetcher_.reset(); | 79 icon_fetcher_.reset(); |
| 80 | 80 |
| 81 ReportResultsIfComplete(); | 81 ReportResultsIfComplete(); |
| 82 Release(); // Balanced in Start(). | 82 Release(); // Balanced in Start(). |
| 83 } | 83 } |
| 84 | 84 |
| 85 void WebstoreInstallHelper::OnJSONParseSucceeded( | 85 void WebstoreInstallHelper::OnJSONParseSucceeded( |
| 86 scoped_ptr<base::Value> result) { | 86 std::unique_ptr<base::Value> result) { |
| 87 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 87 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 88 manifest_parse_complete_ = true; | 88 manifest_parse_complete_ = true; |
| 89 const base::DictionaryValue* value; | 89 const base::DictionaryValue* value; |
| 90 if (result->GetAsDictionary(&value)) | 90 if (result->GetAsDictionary(&value)) |
| 91 parsed_manifest_.reset(value->DeepCopy()); | 91 parsed_manifest_.reset(value->DeepCopy()); |
| 92 else | 92 else |
| 93 parse_error_ = Delegate::MANIFEST_ERROR; | 93 parse_error_ = Delegate::MANIFEST_ERROR; |
| 94 | 94 |
| 95 ReportResultsIfComplete(); | 95 ReportResultsIfComplete(); |
| 96 } | 96 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 110 if (!icon_decode_complete_ || !manifest_parse_complete_) | 110 if (!icon_decode_complete_ || !manifest_parse_complete_) |
| 111 return; | 111 return; |
| 112 | 112 |
| 113 if (error_.empty() && parsed_manifest_) | 113 if (error_.empty() && parsed_manifest_) |
| 114 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); | 114 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); |
| 115 else | 115 else |
| 116 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); | 116 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace extensions | 119 } // namespace extensions |
| OLD | NEW |