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/fake_drive_service.h" | 5 #include "chrome/browser/google_apis/fake_drive_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 DCHECK(!callback.is_null()); | 255 DCHECK(!callback.is_null()); |
256 | 256 |
257 GetResourceListInternal(0, // start changestamp | 257 GetResourceListInternal(0, // start changestamp |
258 search_query, | 258 search_query, |
259 std::string(), // no directory resource id, | 259 std::string(), // no directory resource id, |
260 0, // start offset | 260 0, // start offset |
261 default_max_results_, | 261 default_max_results_, |
262 callback); | 262 callback); |
263 } | 263 } |
264 | 264 |
265 void FakeDriveService::SearchInDirectory( | 265 void FakeDriveService::SearchByTitle( |
266 const std::string& search_query, | 266 const std::string& title, |
267 const std::string& directory_resource_id, | 267 const std::string& directory_resource_id, |
268 const GetResourceListCallback& callback) { | 268 const GetResourceListCallback& callback) { |
269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
270 DCHECK(!search_query.empty()); | 270 DCHECK(!title.empty()); |
271 DCHECK(!directory_resource_id.empty()); | |
272 DCHECK(!callback.is_null()); | 271 DCHECK(!callback.is_null()); |
273 | 272 |
| 273 // Note: the search implementation here doesn't support quotation unescape, |
| 274 // so don't escape here. |
274 GetResourceListInternal(0, // start changestamp | 275 GetResourceListInternal(0, // start changestamp |
275 search_query, | 276 base::StringPrintf("title:'%s'", title.c_str()), |
276 directory_resource_id, | 277 directory_resource_id, |
277 0, // start offset | 278 0, // start offset |
278 default_max_results_, | 279 default_max_results_, |
279 callback); | 280 callback); |
280 } | 281 } |
281 | 282 |
282 void FakeDriveService::GetChangeList(int64 start_changestamp, | 283 void FakeDriveService::GetChangeList(int64 start_changestamp, |
283 const GetResourceListCallback& callback) { | 284 const GetResourceListCallback& callback) { |
284 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
285 DCHECK(!callback.is_null()); | 286 DCHECK(!callback.is_null()); |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 | 1337 |
1337 ++resource_list_load_count_; | 1338 ++resource_list_load_count_; |
1338 MessageLoop::current()->PostTask( | 1339 MessageLoop::current()->PostTask( |
1339 FROM_HERE, | 1340 FROM_HERE, |
1340 base::Bind(callback, | 1341 base::Bind(callback, |
1341 HTTP_SUCCESS, | 1342 HTTP_SUCCESS, |
1342 base::Passed(&resource_list))); | 1343 base::Passed(&resource_list))); |
1343 } | 1344 } |
1344 | 1345 |
1345 } // namespace google_apis | 1346 } // namespace google_apis |
OLD | NEW |