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

Side by Side Diff: chrome/browser/extensions/api/feedback_private/blob_reader.cc

Issue 17111003: Implement the feedbackPrivate API. (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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/api/feedback_private/blob_reader.h"
6
7 #include "chrome/browser/profiles/profile.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "net/url_request/url_fetcher.h"
10 #include "net/url_request/url_request_context.h"
11 #include "net/url_request/url_request_context_getter.h"
12
13 BlobReader::BlobReader(Profile* profile,
14 const GURL& blob_url,
15 BlobReadCallback callback)
16 : callback_(callback) {
17 fetcher_ = net::URLFetcher::Create(
18 blob_url, net::URLFetcher::GET,
19 this);
20 fetcher_->SetRequestContext(profile->GetRequestContext());
21 }
22
23 BlobReader::~BlobReader() {
24 }
25
26 void BlobReader::Start() {
27 fetcher_->Start();
28 }
29
30 // Overridden from net::URLFetcherDelegate.
31 void BlobReader::OnURLFetchComplete(const net::URLFetcher* source) {
32 scoped_ptr<std::string> response(new std::string);
33 source->GetResponseAsString(response.get());
34 callback_.Run(response.Pass());
35
36 delete this;
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698