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/chromeos/gdata/drive_api_operations.h" | 5 #include "chrome/browser/chromeos/gdata/drive_api_operations.h" |
6 | 6 |
| 7 #include "base/string_number_conversions.h" |
| 8 #include "chrome/common/net/url_util.h" |
| 9 |
7 namespace { | 10 namespace { |
8 | 11 |
9 const char kDriveV2AboutURL[] = "https://www.googleapis.com/drive/v2/about"; | 12 const char kDriveV2AboutURL[] = "https://www.googleapis.com/drive/v2/about"; |
10 const char kDriveV2ApplistURL[] = "https://www.googleapis.com/drive/v2/apps"; | 13 const char kDriveV2ApplistURL[] = "https://www.googleapis.com/drive/v2/apps"; |
| 14 const char kDriveV2ChangelistURL[] = |
| 15 "https://www.googleapis.com/drive/v2/changes"; |
11 | 16 |
12 } // namespace | 17 } // namespace |
13 | 18 |
14 // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 | 19 // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 |
15 namespace gdata { | 20 namespace gdata { |
16 | 21 |
17 //============================== GetAboutOperation ============================= | 22 //============================== GetAboutOperation ============================= |
18 | 23 |
19 GetAboutOperation::GetAboutOperation(GDataOperationRegistry* registry, | 24 GetAboutOperation::GetAboutOperation(GDataOperationRegistry* registry, |
20 const GetDataCallback& callback) | 25 const GetDataCallback& callback) |
(...skipping 10 matching lines...) Expand all Loading... |
31 GetApplistOperation::GetApplistOperation(GDataOperationRegistry* registry, | 36 GetApplistOperation::GetApplistOperation(GDataOperationRegistry* registry, |
32 const GetDataCallback& callback) | 37 const GetDataCallback& callback) |
33 : GetDataOperation(registry, callback) {} | 38 : GetDataOperation(registry, callback) {} |
34 | 39 |
35 GetApplistOperation::~GetApplistOperation() {} | 40 GetApplistOperation::~GetApplistOperation() {} |
36 | 41 |
37 GURL GetApplistOperation::GetURL() const { | 42 GURL GetApplistOperation::GetURL() const { |
38 return GURL(kDriveV2ApplistURL); | 43 return GURL(kDriveV2ApplistURL); |
39 } | 44 } |
40 | 45 |
| 46 //============================ GetChangelistOperation ========================== |
| 47 |
| 48 GetChangelistOperation::GetChangelistOperation( |
| 49 GDataOperationRegistry* registry, |
| 50 int64 start_changestamp, |
| 51 const GetDataCallback& callback) |
| 52 : GetDataOperation(registry, callback), |
| 53 start_changestamp_(start_changestamp) {} |
| 54 |
| 55 GetChangelistOperation::~GetChangelistOperation() {} |
| 56 |
| 57 void GetChangelistOperation::SetURL(const GURL& url) { |
| 58 override_url_ = url; |
| 59 } |
| 60 |
| 61 GURL GetChangelistOperation::GetURL() const { |
| 62 GURL url(kDriveV2ChangelistURL); |
| 63 if (!override_url_.is_empty()) |
| 64 url = override_url_; |
| 65 if (start_changestamp_) |
| 66 return chrome_common_net::AppendOrReplaceQueryParameter( |
| 67 url, "startChangeId", base::Int64ToString(start_changestamp_)); |
| 68 return url; |
| 69 } |
| 70 |
41 } // namespace gdata | 71 } // namespace gdata |
OLD | NEW |