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 #ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_OBFUSCATED_GAIA_ID_FETCHER_
H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_OBFUSCATED_GAIA_ID_FETCHER_
H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_OBFUSCATED_GAIA_ID_FETCHER_
H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_OBFUSCATED_GAIA_ID_FETCHER_
H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "google_apis/gaia/oauth2_api_call_flow.h" | 10 #include "google_apis/gaia/oauth2_api_call_flow.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 ObfuscatedGaiaIdFetcher(net::URLRequestContextGetter* context, | 43 ObfuscatedGaiaIdFetcher(net::URLRequestContextGetter* context, |
44 Delegate* delegate, | 44 Delegate* delegate, |
45 const std::string& refresh_token); | 45 const std::string& refresh_token); |
46 virtual ~ObfuscatedGaiaIdFetcher(); | 46 virtual ~ObfuscatedGaiaIdFetcher(); |
47 | 47 |
48 static std::vector<std::string> GetScopes(); | 48 static std::vector<std::string> GetScopes(); |
49 | 49 |
50 protected: | 50 protected: |
51 // OAuth2ApiCallFlow implementation | 51 // OAuth2ApiCallFlow implementation |
52 virtual GURL CreateApiCallUrl() OVERRIDE; | 52 virtual GURL CreateApiCallUrl() override; |
53 virtual std::string CreateApiCallBody() OVERRIDE; | 53 virtual std::string CreateApiCallBody() override; |
54 virtual void ProcessApiCallSuccess( | 54 virtual void ProcessApiCallSuccess( |
55 const net::URLFetcher* source) OVERRIDE; | 55 const net::URLFetcher* source) override; |
56 virtual void ProcessApiCallFailure( | 56 virtual void ProcessApiCallFailure( |
57 const net::URLFetcher* source) OVERRIDE; | 57 const net::URLFetcher* source) override; |
58 virtual void ProcessNewAccessToken(const std::string& access_token) OVERRIDE; | 58 virtual void ProcessNewAccessToken(const std::string& access_token) override; |
59 virtual void ProcessMintAccessTokenFailure( | 59 virtual void ProcessMintAccessTokenFailure( |
60 const GoogleServiceAuthError& error) OVERRIDE; | 60 const GoogleServiceAuthError& error) override; |
61 | 61 |
62 private: | 62 private: |
63 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, SetUp); | 63 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, SetUp); |
64 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, ParseResponse); | 64 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, ParseResponse); |
65 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, ProcessApiCallSuccess); | 65 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, ProcessApiCallSuccess); |
66 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, ProcessApiCallFailure); | 66 FRIEND_TEST_ALL_PREFIXES(ObfuscatedGaiaIdFetcherTest, ProcessApiCallFailure); |
67 | 67 |
68 void ReportSuccess(const std::string& obfuscated_id); | 68 void ReportSuccess(const std::string& obfuscated_id); |
69 void ReportFailure(const GoogleServiceAuthError& error); | 69 void ReportFailure(const GoogleServiceAuthError& error); |
70 | 70 |
71 // Get the obfuscated Gaia ID out of the response body. | 71 // Get the obfuscated Gaia ID out of the response body. |
72 static bool ParseResponse( | 72 static bool ParseResponse( |
73 const std::string& data, std::string* obfuscated_id); | 73 const std::string& data, std::string* obfuscated_id); |
74 | 74 |
75 // Unowned pointer to the delegate. Normally the delegate owns | 75 // Unowned pointer to the delegate. Normally the delegate owns |
76 // this fetcher class. | 76 // this fetcher class. |
77 Delegate* delegate_; | 77 Delegate* delegate_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(ObfuscatedGaiaIdFetcher); | 79 DISALLOW_COPY_AND_ASSIGN(ObfuscatedGaiaIdFetcher); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace extensions | 82 } // namespace extensions |
83 | 83 |
84 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_OBFUSCATED_GAIA_ID_FETCH
ER_H_ | 84 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_OBFUSCATED_GAIA_ID_FETCH
ER_H_ |
OLD | NEW |