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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // cloud_print_app/manifest.json. If it's matched, print driver dialog will | 21 // cloud_print_app/manifest.json. If it's matched, print driver dialog will |
22 // open sign-in page in separate window. | 22 // open sign-in page in separate window. |
23 const char kDefaultCloudPrintServiceURL[] = "https://www.google.com/cloudprint"; | 23 const char kDefaultCloudPrintServiceURL[] = "https://www.google.com/cloudprint"; |
24 | 24 |
25 const char kLearnMoreURL[] = | 25 const char kLearnMoreURL[] = |
26 "https://www.google.com/support/cloudprint"; | 26 "https://www.google.com/support/cloudprint"; |
27 const char kTestPageURL[] = | 27 const char kTestPageURL[] = |
28 "http://www.google.com/landing/cloudprint/enable.html?print=true"; | 28 "http://www.google.com/landing/cloudprint/enable.html?print=true"; |
29 | 29 |
30 // static | 30 // static |
31 void CloudPrintURL::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 31 void CloudPrintURL::RegisterUserPrefs( |
32 registry->RegisterStringPref(prefs::kCloudPrintServiceURL, | 32 user_prefs::PrefRegistrySyncable* registry) { |
33 kDefaultCloudPrintServiceURL, | 33 registry->RegisterStringPref( |
34 PrefRegistrySyncable::UNSYNCABLE_PREF); | 34 prefs::kCloudPrintServiceURL, |
| 35 kDefaultCloudPrintServiceURL, |
| 36 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
35 std::string url = GaiaUrls::GetInstance()->service_login_url(); | 37 std::string url = GaiaUrls::GetInstance()->service_login_url(); |
36 url.append("?service=cloudprint&sarp=1&continue="); | 38 url.append("?service=cloudprint&sarp=1&continue="); |
37 url.append(net::EscapeQueryParamValue(kDefaultCloudPrintServiceURL, false)); | 39 url.append(net::EscapeQueryParamValue(kDefaultCloudPrintServiceURL, false)); |
38 registry->RegisterStringPref(prefs::kCloudPrintSigninURL, url, | 40 registry->RegisterStringPref( |
39 PrefRegistrySyncable::UNSYNCABLE_PREF); | 41 prefs::kCloudPrintSigninURL, |
| 42 url, |
| 43 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
40 } | 44 } |
41 | 45 |
42 // Returns the root service URL for the cloud print service. The default is to | 46 // 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 | 47 // point at the Google Cloud Print service. This can be overridden by the |
44 // command line or by the user preferences. | 48 // command line or by the user preferences. |
45 GURL CloudPrintURL::GetCloudPrintServiceURL() { | 49 GURL CloudPrintURL::GetCloudPrintServiceURL() { |
46 DCHECK(profile_); | 50 DCHECK(profile_); |
47 | 51 |
48 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 52 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
49 GURL cloud_print_service_url = GURL(command_line.GetSwitchValueASCII( | 53 GURL cloud_print_service_url = GURL(command_line.GetSwitchValueASCII( |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 103 |
100 GURL CloudPrintURL::GetCloudPrintLearnMoreURL() { | 104 GURL CloudPrintURL::GetCloudPrintLearnMoreURL() { |
101 GURL cloud_print_learn_more_url(kLearnMoreURL); | 105 GURL cloud_print_learn_more_url(kLearnMoreURL); |
102 return cloud_print_learn_more_url; | 106 return cloud_print_learn_more_url; |
103 } | 107 } |
104 | 108 |
105 GURL CloudPrintURL::GetCloudPrintTestPageURL() { | 109 GURL CloudPrintURL::GetCloudPrintTestPageURL() { |
106 GURL cloud_print_learn_more_url(kTestPageURL); | 110 GURL cloud_print_learn_more_url(kTestPageURL); |
107 return cloud_print_learn_more_url; | 111 return cloud_print_learn_more_url; |
108 } | 112 } |
OLD | NEW |