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

Side by Side Diff: chrome/browser/chromeos/drive/file_change.cc

Issue 658013002: Changed api to notify when watched directory is deleted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted arguments. 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/event_router.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/drive/file_change.h" 5 #include "chrome/browser/chromeos/drive/file_change.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 void FileChange::Update(const base::FilePath file_path, 109 void FileChange::Update(const base::FilePath file_path,
110 FileType file_type, 110 FileType file_type,
111 FileChange::ChangeType change) { 111 FileChange::ChangeType change) {
112 Update(file_path, FileChange::Change(change, file_type)); 112 Update(file_path, FileChange::Change(change, file_type));
113 } 113 }
114 114
115 void FileChange::Update(const base::FilePath file_path, 115 void FileChange::Update(const base::FilePath file_path,
116 const ResourceEntry& entry, 116 const ResourceEntry& entry,
117 FileChange::ChangeType change) { 117 FileChange::ChangeType change) {
118 FileType type = 118 FileType type = !entry.has_file_info()
119 entry.deleted() ? FILE_TYPE_UNKNOWN : entry.file_info().is_directory() 119 ? FILE_TYPE_UNKNOWN
120 ? FILE_TYPE_DIRECTORY 120 : entry.file_info().is_directory() ? FILE_TYPE_DIRECTORY
121 : FILE_TYPE_FILE; 121 : FILE_TYPE_FILE;
122
122 Update(file_path, type, change); 123 Update(file_path, type, change);
123 } 124 }
124 125
125 void FileChange::Apply(const FileChange& new_changed_files) { 126 void FileChange::Apply(const FileChange& new_changed_files) {
126 for (Map::const_iterator it = new_changed_files.map().begin(); 127 for (Map::const_iterator it = new_changed_files.map().begin();
127 it != new_changed_files.map().end(); 128 it != new_changed_files.map().end();
128 it++) { 129 it++) {
129 Update(it->first, it->second); 130 Update(it->first, it->second);
130 } 131 }
131 } 132 }
(...skipping 12 matching lines...) Expand all
144 ss << "{ "; 145 ss << "{ ";
145 for (FileChange::Map::const_iterator it = map_.begin(); it != map_.end(); 146 for (FileChange::Map::const_iterator it = map_.begin(); it != map_.end();
146 it++) { 147 it++) {
147 ss << it->first.value() << ": " << it->second.DebugString() << ", "; 148 ss << it->first.value() << ": " << it->second.DebugString() << ", ";
148 } 149 }
149 ss << "}"; 150 ss << "}";
150 return ss.str(); 151 return ss.str();
151 } 152 }
152 153
153 } // namespace drive 154 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698