OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 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_ |
| 7 |
| 8 #include <memory> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/optional.h" |
| 13 #include "chrome/browser/search/one_google_bar/one_google_bar_fetcher.h" |
| 14 |
| 15 class GoogleURLTracker; |
| 16 class OAuth2TokenService; |
| 17 class SigninManagerBase; |
| 18 |
| 19 namespace net { |
| 20 class URLFetcher; |
| 21 class URLRequestContextGetter; |
| 22 } // namespace net |
| 23 |
| 24 struct OneGoogleBarData; |
| 25 |
| 26 class OneGoogleBarFetcherImpl : public OneGoogleBarFetcher { |
| 27 public: |
| 28 OneGoogleBarFetcherImpl(SigninManagerBase* signin_manager, |
| 29 OAuth2TokenService* token_service, |
| 30 net::URLRequestContextGetter* request_context, |
| 31 GoogleURLTracker* google_url_tracker); |
| 32 ~OneGoogleBarFetcherImpl(); |
| 33 |
| 34 void Fetch(OneGoogleCallback callback) override; |
| 35 |
| 36 private: |
| 37 class AuthenticatedURLFetcher; |
| 38 |
| 39 void IssueRequestIfNoneOngoing(); |
| 40 |
| 41 void FetchDone(const net::URLFetcher* source); |
| 42 |
| 43 void Respond(const base::Optional<OneGoogleBarData>& data); |
| 44 |
| 45 SigninManagerBase* signin_manager_; |
| 46 OAuth2TokenService* token_service_; |
| 47 net::URLRequestContextGetter* request_context_; |
| 48 GoogleURLTracker* google_url_tracker_; |
| 49 |
| 50 std::vector<OneGoogleCallback> callbacks_; |
| 51 std::unique_ptr<AuthenticatedURLFetcher> pending_request_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(OneGoogleBarFetcherImpl); |
| 54 }; |
| 55 |
| 56 #endif // CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_ |
OLD | NEW |