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

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

Issue 10634020: [FileManager] Do drive search incrementally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit that crept up while rebasing 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/gdata_operations.h" 5 #include "chrome/browser/chromeos/gdata/gdata_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 "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" 10 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 "https://docs.google.com/feeds/default/private/full/%s"; 45 "https://docs.google.com/feeds/default/private/full/%s";
46 46
47 // Metadata feed with things like user quota. 47 // Metadata feed with things like user quota.
48 const char kAccountMetadataURL[] = 48 const char kAccountMetadataURL[] =
49 "https://docs.google.com/feeds/metadata/default"; 49 "https://docs.google.com/feeds/metadata/default";
50 50
51 const char kUploadContentRange[] = "Content-Range: bytes "; 51 const char kUploadContentRange[] = "Content-Range: bytes ";
52 const char kUploadContentType[] = "X-Upload-Content-Type: "; 52 const char kUploadContentType[] = "X-Upload-Content-Type: ";
53 const char kUploadContentLength[] = "X-Upload-Content-Length: "; 53 const char kUploadContentLength[] = "X-Upload-Content-Length: ";
54 54
55 #ifndef NDEBUG 55 #ifndef NDEBUG
Oleg Eterevsky 2012/07/31 11:04:49 Do we need this #ifndef? It looks like the values
tbarzic 2012/07/31 17:46:48 We don't necessary need it, but I guess it could b
56 // Use smaller 'page' size while debugging to ensure we hit feed reload 56 // Use smaller 'page' size while debugging to ensure we hit feed reload
57 // almost always. Be careful not to use something too small on account that 57 // almost always. Be careful not to use something too small on account that
58 // have many items because server side 503 error might kick in. 58 // have many items because server side 503 error might kick in.
59 const int kMaxDocumentsPerFeed = 1000; 59 const int kMaxDocumentsPerFeed = 1000;
60 const int kMaxDocumentsPerSearchFeed = 50;
60 #else 61 #else
61 const int kMaxDocumentsPerFeed = 1000; 62 const int kMaxDocumentsPerFeed = 1000;
63 const int kMaxDocumentsPerSearchFeed = 50;
62 #endif 64 #endif
63 65
64 const char kFeedField[] = "feed"; 66 const char kFeedField[] = "feed";
65 67
66 // Templates for file uploading. 68 // Templates for file uploading.
67 const char kUploadParamConvertKey[] = "convert"; 69 const char kUploadParamConvertKey[] = "convert";
68 const char kUploadParamConvertValue[] = "false"; 70 const char kUploadParamConvertValue[] = "false";
69 const char kUploadResponseLocation[] = "location"; 71 const char kUploadResponseLocation[] = "location";
70 const char kUploadResponseRange[] = "range"; 72 const char kUploadResponseRange[] = "range";
71 73
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 directory_resource_id_(directory_resource_id) { 154 directory_resource_id_(directory_resource_id) {
153 } 155 }
154 156
155 GetDocumentsOperation::~GetDocumentsOperation() {} 157 GetDocumentsOperation::~GetDocumentsOperation() {}
156 158
157 void GetDocumentsOperation::SetUrl(const GURL& url) { 159 void GetDocumentsOperation::SetUrl(const GURL& url) {
158 override_url_ = url; 160 override_url_ = url;
159 } 161 }
160 162
161 GURL GetDocumentsOperation::GetURL() const { 163 GURL GetDocumentsOperation::GetURL() const {
164 int max_docs = search_string_.empty() ? kMaxDocumentsPerFeed :
165 kMaxDocumentsPerSearchFeed;
166
162 if (!override_url_.is_empty()) 167 if (!override_url_.is_empty())
163 return AddFeedUrlParams(override_url_, 168 return AddFeedUrlParams(override_url_,
164 kMaxDocumentsPerFeed, 169 max_docs,
165 0, 170 0,
166 std::string()); 171 search_string_);
167 172
168 if (start_changestamp_ == 0) { 173 if (start_changestamp_ == 0) {
169 return AddFeedUrlParams(FormatDocumentListURL(directory_resource_id_), 174 return AddFeedUrlParams(FormatDocumentListURL(directory_resource_id_),
170 kMaxDocumentsPerFeed, 175 max_docs,
171 0, 176 0,
172 search_string_); 177 search_string_);
173 } 178 }
174 179
175 return AddFeedUrlParams(GURL(kGetChangesListURL), 180 return AddFeedUrlParams(GURL(kGetChangesListURL),
176 kMaxDocumentsPerFeed, 181 kMaxDocumentsPerFeed,
177 start_changestamp_, 182 start_changestamp_,
178 std::string()); 183 std::string());
179 } 184 }
180 185
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 return true; 874 return true;
870 } 875 }
871 876
872 void ResumeUploadOperation::OnURLFetchUploadProgress( 877 void ResumeUploadOperation::OnURLFetchUploadProgress(
873 const URLFetcher* source, int64 current, int64 total) { 878 const URLFetcher* source, int64 current, int64 total) {
874 // Adjust the progress values according to the range currently uploaded. 879 // Adjust the progress values according to the range currently uploaded.
875 NotifyProgress(params_.start_range + current, params_.content_length); 880 NotifyProgress(params_.start_range + current, params_.content_length);
876 } 881 }
877 882
878 } // namespace gdata 883 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc ('k') | chrome/browser/chromeos/gdata/mock_gdata_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698