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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/history.cc ('k') | chrome/browser/history/web_history_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_H_
6 #define CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_H_
7 #pragma once
8
9 #include <map>
10 #include <set>
11 #include <string>
12 #include <vector>
13
14 #include "base/file_path.h"
15 #include "base/memory/scoped_vector.h"
16 #include "base/memory/weak_ptr.h"
17 #include "base/string16.h"
18 #include "base/timer.h"
19 #include "chrome/browser/cancelable_request.h"
20 #include "chrome/browser/history/history_types.h"
21 #include "chrome/browser/profiles/profile_keyed_service.h"
22 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h"
23 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h"
25 #include "content/public/common/url_fetcher_delegate.h"
26 #include "googleurl/src/gurl.h"
27
28 class OAuth2AccessTokenFetcher;
29 class Profile;
30
31 namespace base {
32 class DictionaryValue;
33 }
34
35 namespace history {
36
37 class WebHistoryService : public ProfileKeyedService,
38 public content::URLFetcherDelegate,
39 public content::NotificationObserver,
40 public OAuth2AccessTokenConsumer {
41 public:
42 // Returns the WebHistoryService for |profile|, creating a new one if needed.
43 static WebHistoryService* GetForProfile(Profile* profile);
44
45 explicit WebHistoryService(Profile* profile);
46 virtual ~WebHistoryService();
47
48 typedef base::Callback<void()> QueryWebHistoryCallback;
49
50 // content::URLFetcherDelegate method.
51 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
52
53 // content::NotificationObserver method.
54 virtual void Observe(int type,
55 const content::NotificationSource& source,
56 const content::NotificationDetails& details) OVERRIDE;
57
58 // OAuth2AccessTokenConsumer methods.
59 virtual void OnGetTokenSuccess(const std::string& access_token) OVERRIDE;
60 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
61
62 void QueryHistory(const string16& text_query,
63 const QueryOptions& options,
64 CancelableRequestConsumerBase* consumer,
65 const QueryWebHistoryCallback& callback);
66
67 private:
68 // Send the OAuth2AccessTokenFetcher request.
69 void RefreshAccessToken();
70 void GetHistory();
71
72 Profile* profile_;
73
74 // Used to recieve TokenService notifications for GaiaOAuth2LoginRefreshToken.
75 content::NotificationRegistrar registrar_;
76
77 std::string access_token_;
78
79 scoped_ptr<content::URLFetcher> url_fetcher_;
80
81 QueryWebHistoryCallback query_history_callback_;
82
83 // The pending OAuth access token request and a timer for retrying on failure.
84 scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_;
85 base::OneShotTimer<WebHistoryService> auth_retry_timer_;
86
87 DISALLOW_COPY_AND_ASSIGN(WebHistoryService);
88 };
89
90 } // namespace history
91
92 #endif // CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_H_
OLDNEW
« 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