OLD | NEW |
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> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
25 #include "google_apis/gaia/oauth2_access_token_consumer.h" | 25 #include "google_apis/gaia/oauth2_access_token_consumer.h" |
26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
27 #include "net/url_request/url_fetcher_delegate.h" | 27 #include "net/url_request/url_fetcher_delegate.h" |
28 #include "sync/notifier/invalidation_handler.h" | 28 #include "sync/notifier/invalidation_handler.h" |
29 | 29 |
30 class OAuth2AccessTokenFetcher; | 30 class OAuth2AccessTokenFetcher; |
31 class Browser; | 31 class Browser; |
32 class CloudPrintURL; | 32 class CloudPrintURL; |
33 class MockChromeToMobileService; | 33 class MockChromeToMobileService; |
34 class PrefService; | 34 class PrefServiceSyncable; |
35 class Profile; | 35 class Profile; |
36 | 36 |
37 namespace net { | 37 namespace net { |
38 class URLFetcher; | 38 class URLFetcher; |
39 } | 39 } |
40 | 40 |
41 // ChromeToMobileService connects to the cloud print service to enumerate | 41 // ChromeToMobileService connects to the cloud print service to enumerate |
42 // compatible mobiles owned by its profile and send URLs and MHTML snapshots. | 42 // compatible mobiles owned by its profile and send URLs and MHTML snapshots. |
43 class ChromeToMobileService : public ProfileKeyedService, | 43 class ChromeToMobileService : public ProfileKeyedService, |
44 public net::URLFetcherDelegate, | 44 public net::URLFetcherDelegate, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // Returns whether Chrome To Mobile is enabled (gated on the Action Box UI). | 92 // Returns whether Chrome To Mobile is enabled (gated on the Action Box UI). |
93 static bool IsChromeToMobileEnabled(); | 93 static bool IsChromeToMobileEnabled(); |
94 | 94 |
95 // Update and return the IDC_CHROME_TO_MOBILE_PAGE command enabled state; the | 95 // Update and return the IDC_CHROME_TO_MOBILE_PAGE command enabled state; the |
96 // state is derived from commandline, profile, and current page applicability. | 96 // state is derived from commandline, profile, and current page applicability. |
97 // NOTE: Call this instead of IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE). | 97 // NOTE: Call this instead of IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE). |
98 static bool UpdateAndGetCommandState(Browser* browser); | 98 static bool UpdateAndGetCommandState(Browser* browser); |
99 | 99 |
100 // Register the user prefs associated with this service. | 100 // Register the user prefs associated with this service. |
101 static void RegisterUserPrefs(PrefService* prefs); | 101 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
102 | 102 |
103 explicit ChromeToMobileService(Profile* profile); | 103 explicit ChromeToMobileService(Profile* profile); |
104 virtual ~ChromeToMobileService(); | 104 virtual ~ChromeToMobileService(); |
105 | 105 |
106 // Returns true if the service has found any registered mobile devices. | 106 // Returns true if the service has found any registered mobile devices. |
107 bool HasMobiles() const; | 107 bool HasMobiles() const; |
108 | 108 |
109 // Get the non-NULL ListValue of mobile devices from the cloud print service. | 109 // Get the non-NULL ListValue of mobile devices from the cloud print service. |
110 // The list is owned by PrefService, which outlives ChromeToMobileService. | 110 // The list is owned by PrefService, which outlives ChromeToMobileService. |
111 // Each device DictionaryValue contains strings "type", "name", and "id". | 111 // Each device DictionaryValue contains strings "type", "name", and "id". |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_; | 226 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_; |
227 base::OneShotTimer<ChromeToMobileService> search_retry_timer_; | 227 base::OneShotTimer<ChromeToMobileService> search_retry_timer_; |
228 | 228 |
229 // A queue of tasks to perform after an access token is lazily initialized. | 229 // A queue of tasks to perform after an access token is lazily initialized. |
230 std::queue<base::Closure> task_queue_; | 230 std::queue<base::Closure> task_queue_; |
231 | 231 |
232 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService); | 232 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService); |
233 }; | 233 }; |
234 | 234 |
235 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ | 235 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ |
OLD | NEW |