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

Side by Side Diff: chrome/browser/google_apis/gdata_wapi_service.cc

Issue 14146006: Refactoring: replace SearchInDirectory by SearchByTitle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/google_apis/gdata_wapi_service.h" 5 #include "chrome/browser/google_apis/gdata_wapi_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/message_loop_proxy.h" 11 #include "base/message_loop_proxy.h"
12 #include "base/stringprintf.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "chrome/browser/google_apis/auth_service.h" 14 #include "chrome/browser/google_apis/auth_service.h"
14 #include "chrome/browser/google_apis/drive_api_parser.h" 15 #include "chrome/browser/google_apis/drive_api_parser.h"
16 #include "chrome/browser/google_apis/drive_api_util.h"
15 #include "chrome/browser/google_apis/gdata_wapi_operations.h" 17 #include "chrome/browser/google_apis/gdata_wapi_operations.h"
16 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 18 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
17 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" 19 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
18 #include "chrome/browser/google_apis/operation_runner.h" 20 #include "chrome/browser/google_apis/operation_runner.h"
19 #include "chrome/browser/google_apis/time_util.h" 21 #include "chrome/browser/google_apis/time_util.h"
20 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
21 #include "net/base/url_util.h" 23 #include "net/base/url_util.h"
22 24
23 using content::BrowserThread; 25 using content::BrowserThread;
24 26
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 new GetResourceListOperation(operation_registry(), 216 new GetResourceListOperation(operation_registry(),
215 url_request_context_getter_, 217 url_request_context_getter_,
216 url_generator_, 218 url_generator_,
217 GURL(), // No override url 219 GURL(), // No override url
218 0, // start changestamp 220 0, // start changestamp
219 search_query, 221 search_query,
220 std::string(), // no directory resource id 222 std::string(), // no directory resource id
221 callback)); 223 callback));
222 } 224 }
223 225
224 void GDataWapiService::SearchInDirectory( 226 void GDataWapiService::SearchByTitle(
225 const std::string& search_query, 227 const std::string& title,
226 const std::string& directory_resource_id, 228 const std::string& directory_resource_id,
227 const GetResourceListCallback& callback) { 229 const GetResourceListCallback& callback) {
228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
229 DCHECK(!search_query.empty()); 231 DCHECK(!title.empty());
230 DCHECK(!directory_resource_id.empty());
231 DCHECK(!callback.is_null()); 232 DCHECK(!callback.is_null());
232 233
233 runner_->StartOperationWithRetry( 234 runner_->StartOperationWithRetry(
234 new GetResourceListOperation( 235 new GetResourceListOperation(
235 operation_registry(), 236 operation_registry(),
236 url_request_context_getter_, 237 url_request_context_getter_,
237 url_generator_, 238 url_generator_,
238 GURL(), // No override url 239 GURL(), // No override url
239 0, // start changestamp 240 0, // start changestamp
240 search_query, 241 base::StringPrintf(
242 "title:'%s'",
243 drive::util::EscapeQueryStringValue(title).c_str()),
241 directory_resource_id, 244 directory_resource_id,
242 callback)); 245 callback));
243 } 246 }
244 247
245 void GDataWapiService::GetChangeList(int64 start_changestamp, 248 void GDataWapiService::GetChangeList(int64 start_changestamp,
246 const GetResourceListCallback& callback) { 249 const GetResourceListCallback& callback) {
247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
248 DCHECK(!callback.is_null()); 251 DCHECK(!callback.is_null());
249 252
250 runner_->StartOperationWithRetry( 253 runner_->StartOperationWithRetry(
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 603 }
601 604
602 void GDataWapiService::OnProgressUpdate( 605 void GDataWapiService::OnProgressUpdate(
603 const OperationProgressStatusList& list) { 606 const OperationProgressStatusList& list) {
604 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
605 FOR_EACH_OBSERVER( 608 FOR_EACH_OBSERVER(
606 DriveServiceObserver, observers_, OnProgressUpdate(list)); 609 DriveServiceObserver, observers_, OnProgressUpdate(list));
607 } 610 }
608 611
609 } // namespace google_apis 612 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698