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

Side by Side Diff: chrome/browser/chrome_to_mobile_service.h

Issue 10875064: Rename SyncNotifier->Invalidator and SyncNotifierObserver->InvalidationHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to ToT for landing Created 8 years, 3 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 | « no previous file | chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_CHROME_TO_MOBILE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
6 #define CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 6 #define CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/string16.h" 17 #include "base/string16.h"
18 #include "base/timer.h" 18 #include "base/timer.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "chrome/browser/profiles/profile_keyed_service.h" 20 #include "chrome/browser/profiles/profile_keyed_service.h"
21 #include "chrome/browser/sessions/session_id.h" 21 #include "chrome/browser/sessions/session_id.h"
22 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" 22 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h"
23 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
25 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
26 #include "net/url_request/url_fetcher_delegate.h" 26 #include "net/url_request/url_fetcher_delegate.h"
27 #include "sync/notifier/sync_notifier_observer.h" 27 #include "sync/notifier/invalidation_handler.h"
28 28
29 class OAuth2AccessTokenFetcher; 29 class OAuth2AccessTokenFetcher;
30 class Browser; 30 class Browser;
31 class CloudPrintURL; 31 class CloudPrintURL;
32 class MockChromeToMobileService; 32 class MockChromeToMobileService;
33 class PrefService; 33 class PrefService;
34 class Profile; 34 class Profile;
35 35
36 namespace net { 36 namespace net {
37 class URLFetcher; 37 class URLFetcher;
38 } 38 }
39 39
40 // ChromeToMobileService connects to the cloud print service to enumerate 40 // ChromeToMobileService connects to the cloud print service to enumerate
41 // compatible mobiles owned by its profile and send URLs and MHTML snapshots. 41 // compatible mobiles owned by its profile and send URLs and MHTML snapshots.
42 class ChromeToMobileService : public ProfileKeyedService, 42 class ChromeToMobileService : public ProfileKeyedService,
43 public net::URLFetcherDelegate, 43 public net::URLFetcherDelegate,
44 public content::NotificationObserver, 44 public content::NotificationObserver,
45 public OAuth2AccessTokenConsumer, 45 public OAuth2AccessTokenConsumer,
46 public syncer::SyncNotifierObserver { 46 public syncer::InvalidationHandler {
47 public: 47 public:
48 class Observer { 48 class Observer {
49 public: 49 public:
50 virtual ~Observer(); 50 virtual ~Observer();
51 51
52 // Called on generation of the page's MHTML snapshot. 52 // Called on generation of the page's MHTML snapshot.
53 virtual void SnapshotGenerated(const FilePath& path, int64 bytes) = 0; 53 virtual void SnapshotGenerated(const FilePath& path, int64 bytes) = 0;
54 54
55 // Called after URLFetcher responses from sending the URL (and snapshot). 55 // Called after URLFetcher responses from sending the URL (and snapshot).
56 virtual void OnSendComplete(bool success) = 0; 56 virtual void OnSendComplete(bool success) = 0;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // content::NotificationObserver method. 148 // content::NotificationObserver method.
149 virtual void Observe(int type, 149 virtual void Observe(int type,
150 const content::NotificationSource& source, 150 const content::NotificationSource& source,
151 const content::NotificationDetails& details) OVERRIDE; 151 const content::NotificationDetails& details) OVERRIDE;
152 152
153 // OAuth2AccessTokenConsumer methods. 153 // OAuth2AccessTokenConsumer methods.
154 virtual void OnGetTokenSuccess(const std::string& access_token, 154 virtual void OnGetTokenSuccess(const std::string& access_token,
155 const base::Time& expiration_time) OVERRIDE; 155 const base::Time& expiration_time) OVERRIDE;
156 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; 156 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
157 157
158 // syncer::SyncNotifierObserver implementation. 158 // syncer::InvalidationHandler implementation.
159 virtual void OnNotificationsEnabled() OVERRIDE; 159 virtual void OnNotificationsEnabled() OVERRIDE;
160 virtual void OnNotificationsDisabled( 160 virtual void OnNotificationsDisabled(
161 syncer::NotificationsDisabledReason reason) OVERRIDE; 161 syncer::NotificationsDisabledReason reason) OVERRIDE;
162 virtual void OnIncomingNotification( 162 virtual void OnIncomingNotification(
163 const syncer::ObjectIdStateMap& id_state_map, 163 const syncer::ObjectIdStateMap& id_state_map,
164 syncer::IncomingNotificationSource source) OVERRIDE; 164 syncer::IncomingNotificationSource source) OVERRIDE;
165 165
166 // Expose access token accessors for test purposes. 166 // Expose access token accessors for test purposes.
167 const std::string& GetAccessTokenForTest() const; 167 const std::string& GetAccessTokenForTest() const;
168 void SetAccessTokenForTest(const std::string& access_token); 168 void SetAccessTokenForTest(const std::string& access_token);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_; 228 scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_;
229 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_; 229 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_;
230 230
231 // A queue of tasks to perform after an access token is lazily initialized. 231 // A queue of tasks to perform after an access token is lazily initialized.
232 std::queue<base::Closure> task_queue_; 232 std::queue<base::Closure> task_queue_;
233 233
234 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService); 234 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService);
235 }; 235 };
236 236
237 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 237 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698