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

Unified Diff: chrome/browser/search/one_google_bar/one_google_bar_fetcher_impl.h

Issue 2814753002: Local NTP: Introduce OneGoogleBarFetcher (Closed)
Patch Set: safe_json Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search/one_google_bar/one_google_bar_fetcher_impl.h
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_fetcher_impl.h b/chrome/browser/search/one_google_bar/one_google_bar_fetcher_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..40538ef5d9b8fd7b8d33b4b5d1ed8f406a0e5c8a
--- /dev/null
+++ b/chrome/browser/search/one_google_bar/one_google_bar_fetcher_impl.h
@@ -0,0 +1,67 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_
+#define CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
+#include "chrome/browser/search/one_google_bar/one_google_bar_fetcher.h"
+
+class GoogleURLTracker;
+class OAuth2TokenService;
+class SigninManagerBase;
+
+namespace base {
+class Value;
+}
+
+namespace net {
+class URLFetcher;
+class URLRequestContextGetter;
+} // namespace net
+
+struct OneGoogleBarData;
+
+class OneGoogleBarFetcherImpl : public OneGoogleBarFetcher {
+ public:
+ OneGoogleBarFetcherImpl(SigninManagerBase* signin_manager,
+ OAuth2TokenService* token_service,
+ net::URLRequestContextGetter* request_context,
+ GoogleURLTracker* google_url_tracker);
+ ~OneGoogleBarFetcherImpl();
+
+ void Fetch(OneGoogleCallback callback) override;
+
+ private:
+ class AuthenticatedURLFetcher;
+
+ void IssueRequestIfNoneOngoing();
+
+ void FetchDone(const net::URLFetcher* source);
+
+ void JsonParsed(std::unique_ptr<base::Value> value);
+ void JsonParseFailed(const std::string& message);
+
+ void Respond(const base::Optional<OneGoogleBarData>& data);
+
+ SigninManagerBase* signin_manager_;
+ OAuth2TokenService* token_service_;
+ net::URLRequestContextGetter* request_context_;
+ GoogleURLTracker* google_url_tracker_;
+
+ std::vector<OneGoogleCallback> callbacks_;
+ std::unique_ptr<AuthenticatedURLFetcher> pending_request_;
+
+ base::WeakPtrFactory<OneGoogleBarFetcherImpl> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(OneGoogleBarFetcherImpl);
+};
+
+#endif // CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_FETCHER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698