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

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

Issue 10274002: Add gdata content search (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style nits Created 8 years, 7 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_file_system_proxy.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.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/platform_file.h" 11 #include "base/platform_file.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
15 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 16 #include "chrome/browser/chromeos/gdata/gdata.pb.h"
16 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 17 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
17 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 18 #include "chrome/browser/chromeos/gdata/gdata_util.h"
18 #include "webkit/blob/shareable_file_reference.h" 19 #include "webkit/blob/shareable_file_reference.h"
19 #include "webkit/fileapi/file_system_file_util_proxy.h" 20 #include "webkit/fileapi/file_system_file_util_proxy.h"
20 #include "webkit/fileapi/file_system_types.h" 21 #include "webkit/fileapi/file_system_types.h"
21 #include "webkit/fileapi/file_system_util.h" 22 #include "webkit/fileapi/file_system_util.h"
22 23
23 using base::MessageLoopProxy; 24 using base::MessageLoopProxy;
24 using content::BrowserThread; 25 using content::BrowserThread;
25 using fileapi::FileSystemOperationInterface; 26 using fileapi::FileSystemOperationInterface;
26 using webkit_blob::ShareableFileReference; 27 using webkit_blob::ShareableFileReference;
27 28
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (!ValidateUrl(file_url, &file_path)) { 146 if (!ValidateUrl(file_url, &file_path)) {
146 base::MessageLoopProxy::current()->PostTask( 147 base::MessageLoopProxy::current()->PostTask(
147 FROM_HERE, 148 FROM_HERE,
148 base::Bind(callback, 149 base::Bind(callback,
149 base::PLATFORM_FILE_ERROR_NOT_FOUND, 150 base::PLATFORM_FILE_ERROR_NOT_FOUND,
150 std::vector<base::FileUtilProxy::Entry>(), 151 std::vector<base::FileUtilProxy::Entry>(),
151 false)); 152 false));
152 return; 153 return;
153 } 154 }
154 155
156 // File paths with type GDATA_SEARH_PATH_QUERY are virtual path reserved for
157 // displaying gdata content search results. They are formatted so their base
158 // name equals to search query. So to get their contents, we have to kick off
159 // content search.
160 if (util::GetSearchPathStatus(file_path) == util::GDATA_SEARCH_PATH_QUERY) {
161 file_system_->SearchAsync(
162 file_path.BaseName().value(),
163 base::Bind(&GDataFileSystemProxy::OnReadDirectory,
164 this,
165 file_system_->hide_hosted_documents(),
166 callback));
167 return;
168 }
169
155 file_system_->ReadDirectoryByPathAsync( 170 file_system_->ReadDirectoryByPathAsync(
156 file_path, 171 file_path,
157 base::Bind(&GDataFileSystemProxy::OnReadDirectory, 172 base::Bind(&GDataFileSystemProxy::OnReadDirectory,
158 this, 173 this,
159 file_system_->hide_hosted_documents(), 174 file_system_->hide_hosted_documents(),
160 callback)); 175 callback));
161 } 176 }
162 177
163 void GDataFileSystemProxy::Remove(const GURL& file_url, bool recursive, 178 void GDataFileSystemProxy::Remove(const GURL& file_url, bool recursive,
164 const FileSystemOperationInterface::StatusCallback& callback) { 179 const FileSystemOperationInterface::StatusCallback& callback) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (hide_hosted_documents && proto.is_hosted_document()) 279 if (hide_hosted_documents && proto.is_hosted_document())
265 continue; 280 continue;
266 entries.push_back( 281 entries.push_back(
267 GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry())); 282 GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry()));
268 } 283 }
269 284
270 callback.Run(base::PLATFORM_FILE_OK, entries, false); 285 callback.Run(base::PLATFORM_FILE_OK, entries, false);
271 } 286 }
272 287
273 } // namespace gdata 288 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.cc ('k') | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698