| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_ |
| 6 #define CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_ | 6 #define CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } // namespace net | 28 } // namespace net |
| 29 | 29 |
| 30 struct OneGoogleBarData; | 30 struct OneGoogleBarData; |
| 31 | 31 |
| 32 class OneGoogleBarFetcherImpl : public OneGoogleBarFetcher { | 32 class OneGoogleBarFetcherImpl : public OneGoogleBarFetcher { |
| 33 public: | 33 public: |
| 34 OneGoogleBarFetcherImpl(SigninManagerBase* signin_manager, | 34 OneGoogleBarFetcherImpl(SigninManagerBase* signin_manager, |
| 35 OAuth2TokenService* token_service, | 35 OAuth2TokenService* token_service, |
| 36 net::URLRequestContextGetter* request_context, | 36 net::URLRequestContextGetter* request_context, |
| 37 GoogleURLTracker* google_url_tracker); | 37 GoogleURLTracker* google_url_tracker); |
| 38 ~OneGoogleBarFetcherImpl(); | 38 ~OneGoogleBarFetcherImpl() override; |
| 39 | 39 |
| 40 void Fetch(OneGoogleCallback callback) override; | 40 void Fetch(OneGoogleCallback callback) override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 class AuthenticatedURLFetcher; | 43 class AuthenticatedURLFetcher; |
| 44 | 44 |
| 45 void IssueRequestIfNoneOngoing(); | 45 void IssueRequestIfNoneOngoing(); |
| 46 | 46 |
| 47 void FetchDone(const net::URLFetcher* source); | 47 void FetchDone(const net::URLFetcher* source); |
| 48 | 48 |
| 49 void JsonParsed(std::unique_ptr<base::Value> value); | 49 void JsonParsed(std::unique_ptr<base::Value> value); |
| 50 void JsonParseFailed(const std::string& message); | 50 void JsonParseFailed(const std::string& message); |
| 51 | 51 |
| 52 void Respond(const base::Optional<OneGoogleBarData>& data); | 52 void Respond(const base::Optional<OneGoogleBarData>& data); |
| 53 | 53 |
| 54 SigninManagerBase* signin_manager_; | 54 SigninManagerBase* signin_manager_; |
| 55 OAuth2TokenService* token_service_; | 55 OAuth2TokenService* token_service_; |
| 56 net::URLRequestContextGetter* request_context_; | 56 net::URLRequestContextGetter* request_context_; |
| 57 GoogleURLTracker* google_url_tracker_; | 57 GoogleURLTracker* google_url_tracker_; |
| 58 | 58 |
| 59 std::vector<OneGoogleCallback> callbacks_; | 59 std::vector<OneGoogleCallback> callbacks_; |
| 60 std::unique_ptr<AuthenticatedURLFetcher> pending_request_; | 60 std::unique_ptr<AuthenticatedURLFetcher> pending_request_; |
| 61 | 61 |
| 62 base::WeakPtrFactory<OneGoogleBarFetcherImpl> weak_ptr_factory_; | 62 base::WeakPtrFactory<OneGoogleBarFetcherImpl> weak_ptr_factory_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(OneGoogleBarFetcherImpl); | 64 DISALLOW_COPY_AND_ASSIGN(OneGoogleBarFetcherImpl); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 #endif // CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_ | 67 #endif // CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_ |
| OLD | NEW |