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

Side by Side Diff: chrome/common/net/gaia/oauth2_mint_token_fetcher.cc

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/common/net/gaia/oauth2_mint_token_fetcher.h" 5 #include "chrome/common/net/gaia/oauth2_mint_token_fetcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/common/net/gaia/gaia_urls.h" 14 #include "chrome/common/net/gaia/gaia_urls.h"
15 #include "chrome/common/net/gaia/google_service_auth_error.h" 15 #include "chrome/common/net/gaia/google_service_auth_error.h"
16 #include "net/base/escape.h" 16 #include "net/base/escape.h"
17 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
18 #include "net/http/http_status_code.h" 18 #include "net/http/http_status_code.h"
19 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
20 #include "net/url_request/url_request_status.h" 20 #include "net/url_request/url_request_status.h"
21 21
22 using content::URLFetcher; 22 using content::URLFetcher;
23 using content::URLFetcherDelegate; 23 using net::URLFetcherDelegate;
24 using net::ResponseCookies; 24 using net::ResponseCookies;
25 using net::URLRequestContextGetter; 25 using net::URLRequestContextGetter;
26 using net::URLRequestStatus; 26 using net::URLRequestStatus;
27 27
28 namespace { 28 namespace {
29 static const char kAuthorizationHeaderFormat[] = 29 static const char kAuthorizationHeaderFormat[] =
30 "Authorization: Bearer %s"; 30 "Authorization: Bearer %s";
31 static const char kOAuth2IssueTokenBodyFormat[] = 31 static const char kOAuth2IssueTokenBodyFormat[] =
32 "force=true" 32 "force=true"
33 "&response_type=token" 33 "&response_type=token"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 CHECK(access_token); 180 CHECK(access_token);
181 std::string data; 181 std::string data;
182 source->GetResponseAsString(&data); 182 source->GetResponseAsString(&data);
183 scoped_ptr<base::Value> value(base::JSONReader::Read(data)); 183 scoped_ptr<base::Value> value(base::JSONReader::Read(data));
184 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY) 184 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
185 return false; 185 return false;
186 186
187 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); 187 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
188 return dict->GetString(kAccessTokenKey, access_token); 188 return dict->GetString(kAccessTokenKey, access_token);
189 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698