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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc

Issue 674413002: [fsp] Rename ObserveEntry with AddWatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/file_system_provider/fake_provided_file_system .h" 5 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 10
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (offset + length > entry->metadata->size) { 314 if (offset + length > entry->metadata->size) {
315 entry->metadata->size = offset + length; 315 entry->metadata->size = offset + length;
316 entry->contents.resize(entry->metadata->size); 316 entry->contents.resize(entry->metadata->size);
317 } 317 }
318 318
319 entry->contents.replace(offset, length, buffer->data(), length); 319 entry->contents.replace(offset, length, buffer->data(), length);
320 320
321 return PostAbortableTask(base::Bind(callback, base::File::FILE_OK)); 321 return PostAbortableTask(base::Bind(callback, base::File::FILE_OK));
322 } 322 }
323 323
324 ProvidedFileSystemInterface::AbortCallback 324 ProvidedFileSystemInterface::AbortCallback FakeProvidedFileSystem::AddWatcher(
325 FakeProvidedFileSystem::ObserveDirectory(
326 const GURL& origin, 325 const GURL& origin,
327 const base::FilePath& directory_path, 326 const base::FilePath& entry_watcher,
328 bool recursive, 327 bool recursive,
329 bool persistent, 328 bool persistent,
330 const storage::AsyncFileUtil::StatusCallback& callback) { 329 const storage::AsyncFileUtil::StatusCallback& callback) {
331 // TODO(mtomasz): Implement it once needed. 330 // TODO(mtomasz): Implement it once needed.
332 return PostAbortableTask(base::Bind(callback, base::File::FILE_OK)); 331 return PostAbortableTask(base::Bind(callback, base::File::FILE_OK));
333 } 332 }
334 333
335 void FakeProvidedFileSystem::UnobserveEntry( 334 void FakeProvidedFileSystem::RemoveWatcher(
336 const GURL& origin, 335 const GURL& origin,
337 const base::FilePath& entry_path, 336 const base::FilePath& entry_path,
338 bool recursive, 337 bool recursive,
339 const storage::AsyncFileUtil::StatusCallback& callback) { 338 const storage::AsyncFileUtil::StatusCallback& callback) {
340 // TODO(mtomasz): Implement it once needed. 339 // TODO(mtomasz): Implement it once needed.
341 callback.Run(base::File::FILE_OK); 340 callback.Run(base::File::FILE_OK);
342 } 341 }
343 342
344 const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo() 343 const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo()
345 const { 344 const {
346 return file_system_info_; 345 return file_system_info_;
347 } 346 }
348 347
349 RequestManager* FakeProvidedFileSystem::GetRequestManager() { 348 RequestManager* FakeProvidedFileSystem::GetRequestManager() {
350 NOTREACHED(); 349 NOTREACHED();
351 return NULL; 350 return NULL;
352 } 351 }
353 352
354 ObservedEntries* FakeProvidedFileSystem::GetObservedEntries() { 353 Watchers* FakeProvidedFileSystem::GetWatchers() {
355 return &observed_entries_; 354 return &watchers_;
356 } 355 }
357 356
358 void FakeProvidedFileSystem::AddObserver(ProvidedFileSystemObserver* observer) { 357 void FakeProvidedFileSystem::AddObserver(ProvidedFileSystemObserver* observer) {
359 DCHECK(observer); 358 DCHECK(observer);
360 observers_.AddObserver(observer); 359 observers_.AddObserver(observer);
361 } 360 }
362 361
363 void FakeProvidedFileSystem::RemoveObserver( 362 void FakeProvidedFileSystem::RemoveObserver(
364 ProvidedFileSystemObserver* observer) { 363 ProvidedFileSystemObserver* observer) {
365 DCHECK(observer); 364 DCHECK(observer);
366 observers_.RemoveObserver(observer); 365 observers_.RemoveObserver(observer);
367 } 366 }
368 367
369 bool FakeProvidedFileSystem::Notify( 368 bool FakeProvidedFileSystem::Notify(
370 const base::FilePath& observed_path, 369 const base::FilePath& entry_path,
371 bool recursive, 370 bool recursive,
372 ProvidedFileSystemObserver::ChangeType change_type, 371 ProvidedFileSystemObserver::ChangeType change_type,
373 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, 372 scoped_ptr<ProvidedFileSystemObserver::Changes> changes,
374 const std::string& tag) { 373 const std::string& tag) {
375 NOTREACHED(); 374 NOTREACHED();
376 return false; 375 return false;
377 } 376 }
378 377
379 ProvidedFileSystemInterface* FakeProvidedFileSystem::Create( 378 ProvidedFileSystemInterface* FakeProvidedFileSystem::Create(
380 Profile* profile, 379 Profile* profile,
(...skipping 25 matching lines...) Expand all
406 const std::vector<int>& task_ids, 405 const std::vector<int>& task_ids,
407 const storage::AsyncFileUtil::StatusCallback& callback) { 406 const storage::AsyncFileUtil::StatusCallback& callback) {
408 for (size_t i = 0; i < task_ids.size(); ++i) { 407 for (size_t i = 0; i < task_ids.size(); ++i) {
409 tracker_.TryCancel(task_ids[i]); 408 tracker_.TryCancel(task_ids[i]);
410 } 409 }
411 callback.Run(base::File::FILE_OK); 410 callback.Run(base::File::FILE_OK);
412 } 411 }
413 412
414 } // namespace file_system_provider 413 } // namespace file_system_provider
415 } // namespace chromeos 414 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698