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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_url.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/printing/cloud_print/cloud_print_url.h" 5 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
11 #include "chrome/browser/prefs/pref_registry_syncable.h"
11 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 17
17 const char kDefaultCloudPrintServiceURL[] = "https://www.google.com/cloudprint"; 18 const char kDefaultCloudPrintServiceURL[] = "https://www.google.com/cloudprint";
18 const char kDefaultCloudPrintSigninURL[] = 19 const char kDefaultCloudPrintSigninURL[] =
19 "https://accounts.google.com/ServiceLogin?" 20 "https://accounts.google.com/ServiceLogin?"
20 "service=cloudprint&continue=https%3A%2F%2Fwww.google.com%2Fcloudprint"; 21 "service=cloudprint&continue=https%3A%2F%2Fwww.google.com%2Fcloudprint";
21 22
22 const char kLearnMoreURL[] = 23 const char kLearnMoreURL[] =
23 "https://www.google.com/support/cloudprint"; 24 "https://www.google.com/support/cloudprint";
24 const char kTestPageURL[] = 25 const char kTestPageURL[] =
25 "http://www.google.com/landing/cloudprint/enable.html?print=true"; 26 "http://www.google.com/landing/cloudprint/enable.html?print=true";
26 27
27 void CloudPrintURL::RegisterPreferences() { 28 void CloudPrintURL::RegisterPreferences() {
28 DCHECK(profile_); 29 DCHECK(profile_);
29 PrefServiceSyncable* pref_service = profile_->GetPrefs(); 30 PrefService* pref_service = profile_->GetPrefs();
31 // TODO(joi): Do all registration up front.
32 scoped_refptr<PrefRegistrySyncable> registry(
33 static_cast<PrefRegistrySyncable*>(
34 pref_service->DeprecatedGetPrefRegistry()));
30 if (!pref_service->FindPreference(prefs::kCloudPrintServiceURL)) { 35 if (!pref_service->FindPreference(prefs::kCloudPrintServiceURL)) {
31 pref_service->RegisterStringPref(prefs::kCloudPrintServiceURL, 36 registry->RegisterStringPref(prefs::kCloudPrintServiceURL,
32 kDefaultCloudPrintServiceURL, 37 kDefaultCloudPrintServiceURL,
33 PrefServiceSyncable::UNSYNCABLE_PREF); 38 PrefRegistrySyncable::UNSYNCABLE_PREF);
34 } 39 }
35 if (!pref_service->FindPreference(prefs::kCloudPrintSigninURL)) { 40 if (!pref_service->FindPreference(prefs::kCloudPrintSigninURL)) {
36 pref_service->RegisterStringPref(prefs::kCloudPrintSigninURL, 41 registry->RegisterStringPref(prefs::kCloudPrintSigninURL,
37 kDefaultCloudPrintSigninURL, 42 kDefaultCloudPrintSigninURL,
38 PrefServiceSyncable::UNSYNCABLE_PREF); 43 PrefRegistrySyncable::UNSYNCABLE_PREF);
39 } 44 }
40 } 45 }
41 46
42 // Returns the root service URL for the cloud print service. The default is to 47 // Returns the root service URL for the cloud print service. The default is to
43 // point at the Google Cloud Print service. This can be overridden by the 48 // point at the Google Cloud Print service. This can be overridden by the
44 // command line or by the user preferences. 49 // command line or by the user preferences.
45 GURL CloudPrintURL::GetCloudPrintServiceURL() { 50 GURL CloudPrintURL::GetCloudPrintServiceURL() {
46 DCHECK(profile_); 51 DCHECK(profile_);
47 RegisterPreferences(); 52 RegisterPreferences();
48 53
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 106
102 GURL CloudPrintURL::GetCloudPrintLearnMoreURL() { 107 GURL CloudPrintURL::GetCloudPrintLearnMoreURL() {
103 GURL cloud_print_learn_more_url(kLearnMoreURL); 108 GURL cloud_print_learn_more_url(kLearnMoreURL);
104 return cloud_print_learn_more_url; 109 return cloud_print_learn_more_url;
105 } 110 }
106 111
107 GURL CloudPrintURL::GetCloudPrintTestPageURL() { 112 GURL CloudPrintURL::GetCloudPrintTestPageURL() {
108 GURL cloud_print_learn_more_url(kTestPageURL); 113 GURL cloud_print_learn_more_url(kTestPageURL);
109 return cloud_print_learn_more_url; 114 return cloud_print_learn_more_url;
110 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/session_startup_pref_unittest.cc ('k') | chrome/browser/printing/print_dialog_cloud.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698