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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_url.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix. And rebase Created 9 years, 7 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 "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 14
15 const char kDefaultCloudPrintServiceURL[] = "https://www.google.com/cloudprint"; 15 const char kDefaultCloudPrintServiceURL[] = "https://www.google.com/cloudprint";
16 const char kLearnMoreURL[] = 16 const char kLearnMoreURL[] =
17 "https://www.google.com/support/cloudprint"; 17 "https://www.google.com/support/cloudprint";
18 const char kTestPageURL[] = 18 const char kTestPageURL[] =
19 "http://www.google.com/landing/cloudprint/enable.html?print=true"; 19 "http://www.google.com/landing/cloudprint/enable.html?print=true";
20 20
21 void CloudPrintURL::RegisterPreferences() { 21 void CloudPrintURL::RegisterPreferences() {
22 DCHECK(profile_); 22 DCHECK(profile_);
23 PrefService* pref_service = profile_->GetPrefs(); 23 PrefService* pref_service = profile_->GetPrefs();
24 if (pref_service->FindPreference(prefs::kCloudPrintServiceURL)) 24 if (pref_service->FindPreference(prefs::kCloudPrintServiceURL))
25 return; 25 return;
26 pref_service->RegisterStringPref(prefs::kCloudPrintServiceURL, 26 pref_service->RegisterStringPref(prefs::kCloudPrintServiceURL,
27 kDefaultCloudPrintServiceURL); 27 kDefaultCloudPrintServiceURL,
28 PrefService::UNSYNCABLE_PREF);
28 } 29 }
29 30
30 // Returns the root service URL for the cloud print service. The default is to 31 // Returns the root service URL for the cloud print service. The default is to
31 // point at the Google Cloud Print service. This can be overridden by the 32 // point at the Google Cloud Print service. This can be overridden by the
32 // command line or by the user preferences. 33 // command line or by the user preferences.
33 GURL CloudPrintURL::GetCloudPrintServiceURL() { 34 GURL CloudPrintURL::GetCloudPrintServiceURL() {
34 DCHECK(profile_); 35 DCHECK(profile_);
35 RegisterPreferences(); 36 RegisterPreferences();
36 37
37 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 38 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
(...skipping 28 matching lines...) Expand all
66 67
67 GURL CloudPrintURL::GetCloudPrintLearnMoreURL() { 68 GURL CloudPrintURL::GetCloudPrintLearnMoreURL() {
68 GURL cloud_print_learn_more_url(kLearnMoreURL); 69 GURL cloud_print_learn_more_url(kLearnMoreURL);
69 return cloud_print_learn_more_url; 70 return cloud_print_learn_more_url;
70 } 71 }
71 72
72 GURL CloudPrintURL::GetCloudPrintTestPageURL() { 73 GURL CloudPrintURL::GetCloudPrintTestPageURL() {
73 GURL cloud_print_learn_more_url(kTestPageURL); 74 GURL cloud_print_learn_more_url(kTestPageURL);
74 return cloud_print_learn_more_url; 75 return cloud_print_learn_more_url;
75 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/session_startup_pref.cc ('k') | chrome/browser/printing/print_dialog_cloud.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698