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

Unified Diff: chrome/browser/history/web_history_service.h

Issue 10392084: WIP for integration between Chrome and Google Web History. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More work. Created 8 years, 7 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
« no previous file with comments | « chrome/browser/history/history.cc ('k') | chrome/browser/history/web_history_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/web_history_service.h
diff --git a/chrome/browser/history/web_history_service.h b/chrome/browser/history/web_history_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fcbfca8ffd6dde732db758dbdb18c8ff1f62967
--- /dev/null
+++ b/chrome/browser/history/web_history_service.h
@@ -0,0 +1,92 @@
+// Copyright (c) 2012 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_HISTORY_WEB_HISTORY_SERVICE_H_
+#define CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_H_
+#pragma once
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+#include "base/file_path.h"
+#include "base/memory/scoped_vector.h"
+#include "base/memory/weak_ptr.h"
+#include "base/string16.h"
+#include "base/timer.h"
+#include "chrome/browser/cancelable_request.h"
+#include "chrome/browser/history/history_types.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "chrome/common/net/gaia/oauth2_access_token_consumer.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/common/url_fetcher_delegate.h"
+#include "googleurl/src/gurl.h"
+
+class OAuth2AccessTokenFetcher;
+class Profile;
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace history {
+
+class WebHistoryService : public ProfileKeyedService,
+ public content::URLFetcherDelegate,
+ public content::NotificationObserver,
+ public OAuth2AccessTokenConsumer {
+ public:
+ // Returns the WebHistoryService for |profile|, creating a new one if needed.
+ static WebHistoryService* GetForProfile(Profile* profile);
+
+ explicit WebHistoryService(Profile* profile);
+ virtual ~WebHistoryService();
+
+ typedef base::Callback<void()> QueryWebHistoryCallback;
+
+ // content::URLFetcherDelegate method.
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
+ // content::NotificationObserver method.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // OAuth2AccessTokenConsumer methods.
+ virtual void OnGetTokenSuccess(const std::string& access_token) OVERRIDE;
+ virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
+
+ void QueryHistory(const string16& text_query,
+ const QueryOptions& options,
+ CancelableRequestConsumerBase* consumer,
+ const QueryWebHistoryCallback& callback);
+
+ private:
+ // Send the OAuth2AccessTokenFetcher request.
+ void RefreshAccessToken();
+ void GetHistory();
+
+ Profile* profile_;
+
+ // Used to recieve TokenService notifications for GaiaOAuth2LoginRefreshToken.
+ content::NotificationRegistrar registrar_;
+
+ std::string access_token_;
+
+ scoped_ptr<content::URLFetcher> url_fetcher_;
+
+ QueryWebHistoryCallback query_history_callback_;
+
+ // The pending OAuth access token request and a timer for retrying on failure.
+ scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_;
+ base::OneShotTimer<WebHistoryService> auth_retry_timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebHistoryService);
+};
+
+} // namespace history
+
+#endif // CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_H_
« no previous file with comments | « chrome/browser/history/history.cc ('k') | chrome/browser/history/web_history_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698