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

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

Issue 408143014: Rename OperationObserver to OperationDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/touch_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/touch_operation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "chrome/browser/chromeos/drive/file_change.h" 11 #include "chrome/browser/chromeos/drive/file_change.h"
12 #include "chrome/browser/chromeos/drive/file_errors.h" 12 #include "chrome/browser/chromeos/drive/file_errors.h"
13 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" 13 #include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
14 #include "chrome/browser/chromeos/drive/resource_metadata.h" 14 #include "chrome/browser/chromeos/drive/resource_metadata.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 16
17 using content::BrowserThread; 17 using content::BrowserThread;
18 18
19 namespace drive { 19 namespace drive {
20 namespace file_system { 20 namespace file_system {
21 21
22 namespace { 22 namespace {
23 23
(...skipping 15 matching lines...) Expand all
39 if (!last_modified_time.is_null()) 39 if (!last_modified_time.is_null())
40 file_info->set_last_modified(last_modified_time.ToInternalValue()); 40 file_info->set_last_modified(last_modified_time.ToInternalValue());
41 entry->set_metadata_edit_state(ResourceEntry::DIRTY); 41 entry->set_metadata_edit_state(ResourceEntry::DIRTY);
42 entry->set_modification_date(base::Time::Now().ToInternalValue()); 42 entry->set_modification_date(base::Time::Now().ToInternalValue());
43 return metadata->RefreshEntry(*entry); 43 return metadata->RefreshEntry(*entry);
44 } 44 }
45 45
46 } // namespace 46 } // namespace
47 47
48 TouchOperation::TouchOperation(base::SequencedTaskRunner* blocking_task_runner, 48 TouchOperation::TouchOperation(base::SequencedTaskRunner* blocking_task_runner,
49 OperationObserver* observer, 49 OperationDelegate* delegate,
50 internal::ResourceMetadata* metadata) 50 internal::ResourceMetadata* metadata)
51 : blocking_task_runner_(blocking_task_runner), 51 : blocking_task_runner_(blocking_task_runner),
52 observer_(observer), 52 delegate_(delegate),
53 metadata_(metadata), 53 metadata_(metadata),
54 weak_ptr_factory_(this) { 54 weak_ptr_factory_(this) {
55 } 55 }
56 56
57 TouchOperation::~TouchOperation() { 57 TouchOperation::~TouchOperation() {
58 } 58 }
59 59
60 void TouchOperation::TouchFile(const base::FilePath& file_path, 60 void TouchOperation::TouchFile(const base::FilePath& file_path,
61 const base::Time& last_access_time, 61 const base::Time& last_access_time,
62 const base::Time& last_modified_time, 62 const base::Time& last_modified_time,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 DCHECK(!callback.is_null()); 94 DCHECK(!callback.is_null());
95 95
96 FileChange changed_files; 96 FileChange changed_files;
97 changed_files.Update( 97 changed_files.Update(
98 file_path, 98 file_path,
99 entry->file_info().is_directory() ? 99 entry->file_info().is_directory() ?
100 FileChange::FILE_TYPE_DIRECTORY : FileChange::FILE_TYPE_FILE, 100 FileChange::FILE_TYPE_DIRECTORY : FileChange::FILE_TYPE_FILE,
101 FileChange::ADD_OR_UPDATE); 101 FileChange::ADD_OR_UPDATE);
102 102
103 if (error == FILE_ERROR_OK) { 103 if (error == FILE_ERROR_OK) {
104 observer_->OnFileChangedByOperation(changed_files); 104 delegate_->OnFileChangedByOperation(changed_files);
105 observer_->OnEntryUpdatedByOperation(*local_id); 105 delegate_->OnEntryUpdatedByOperation(*local_id);
106 } 106 }
107 callback.Run(error); 107 callback.Run(error);
108 } 108 }
109 109
110 } // namespace file_system 110 } // namespace file_system
111 } // namespace drive 111 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698