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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/search_operation.cc

Issue 15737031: Remove drive::file_system::Operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/drive/file_system/search_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/search_operation.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"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 scheduler_(scheduler), 76 scheduler_(scheduler),
77 metadata_(metadata), 77 metadata_(metadata),
78 weak_ptr_factory_(this) { 78 weak_ptr_factory_(this) {
79 } 79 }
80 80
81 SearchOperation::~SearchOperation() { 81 SearchOperation::~SearchOperation() {
82 } 82 }
83 83
84 void SearchOperation::Search(const std::string& search_query, 84 void SearchOperation::Search(const std::string& search_query,
85 const GURL& next_feed, 85 const GURL& next_feed,
86 const SearchOperationCallback& callback) { 86 const SearchCallback& callback) {
87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
88 DCHECK(!callback.is_null()); 88 DCHECK(!callback.is_null());
89 89
90 if (next_feed.is_empty()) { 90 if (next_feed.is_empty()) {
91 // This is first request for the |search_query|. 91 // This is first request for the |search_query|.
92 scheduler_->Search( 92 scheduler_->Search(
93 search_query, 93 search_query,
94 base::Bind(&SearchOperation::SearchAfterGetResourceList, 94 base::Bind(&SearchOperation::SearchAfterGetResourceList,
95 weak_ptr_factory_.GetWeakPtr(), callback)); 95 weak_ptr_factory_.GetWeakPtr(), callback));
96 } else { 96 } else {
97 // There is the remaining result so fetch it. 97 // There is the remaining result so fetch it.
98 scheduler_->ContinueGetResourceList( 98 scheduler_->ContinueGetResourceList(
99 next_feed, 99 next_feed,
100 base::Bind(&SearchOperation::SearchAfterGetResourceList, 100 base::Bind(&SearchOperation::SearchAfterGetResourceList,
101 weak_ptr_factory_.GetWeakPtr(), callback)); 101 weak_ptr_factory_.GetWeakPtr(), callback));
102 } 102 }
103 } 103 }
104 104
105 void SearchOperation::SearchAfterGetResourceList( 105 void SearchOperation::SearchAfterGetResourceList(
106 const SearchOperationCallback& callback, 106 const SearchCallback& callback,
107 google_apis::GDataErrorCode gdata_error, 107 google_apis::GDataErrorCode gdata_error,
108 scoped_ptr<google_apis::ResourceList> resource_list) { 108 scoped_ptr<google_apis::ResourceList> resource_list) {
109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
110 DCHECK(!callback.is_null()); 110 DCHECK(!callback.is_null());
111 111
112 FileError error = util::GDataToFileError(gdata_error); 112 FileError error = util::GDataToFileError(gdata_error);
113 if (error != FILE_ERROR_OK) { 113 if (error != FILE_ERROR_OK) {
114 callback.Run(error, GURL(), scoped_ptr<std::vector<SearchResultInfo> >()); 114 callback.Run(error, GURL(), scoped_ptr<std::vector<SearchResultInfo> >());
115 return; 115 return;
116 } 116 }
(...skipping 24 matching lines...) Expand all
141 base::Passed(&resource_list), 141 base::Passed(&resource_list),
142 result_ptr), 142 result_ptr),
143 base::Bind(&SearchOperation::SearchAfterRefreshEntry, 143 base::Bind(&SearchOperation::SearchAfterRefreshEntry,
144 weak_ptr_factory_.GetWeakPtr(), 144 weak_ptr_factory_.GetWeakPtr(),
145 callback, 145 callback,
146 next_feed, 146 next_feed,
147 base::Passed(&result))); 147 base::Passed(&result)));
148 } 148 }
149 149
150 void SearchOperation::SearchAfterRefreshEntry( 150 void SearchOperation::SearchAfterRefreshEntry(
151 const SearchOperationCallback& callback, 151 const SearchCallback& callback,
152 const GURL& next_feed, 152 const GURL& next_feed,
153 scoped_ptr<std::vector<SearchResultInfo> > result, 153 scoped_ptr<std::vector<SearchResultInfo> > result,
154 FileError error) { 154 FileError error) {
155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
156 DCHECK(!callback.is_null()); 156 DCHECK(!callback.is_null());
157 DCHECK(result); 157 DCHECK(result);
158 158
159 if (error != FILE_ERROR_OK) { 159 if (error != FILE_ERROR_OK) {
160 callback.Run(error, GURL(), scoped_ptr<std::vector<SearchResultInfo> >()); 160 callback.Run(error, GURL(), scoped_ptr<std::vector<SearchResultInfo> >());
161 return; 161 return;
162 } 162 }
163 163
164 callback.Run(error, next_feed, result.Pass()); 164 callback.Run(error, next_feed, result.Pass());
165 } 165 }
166 166
167 } // namespace file_system 167 } // namespace file_system
168 } // namespace drive 168 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/search_operation.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698