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

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

Issue 343073003: Files.app: Provide detailed change information on onDirectoryChanged event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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/create_file_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "chrome/browser/chromeos/drive/drive.pb.h" 10 #include "chrome/browser/chromeos/drive/drive.pb.h"
11 #include "chrome/browser/chromeos/drive/file_change.h"
11 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" 12 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h"
12 #include "chrome/browser/chromeos/drive/resource_metadata.h" 13 #include "chrome/browser/chromeos/drive/resource_metadata.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 #include "net/base/mime_util.h" 15 #include "net/base/mime_util.h"
15 16
16 using content::BrowserThread; 17 using content::BrowserThread;
17 18
18 namespace drive { 19 namespace drive {
19 namespace file_system { 20 namespace file_system {
20 21
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
117 DCHECK(!callback.is_null()); 118 DCHECK(!callback.is_null());
118 119
119 if (error == FILE_ERROR_EXISTS) { 120 if (error == FILE_ERROR_EXISTS) {
120 // Error if an exclusive mode is requested, or the entry is not a file. 121 // Error if an exclusive mode is requested, or the entry is not a file.
121 error = (is_exclusive || 122 error = (is_exclusive ||
122 entry->file_info().is_directory() || 123 entry->file_info().is_directory() ||
123 entry->file_specific_info().is_hosted_document()) ? 124 entry->file_specific_info().is_hosted_document()) ?
124 FILE_ERROR_EXISTS : FILE_ERROR_OK; 125 FILE_ERROR_EXISTS : FILE_ERROR_OK;
125 } else if (error == FILE_ERROR_OK) { 126 } else if (error == FILE_ERROR_OK) {
127 DCHECK(!entry->file_info().is_directory());
128
126 // Notify observer if the file was newly created. 129 // Notify observer if the file was newly created.
127 observer_->OnDirectoryChangedByOperation(file_path.DirName()); 130 FileChange changed_file;
131 changed_file.Update(
132 file_path, FileChange::FILE_TYPE_FILE, FileChange::ADD_OR_UPDATE);
133 observer_->OnFileChangedByOperation(changed_file);
128 observer_->OnEntryUpdatedByOperation(entry->local_id()); 134 observer_->OnEntryUpdatedByOperation(entry->local_id());
129 } 135 }
130 callback.Run(error); 136 callback.Run(error);
131 } 137 }
132 138
133 } // namespace file_system 139 } // namespace file_system
134 } // namespace drive 140 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698