OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/google_apis/gdata_wapi_url_generator.h" | 5 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "chrome/common/net/url_util.h" | 9 #include "chrome/common/net/url_util.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // URL requesting documents list of changes to documents collections. | 50 // URL requesting documents list of changes to documents collections. |
51 const char kGetChangesListURL[] = "/feeds/default/private/changes"; | 51 const char kGetChangesListURL[] = "/feeds/default/private/changes"; |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 const char GDataWapiUrlGenerator::kBaseUrlForProduction[] = | 55 const char GDataWapiUrlGenerator::kBaseUrlForProduction[] = |
56 "https://docs.google.com/"; | 56 "https://docs.google.com/"; |
57 | 57 |
58 // static | 58 // static |
59 GURL GDataWapiUrlGenerator::GetBaseUrlForTesting(int port) { | |
60 return GURL(base::StringPrintf("http://127.0.0.1:%d/", port)); | |
61 } | |
62 | |
63 // static | |
64 GURL GDataWapiUrlGenerator::AddStandardUrlParams(const GURL& url) { | 59 GURL GDataWapiUrlGenerator::AddStandardUrlParams(const GURL& url) { |
65 GURL result = | 60 GURL result = |
66 chrome_common_net::AppendOrReplaceQueryParameter(url, "v", "3"); | 61 chrome_common_net::AppendOrReplaceQueryParameter(url, "v", "3"); |
67 result = | 62 result = |
68 chrome_common_net::AppendOrReplaceQueryParameter(result, "alt", "json"); | 63 chrome_common_net::AppendOrReplaceQueryParameter(result, "alt", "json"); |
69 return result; | 64 return result; |
70 } | 65 } |
71 | 66 |
72 // static | 67 // static |
73 GURL GDataWapiUrlGenerator::AddMetadataUrlParams(const GURL& url) { | 68 GURL GDataWapiUrlGenerator::AddMetadataUrlParams(const GURL& url) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 151 |
157 GURL GDataWapiUrlGenerator::GenerateResourceListRootUrl() const { | 152 GURL GDataWapiUrlGenerator::GenerateResourceListRootUrl() const { |
158 return AddStandardUrlParams(base_url_.Resolve(kResourceListRootURL)); | 153 return AddStandardUrlParams(base_url_.Resolve(kResourceListRootURL)); |
159 } | 154 } |
160 | 155 |
161 GURL GDataWapiUrlGenerator::GenerateAccountMetadataUrl() const { | 156 GURL GDataWapiUrlGenerator::GenerateAccountMetadataUrl() const { |
162 return AddMetadataUrlParams(base_url_.Resolve(kAccountMetadataURL)); | 157 return AddMetadataUrlParams(base_url_.Resolve(kAccountMetadataURL)); |
163 } | 158 } |
164 | 159 |
165 } // namespace google_apis | 160 } // namespace google_apis |
OLD | NEW |