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

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

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again; base::File changes conflicted. Created 7 years, 10 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
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 #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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 service && service->HasMobiles() && 244 service && service->HasMobiles() &&
244 CanSendURL( 245 CanSendURL(
245 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); 246 browser->tab_strip_model()->GetActiveWebContents()->GetURL());
246 } 247 }
247 browser->command_controller()->command_updater()-> 248 browser->command_controller()->command_updater()->
248 UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); 249 UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
249 return enabled; 250 return enabled;
250 } 251 }
251 252
252 // static 253 // static
253 void ChromeToMobileService::RegisterUserPrefs(PrefServiceSyncable* prefs) { 254 void ChromeToMobileService::RegisterUserPrefs(PrefRegistrySyncable* registry) {
254 prefs->RegisterListPref(prefs::kChromeToMobileDeviceList, 255 registry->RegisterListPref(prefs::kChromeToMobileDeviceList,
255 PrefServiceSyncable::UNSYNCABLE_PREF); 256 PrefRegistrySyncable::UNSYNCABLE_PREF);
256 } 257 }
257 258
258 ChromeToMobileService::ChromeToMobileService(Profile* profile) 259 ChromeToMobileService::ChromeToMobileService(Profile* profile)
259 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), 260 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
260 profile_(profile), 261 profile_(profile),
261 sync_invalidation_enabled_(false) { 262 sync_invalidation_enabled_(false) {
262 // TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183 263 // TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183
263 ProfileSyncService* profile_sync_service = 264 ProfileSyncService* profile_sync_service =
264 profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; 265 profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL;
265 if (profile_sync_service) { 266 if (profile_sync_service) {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 743
743 // Report failure below and ignore the second response. 744 // Report failure below and ignore the second response.
744 request_observer_map_.erase(other); 745 request_observer_map_.erase(other);
745 break; 746 break;
746 } 747 }
747 } 748 }
748 749
749 if (observer.get()) 750 if (observer.get())
750 observer->OnSendComplete(success); 751 observer->OnSendComplete(success);
751 } 752 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_to_mobile_service.h ('k') | chrome/browser/chromeos/language_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698