Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: chrome/browser/extensions/webstore_install_helper.cc

Issue 15987009: Update chrome/ to use WeakPtr<T>::get() instead of implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 BrowserThread::PostTask( 105 BrowserThread::PostTask(
106 BrowserThread::IO, 106 BrowserThread::IO,
107 FROM_HERE, 107 FROM_HERE,
108 base::Bind(&WebstoreInstallHelper::StartFetchedImageDecode, this)); 108 base::Bind(&WebstoreInstallHelper::StartFetchedImageDecode, this));
109 } 109 }
110 url_fetcher_.reset(); 110 url_fetcher_.reset();
111 } 111 }
112 112
113 void WebstoreInstallHelper::StartFetchedImageDecode() { 113 void WebstoreInstallHelper::StartFetchedImageDecode() {
114 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 114 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
115 CHECK(utility_host_); 115 CHECK(utility_host_.get());
116 utility_host_->Send(new ChromeUtilityMsg_DecodeImage(fetched_icon_data_)); 116 utility_host_->Send(new ChromeUtilityMsg_DecodeImage(fetched_icon_data_));
117 } 117 }
118 118
119 119
120 bool WebstoreInstallHelper::OnMessageReceived(const IPC::Message& message) { 120 bool WebstoreInstallHelper::OnMessageReceived(const IPC::Message& message) {
121 bool handled = true; 121 bool handled = true;
122 IPC_BEGIN_MESSAGE_MAP(WebstoreInstallHelper, message) 122 IPC_BEGIN_MESSAGE_MAP(WebstoreInstallHelper, message)
123 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Succeeded, 123 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Succeeded,
124 OnDecodeImageSucceeded) 124 OnDecodeImageSucceeded)
125 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Failed, 125 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Failed,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 ReportResultsIfComplete(); 173 ReportResultsIfComplete();
174 } 174 }
175 175
176 void WebstoreInstallHelper::ReportResultsIfComplete() { 176 void WebstoreInstallHelper::ReportResultsIfComplete() {
177 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 177 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
178 178
179 if (!icon_decode_complete_ || !manifest_parse_complete_) 179 if (!icon_decode_complete_ || !manifest_parse_complete_)
180 return; 180 return;
181 181
182 // The utility_host_ will take care of deleting itself after this call. 182 // The utility_host_ will take care of deleting itself after this call.
183 if (utility_host_) { 183 if (utility_host_.get()) {
184 utility_host_->EndBatchMode(); 184 utility_host_->EndBatchMode();
185 utility_host_.reset(); 185 utility_host_.reset();
186 } 186 }
187 187
188 BrowserThread::PostTask( 188 BrowserThread::PostTask(
189 BrowserThread::UI, 189 BrowserThread::UI,
190 FROM_HERE, 190 FROM_HERE,
191 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this)); 191 base::Bind(&WebstoreInstallHelper::ReportResultFromUIThread, this));
192 } 192 }
193 193
194 void WebstoreInstallHelper::ReportResultFromUIThread() { 194 void WebstoreInstallHelper::ReportResultFromUIThread() {
195 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 195 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
196 if (error_.empty() && parsed_manifest_) 196 if (error_.empty() && parsed_manifest_)
197 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); 197 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release());
198 else 198 else
199 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); 199 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_);
200 } 200 }
201 201
202 } // namespace extensions 202 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/user_script_listener.cc ('k') | chrome/browser/google_apis/operation_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698