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

Side by Side Diff: chrome/browser/autofill/autofill_download_url.cc

Issue 11230060: Adding commandline switch and user pref for autofill server url. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changing include after rebasing Created 8 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/autofill/autofill_download_url.h"
6
7 #include "base/command_line.h"
8 #include "base/prefs/public/pref_service_base.h"
9 #include "base/string_util.h"
10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/pref_names.h"
12 #include "googleurl/src/gurl.h"
13
14 const char kDefaultAutofillServiceUrl[] =
15 "https://clients1.google.com/tbproxy/af/";
16
17 #if defined(GOOGLE_CHROME_BUILD)
18 const char kClientName[] = "Google Chrome";
19 #else
20 const char kClientName[] = "Chromium";
21 #endif // defined(GOOGLE_CHROME_BUILD)
22
23 void AutofillDownloadUrl::RegisterPreferences() {
24 DCHECK(pref_service_);
25 if (pref_service_->FindPreference(prefs::kAutofillServiceUrl))
26 return;
Ilya Sherman 2012/10/25 22:52:02 nit: Does anything actually go wrong if we remove
27 pref_service_->RegisterStringPref(prefs::kAutofillServiceUrl,
28 kDefaultAutofillServiceUrl);
Ilya Sherman 2012/10/25 22:52:02 It looks like the default value is the only value
ahutter 2012/10/25 23:56:03 Removed.
29 }
30
31 std::string AutofillDownloadUrl::GetBaseAutofillUrl() {
32 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
33 std::string baseAutofillServiceUrl = command_line.GetSwitchValueASCII(
34 switches::kAutofillServiceUrl);
35 if (ContainsOnlyWhitespaceASCII(baseAutofillServiceUrl))
Ilya Sherman 2012/10/25 22:52:02 Optional nit: Can we just check for baseAutofillSe
ahutter 2012/10/25 23:56:03 Done.
36 baseAutofillServiceUrl =
37 pref_service_->GetString(prefs::kAutofillServiceUrl);
Ilya Sherman 2012/10/25 22:52:02 nit: Please add curly braces to this if-stmt, sinc
38
39 return baseAutofillServiceUrl;
40 }
41
42 GURL AutofillDownloadUrl::GetAutofillRequestUrl() {
43 DCHECK(pref_service_);
44 RegisterPreferences();
45
46 std::string baseAutofillServiceUrl = GetBaseAutofillUrl();
47 return GURL(baseAutofillServiceUrl + "query?client=" + kClientName);
48 }
49
50 GURL AutofillDownloadUrl::GetAutofillUploadUrl() {
51 DCHECK(pref_service_);
52 RegisterPreferences();
53
54 std::string baseAutofillServiceUrl = GetBaseAutofillUrl();
55 return GURL(baseAutofillServiceUrl + "upload?client=" + kClientName);
56 }
57
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698