Chromium Code Reviews| 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 bf608c0aa13844eeabcf8d3ca248ea5b31c1fda8..c35cbaa4989f79e080b26d0cc2cc17a7e21ae2b8 100644 |
| --- a/chrome/browser/chrome_to_mobile_service.h |
| +++ b/chrome/browser/chrome_to_mobile_service.h |
| @@ -23,6 +23,9 @@ |
| #include "content/public/browser/notification_registrar.h" |
| #include "googleurl/src/gurl.h" |
| #include "net/url_request/url_fetcher_delegate.h" |
| +#include "sync/notifier/invalidation_util.h" |
|
akalin
2012/08/13 22:23:58
i think IWYU has the exception that you don't have
msw
2012/08/16 02:41:51
Done.
|
| +#include "sync/notifier/notifications_disabled_reason.h" |
| +#include "sync/notifier/sync_notifier_observer.h" |
| class OAuth2AccessTokenFetcher; |
| class Browser; |
| @@ -40,7 +43,8 @@ class URLFetcher; |
| class ChromeToMobileService : public ProfileKeyedService, |
| public net::URLFetcherDelegate, |
| public content::NotificationObserver, |
| - public OAuth2AccessTokenConsumer { |
| + public OAuth2AccessTokenConsumer, |
| + public syncer::SyncNotifierObserver { |
| public: |
| class Observer { |
| public: |
| @@ -105,7 +109,7 @@ class ChromeToMobileService : public ProfileKeyedService, |
| virtual ~ChromeToMobileService(); |
| // Returns true if the service has found any registered mobile devices. |
| - bool HasMobiles(); |
| + bool HasMobiles() const; |
| // Get the non-NULL ListValue of mobile devices from the cloud print service. |
| // The list is owned by PrefService, which outlives ChromeToMobileService. |
| @@ -153,9 +157,21 @@ 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; |
| + |
| private: |
| friend class MockChromeToMobileService; |
| + // Enable or disable Chrome To Mobile with the browsers' command controllers. |
| + // The feature state is automatically derived from internal conditions. |
| + void UpdateCommandState() const; |
| + |
| // Handle the attempted creation of a temporary file for snapshot generation. |
| // Alert the observer of failure or generate MHTML with an observer callback. |
| void SnapshotFileCreated(base::WeakPtr<Observer> observer, |
| @@ -166,7 +182,7 @@ class ChromeToMobileService : public ProfileKeyedService, |
| // Create a cloud print job submission request for a URL or snapshot. |
| net::URLFetcher* CreateRequest(const JobData& data); |
| - // Initialize URLFetcher requests (search and jobs submit). |
| + // Initialize URLFetcher requests for listing devices and sending pages. |
| void InitRequest(net::URLFetcher* request); |
| // Submit a cloud print job request with the requisite data. |
| @@ -176,13 +192,9 @@ class ChromeToMobileService : public ProfileKeyedService, |
| // Virtual for unit test mocking. |
| virtual void RefreshAccessToken(); |
| - // Request account information to limit cloud print access to existing users. |
| - void RequestAccountInfo(); |
| - |
| // Send the cloud print URLFetcher search request. |
| void RequestSearch(); |
| - void HandleAccountInfoResponse(); |
| void HandleSearchResponse(); |
| void HandleSubmitResponse(const net::URLFetcher* source); |
| @@ -190,6 +202,9 @@ class ChromeToMobileService : public ProfileKeyedService, |
| Profile* profile_; |
| + // The sync invalidation service enabled/disabled state. |
| + bool sync_invalidation_enabled_; |
| + |
| // Used to recieve TokenService notifications for GaiaOAuth2LoginRefreshToken. |
| content::NotificationRegistrar registrar_; |
| @@ -209,12 +224,9 @@ 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. |
| + // The pending mobile device search request and a flag to try once accessible. |
| scoped_ptr<net::URLFetcher> search_request_; |
| + bool request_search_when_accessible_; |
| DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService); |
| }; |