| OLD | NEW |
| 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 false /* don't sync 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 Loading... |
| 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 } |
| OLD | NEW |