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 #include "chrome/browser/chrome_to_mobile_service.h" | 5 #include "chrome/browser/chrome_to_mobile_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
16 #include "chrome/browser/chrome_to_mobile_service_factory.h" | 16 #include "chrome/browser/chrome_to_mobile_service_factory.h" |
| 17 #include "chrome/browser/prefs/pref_registry_syncable.h" |
17 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
18 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 19 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/signin/token_service.h" | 21 #include "chrome/browser/signin/token_service.h" |
21 #include "chrome/browser/signin/token_service_factory.h" | 22 #include "chrome/browser/signin/token_service_factory.h" |
22 #include "chrome/browser/sync/profile_sync_service.h" | 23 #include "chrome/browser/sync/profile_sync_service.h" |
23 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
24 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_command_controller.h" | 26 #include "chrome/browser/ui/browser_command_controller.h" |
26 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 service && service->HasMobiles() && | 243 service && service->HasMobiles() && |
243 CanSendURL( | 244 CanSendURL( |
244 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 245 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
245 } | 246 } |
246 browser->command_controller()->command_updater()-> | 247 browser->command_controller()->command_updater()-> |
247 UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 248 UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
248 return enabled; | 249 return enabled; |
249 } | 250 } |
250 | 251 |
251 // static | 252 // static |
252 void ChromeToMobileService::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 253 void ChromeToMobileService::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
253 prefs->RegisterListPref(prefs::kChromeToMobileDeviceList, | 254 registry->RegisterListPref(prefs::kChromeToMobileDeviceList, |
254 PrefServiceSyncable::UNSYNCABLE_PREF); | 255 PrefRegistrySyncable::UNSYNCABLE_PREF); |
255 } | 256 } |
256 | 257 |
257 ChromeToMobileService::ChromeToMobileService(Profile* profile) | 258 ChromeToMobileService::ChromeToMobileService(Profile* profile) |
258 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), | 259 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), |
259 profile_(profile), | 260 profile_(profile), |
260 sync_invalidation_enabled_(false) { | 261 sync_invalidation_enabled_(false) { |
261 // TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183 | 262 // TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183 |
262 ProfileSyncService* profile_sync_service = | 263 ProfileSyncService* profile_sync_service = |
263 profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; | 264 profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; |
264 if (profile_sync_service) { | 265 if (profile_sync_service) { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 742 |
742 // Report failure below and ignore the second response. | 743 // Report failure below and ignore the second response. |
743 request_observer_map_.erase(other); | 744 request_observer_map_.erase(other); |
744 break; | 745 break; |
745 } | 746 } |
746 } | 747 } |
747 | 748 |
748 if (observer.get()) | 749 if (observer.get()) |
749 observer->OnSendComplete(success); | 750 observer->OnSendComplete(success); |
750 } | 751 } |
OLD | NEW |