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

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

Issue 8375039: Create a content::UrlFetcher interface that lives in content/public/common and convert users to i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_inline_installer.h" 5 #include "chrome/browser/extensions/webstore_inline_installer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 CompleteInstall(kInvalidWebstoreItemId); 164 CompleteInstall(kInvalidWebstoreItemId);
165 return; 165 return;
166 } 166 }
167 167
168 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); 168 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_));
169 169
170 webstore_data_url_fetcher_.reset( 170 webstore_data_url_fetcher_.reset(
171 new URLFetcher(webstore_data_url, URLFetcher::GET, this)); 171 new URLFetcher(webstore_data_url, URLFetcher::GET, this));
172 Profile* profile = Profile::FromBrowserContext( 172 Profile* profile = Profile::FromBrowserContext(
173 tab_contents()->browser_context()); 173 tab_contents()->browser_context());
174 webstore_data_url_fetcher_->set_request_context( 174 webstore_data_url_fetcher_->SetRequestContext(
175 profile->GetRequestContext()); 175 profile->GetRequestContext());
176 webstore_data_url_fetcher_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES | 176 webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
177 net::LOAD_DO_NOT_SAVE_COOKIES | 177 net::LOAD_DO_NOT_SAVE_COOKIES |
178 net::LOAD_DISABLE_CACHE); 178 net::LOAD_DISABLE_CACHE);
179 webstore_data_url_fetcher_->Start(); 179 webstore_data_url_fetcher_->Start();
180 } 180 }
181 181
182 void WebstoreInlineInstaller::OnURLFetchComplete(const URLFetcher* source) { 182 void WebstoreInlineInstaller::OnURLFetchComplete(
183 const content::URLFetcher* source) {
183 CHECK_EQ(webstore_data_url_fetcher_.get(), source); 184 CHECK_EQ(webstore_data_url_fetcher_.get(), source);
184 // We shouldn't be getting UrlFetcher callbacks if the TabContents has gone 185 // We shouldn't be getting UrlFetcher callbacks if the TabContents has gone
185 // away; we stop any in in-progress fetches in TabContentsDestroyed. 186 // away; we stop any in in-progress fetches in TabContentsDestroyed.
186 CHECK(tab_contents()); 187 CHECK(tab_contents());
187 188
188 if (!webstore_data_url_fetcher_->status().is_success() || 189 if (!webstore_data_url_fetcher_->GetStatus().is_success() ||
189 webstore_data_url_fetcher_->response_code() != 200) { 190 webstore_data_url_fetcher_->GetResponseCode() != 200) {
190 CompleteInstall(kWebstoreRequestError); 191 CompleteInstall(kWebstoreRequestError);
191 return; 192 return;
192 } 193 }
193 194
194 std::string webstore_json_data; 195 std::string webstore_json_data;
195 webstore_data_url_fetcher_->GetResponseAsString(&webstore_json_data); 196 webstore_data_url_fetcher_->GetResponseAsString(&webstore_json_data);
196 webstore_data_url_fetcher_.reset(); 197 webstore_data_url_fetcher_.reset();
197 198
198 scoped_refptr<SafeWebstoreResponseParser> parser = 199 scoped_refptr<SafeWebstoreResponseParser> parser =
199 new SafeWebstoreResponseParser(this, webstore_json_data); 200 new SafeWebstoreResponseParser(this, webstore_json_data);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 if (tab_contents()) { 416 if (tab_contents()) {
416 if (error.empty()) { 417 if (error.empty()) {
417 delegate_->OnInlineInstallSuccess(install_id_); 418 delegate_->OnInlineInstallSuccess(install_id_);
418 } else { 419 } else {
419 delegate_->OnInlineInstallFailure(install_id_, error); 420 delegate_->OnInlineInstallFailure(install_id_, error);
420 } 421 }
421 } 422 }
422 423
423 Release(); // Matches the AddRef in BeginInstall. 424 Release(); // Matches the AddRef in BeginInstall.
424 } 425 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_inline_installer.h ('k') | chrome/browser/extensions/webstore_install_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698