| 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_contacts_operations.h" | 5 #include "chrome/browser/google_apis/gdata_contacts_operations.h" |
| 6 | 6 |
| 7 #include "chrome/browser/google_apis/time_util.h" | 7 #include "chrome/browser/google_apis/time_util.h" |
| 8 #include "chrome/common/net/url_util.h" | |
| 9 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "net/base/url_util.h" |
| 10 | 10 |
| 11 namespace google_apis { | 11 namespace google_apis { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // URL requesting all contact groups. | 15 // URL requesting all contact groups. |
| 16 const char kGetContactGroupsURL[] = | 16 const char kGetContactGroupsURL[] = |
| 17 "https://www.google.com/m8/feeds/groups/default/full?alt=json"; | 17 "https://www.google.com/m8/feeds/groups/default/full?alt=json"; |
| 18 | 18 |
| 19 // URL requesting all contacts. | 19 // URL requesting all contacts. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 GetContactsOperation::~GetContactsOperation() {} | 67 GetContactsOperation::~GetContactsOperation() {} |
| 68 | 68 |
| 69 GURL GetContactsOperation::GetURL() const { | 69 GURL GetContactsOperation::GetURL() const { |
| 70 if (!feed_url_for_testing_.is_empty()) | 70 if (!feed_url_for_testing_.is_empty()) |
| 71 return GURL(feed_url_for_testing_); | 71 return GURL(feed_url_for_testing_); |
| 72 | 72 |
| 73 GURL url(kGetContactsURL); | 73 GURL url(kGetContactsURL); |
| 74 | 74 |
| 75 if (!group_id_.empty()) { | 75 if (!group_id_.empty()) { |
| 76 url = chrome_common_net::AppendQueryParameter( | 76 url = net::AppendQueryParameter(url, kGetContactsGroupParam, group_id_); |
| 77 url, kGetContactsGroupParam, group_id_); | |
| 78 } | 77 } |
| 79 if (!min_update_time_.is_null()) { | 78 if (!min_update_time_.is_null()) { |
| 80 std::string time_rfc3339 = util::FormatTimeAsString(min_update_time_); | 79 std::string time_rfc3339 = util::FormatTimeAsString(min_update_time_); |
| 81 url = chrome_common_net::AppendQueryParameter( | 80 url = net::AppendQueryParameter( |
| 82 url, kGetContactsUpdatedMinParam, time_rfc3339); | 81 url, kGetContactsUpdatedMinParam, time_rfc3339); |
| 83 } | 82 } |
| 84 return url; | 83 return url; |
| 85 } | 84 } |
| 86 | 85 |
| 87 //========================== GetContactPhotoOperation ========================== | 86 //========================== GetContactPhotoOperation ========================== |
| 88 | 87 |
| 89 GetContactPhotoOperation::GetContactPhotoOperation( | 88 GetContactPhotoOperation::GetContactPhotoOperation( |
| 90 OperationRegistry* registry, | 89 OperationRegistry* registry, |
| 91 net::URLRequestContextGetter* url_request_context_getter, | 90 net::URLRequestContextGetter* url_request_context_getter, |
| 92 const GURL& photo_url, | 91 const GURL& photo_url, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS); | 110 OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS); |
| 112 } | 111 } |
| 113 | 112 |
| 114 void GetContactPhotoOperation::RunCallbackOnPrematureFailure( | 113 void GetContactPhotoOperation::RunCallbackOnPrematureFailure( |
| 115 GDataErrorCode code) { | 114 GDataErrorCode code) { |
| 116 scoped_ptr<std::string> data(new std::string); | 115 scoped_ptr<std::string> data(new std::string); |
| 117 callback_.Run(code, data.Pass()); | 116 callback_.Run(code, data.Pass()); |
| 118 } | 117 } |
| 119 | 118 |
| 120 } // namespace google_apis | 119 } // namespace google_apis |
| OLD | NEW |