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

Side by Side Diff: chrome/browser/chromeos/gdata/drive_api_operations.cc

Issue 10830300: Add GetFilelist/GetFile operations for Drive V2 API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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
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" 7 #include "base/string_number_conversions.h"
8 #include "base/stringprintf.h"
8 #include "chrome/common/net/url_util.h" 9 #include "chrome/common/net/url_util.h"
9 10
10 namespace { 11 namespace {
11 12
12 const char kDriveV2AboutURL[] = "https://www.googleapis.com/drive/v2/about"; 13 const char kDriveV2AboutURL[] = "https://www.googleapis.com/drive/v2/about";
13 const char kDriveV2ApplistURL[] = "https://www.googleapis.com/drive/v2/apps"; 14 const char kDriveV2ApplistURL[] = "https://www.googleapis.com/drive/v2/apps";
14 const char kDriveV2ChangelistURL[] = 15 const char kDriveV2ChangelistURL[] =
15 "https://www.googleapis.com/drive/v2/changes"; 16 "https://www.googleapis.com/drive/v2/changes";
16 17
18 const char kDriveV2FilelistURL[] = "https://www.googleapis.com/drive/v2/files";
19 const char kDriveV2FileURLFormat[] =
20 "https://www.googleapis.com/drive/v2/files/%s";
21
17 } // namespace 22 } // namespace
18 23
19 // TODO(kochi): Rename to namespace drive. http://crbug.com/136371 24 // TODO(kochi): Rename to namespace drive. http://crbug.com/136371
20 namespace gdata { 25 namespace gdata {
21 26
22 //============================== GetAboutOperation ============================= 27 //============================== GetAboutOperation =============================
23 28
24 GetAboutOperation::GetAboutOperation(GDataOperationRegistry* registry, 29 GetAboutOperation::GetAboutOperation(GDataOperationRegistry* registry,
25 const GetDataCallback& callback) 30 const GetDataCallback& callback)
26 : GetDataOperation(registry, callback) {} 31 : GetDataOperation(registry, callback) {}
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 64
60 GetChangelistOperation::~GetChangelistOperation() {} 65 GetChangelistOperation::~GetChangelistOperation() {}
61 66
62 GURL GetChangelistOperation::GetURL() const { 67 GURL GetChangelistOperation::GetURL() const {
63 if (start_changestamp_) 68 if (start_changestamp_)
64 return chrome_common_net::AppendOrReplaceQueryParameter( 69 return chrome_common_net::AppendOrReplaceQueryParameter(
65 url_, "startChangeId", base::Int64ToString(start_changestamp_)); 70 url_, "startChangeId", base::Int64ToString(start_changestamp_));
66 return url_; 71 return url_;
67 } 72 }
68 73
74 //============================= GetFlielistOperation ===========================
75
76 GetFilelistOperation::GetFilelistOperation(
77 GDataOperationRegistry* registry,
78 const GURL& url,
79 const std::string& search_string,
80 const GetDataCallback& callback)
81 : GetDataOperation(registry, callback),
82 url_(kDriveV2FilelistURL),
83 search_string_(search_string) {
84 if (!url.is_empty())
85 url_ = url;
86 }
87
88 GetFilelistOperation::~GetFilelistOperation() {}
89
90 GURL GetFilelistOperation::GetURL() const {
91 if (!search_string_.empty())
satorux1 2012/08/14 13:17:21 add {}
kochi 2012/08/15 04:17:17 Done.
92 return chrome_common_net::AppendOrReplaceQueryParameter(
93 url_, "q", search_string_);
94 return url_;
95 }
96
97 //=============================== GetFlieOperation =============================
98
99 GetFileOperation::GetFileOperation(
100 GDataOperationRegistry* registry,
101 const std::string& file_id,
102 const GetDataCallback& callback)
103 : GetDataOperation(registry, callback),
104 file_id_(file_id) {}
105
106 GetFileOperation::~GetFileOperation() {}
107
108 GURL GetFileOperation::GetURL() const {
109 return GURL(base::StringPrintf(kDriveV2FileURLFormat, file_id_.c_str()));
110 }
111
69 } // namespace gdata 112 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698