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 "google_apis/gaia/gaia_auth_fetcher.h" | 5 #include "google_apis/gaia/gaia_auth_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/profiler/scoped_profile.h" | 13 #include "base/profiler/scoped_tracker.h" |
14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "google_apis/gaia/gaia_auth_consumer.h" | 18 #include "google_apis/gaia/gaia_auth_consumer.h" |
19 #include "google_apis/gaia/gaia_constants.h" | 19 #include "google_apis/gaia/gaia_constants.h" |
20 #include "google_apis/gaia/gaia_urls.h" | 20 #include "google_apis/gaia/gaia_urls.h" |
21 #include "google_apis/gaia/google_service_auth_error.h" | 21 #include "google_apis/gaia/google_service_auth_error.h" |
22 #include "net/base/escape.h" | 22 #include "net/base/escape.h" |
23 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 const net::URLRequestStatus& status, | 928 const net::URLRequestStatus& status, |
929 int response_code) { | 929 int response_code) { |
930 if (status.is_success() && response_code == net::HTTP_OK) { | 930 if (status.is_success() && response_code == net::HTTP_OK) { |
931 consumer_->OnGetCheckConnectionInfoSuccess(data); | 931 consumer_->OnGetCheckConnectionInfoSuccess(data); |
932 } else { | 932 } else { |
933 consumer_->OnGetCheckConnectionInfoError(GenerateAuthError(data, status)); | 933 consumer_->OnGetCheckConnectionInfoError(GenerateAuthError(data, status)); |
934 } | 934 } |
935 } | 935 } |
936 | 936 |
937 void GaiaAuthFetcher::OnURLFetchComplete(const net::URLFetcher* source) { | 937 void GaiaAuthFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
938 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. | 938 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed. |
939 tracked_objects::ScopedProfile tracking_profile( | 939 tracked_objects::ScopedTracker tracking_profile( |
940 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 940 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
941 "422577 GaiaAuthFetcher::OnURLFetchComplete")); | 941 "422577 GaiaAuthFetcher::OnURLFetchComplete")); |
942 | 942 |
943 fetch_pending_ = false; | 943 fetch_pending_ = false; |
944 // Some of the GAIA requests perform redirects, which results in the final | 944 // Some of the GAIA requests perform redirects, which results in the final |
945 // URL of the fetcher not being the original URL requested. Therefore use | 945 // URL of the fetcher not being the original URL requested. Therefore use |
946 // the original URL when determining which OnXXX function to call. | 946 // the original URL when determining which OnXXX function to call. |
947 const GURL& url = source->GetOriginalURL(); | 947 const GURL& url = source->GetOriginalURL(); |
948 const net::URLRequestStatus& status = source->GetStatus(); | 948 const net::URLRequestStatus& status = source->GetStatus(); |
949 int response_code = source->GetResponseCode(); | 949 int response_code = source->GetResponseCode(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 return alleged_error.find(kSecondFactor) != | 993 return alleged_error.find(kSecondFactor) != |
994 std::string::npos; | 994 std::string::npos; |
995 } | 995 } |
996 | 996 |
997 // static | 997 // static |
998 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( | 998 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( |
999 const std::string& alleged_error) { | 999 const std::string& alleged_error) { |
1000 return alleged_error.find(kWebLoginRequired) != | 1000 return alleged_error.find(kWebLoginRequired) != |
1001 std::string::npos; | 1001 std::string::npos; |
1002 } | 1002 } |
OLD | NEW |