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

Unified Diff: chrome/browser/chrome_to_mobile_service.h

Issue 10834203: Integrate invalidation API into ChromeToMobileService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment; sync and rebase. Created 8 years, 4 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/DEPS ('k') | chrome/browser/chrome_to_mobile_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_to_mobile_service.h
diff --git a/chrome/browser/chrome_to_mobile_service.h b/chrome/browser/chrome_to_mobile_service.h
index 3613396d7f4647fd995eb3cbdb28bbabf3c8ef79..e39b50ca3d166ac0f91fc75dfce5317ae1d66b8b 100644
--- a/chrome/browser/chrome_to_mobile_service.h
+++ b/chrome/browser/chrome_to_mobile_service.h
@@ -6,10 +6,12 @@
#define CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
#include <map>
+#include <queue>
#include <set>
#include <string>
#include <vector>
+#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/memory/weak_ptr.h"
#include "base/string16.h"
@@ -22,6 +24,7 @@
#include "content/public/browser/notification_registrar.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_fetcher_delegate.h"
+#include "sync/notifier/sync_notifier_observer.h"
class OAuth2AccessTokenFetcher;
class Browser;
@@ -39,7 +42,8 @@ class URLFetcher;
class ChromeToMobileService : public ProfileKeyedService,
public net::URLFetcherDelegate,
public content::NotificationObserver,
- public OAuth2AccessTokenConsumer {
+ public OAuth2AccessTokenConsumer,
+ public syncer::SyncNotifierObserver {
public:
class Observer {
public:
@@ -112,10 +116,6 @@ class ChromeToMobileService : public ProfileKeyedService,
// Virtual for unit test mocking.
virtual const base::ListValue* GetMobiles() const;
- // Request an updated mobile device list, request auth first if needed.
- // Virtual for unit test mocking.
- virtual void RequestMobileListUpdate();
-
// Callback with an MHTML snapshot of the browser's selected WebContents.
// Virtual for unit test mocking.
virtual void GenerateSnapshot(Browser* browser,
@@ -123,7 +123,7 @@ class ChromeToMobileService : public ProfileKeyedService,
// Send the browser's selected WebContents to the specified mobile device.
// Virtual for unit test mocking.
- virtual void SendToMobile(const base::DictionaryValue& mobile,
+ virtual void SendToMobile(const base::DictionaryValue* mobile,
const FilePath& snapshot,
Browser* browser,
base::WeakPtr<Observer> observer);
@@ -152,6 +152,18 @@ class ChromeToMobileService : public ProfileKeyedService,
const base::Time& expiration_time) OVERRIDE;
virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
+ // syncer::SyncNotifierObserver implementation.
+ virtual void OnNotificationsEnabled() OVERRIDE;
+ virtual void OnNotificationsDisabled(
+ syncer::NotificationsDisabledReason reason) OVERRIDE;
+ virtual void OnIncomingNotification(
+ const syncer::ObjectIdPayloadMap& id_payloads,
+ syncer::IncomingNotificationSource source) OVERRIDE;
+
+ // Expose access token accessors for test purposes.
+ const std::string& GetAccessTokenForTest() const;
+ void SetAccessTokenForTest(const std::string& access_token);
+
private:
friend class MockChromeToMobileService;
@@ -179,25 +191,26 @@ class ChromeToMobileService : public ProfileKeyedService,
// Virtual for unit test mocking.
virtual void RequestAccessToken();
- // Request account information to limit cloud print access to existing users.
- void RequestAccountInfo();
-
// Send the cloud print URLFetcher device search request.
- void RequestDeviceSearch();
+ // Virtual for unit test mocking.
+ virtual void RequestDeviceSearch();
- void HandleAccountInfoResponse();
- void HandleSearchResponse();
+ void HandleSearchResponse(const net::URLFetcher* source);
void HandleSubmitResponse(const net::URLFetcher* source);
base::WeakPtrFactory<ChromeToMobileService> weak_ptr_factory_;
Profile* profile_;
+ // Sync invalidation service state. Chrome To Mobile requires this service to
+ // to keep the mobile device list up to date and prevent page send failures.
+ bool sync_invalidation_enabled_;
+
// Used to recieve TokenService notifications for GaiaOAuth2LoginRefreshToken.
content::NotificationRegistrar registrar_;
- // Cloud print helper class and auth token.
- scoped_ptr<CloudPrintURL> cloud_print_url_;
+ // The cloud print service URL and auth access token.
+ GURL cloud_print_url_;
std::string access_token_;
// The set of snapshots currently available.
@@ -212,12 +225,8 @@ class ChromeToMobileService : public ProfileKeyedService,
scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_;
base::OneShotTimer<ChromeToMobileService> auth_retry_timer_;
- // The pending account information request and the cloud print access flag.
- scoped_ptr<net::URLFetcher> account_info_request_;
- bool cloud_print_accessible_;
-
- // The pending mobile device search request.
- scoped_ptr<net::URLFetcher> search_request_;
+ // A queue of tasks to perform after an access token is lazily initialized.
+ std::queue<base::Closure> task_queue_;
DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService);
};
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/chrome_to_mobile_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698