| OLD | NEW |
| 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 Loading... |
| 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 = !entry.has_file_info() | 118 FileType type = |
| 119 ? FILE_TYPE_UNKNOWN | 119 entry.deleted() ? FILE_TYPE_UNKNOWN : entry.file_info().is_directory() |
| 120 : entry.file_info().is_directory() ? FILE_TYPE_DIRECTORY | 120 ? FILE_TYPE_DIRECTORY |
| 121 : FILE_TYPE_FILE; | 121 : FILE_TYPE_FILE; |
| 122 | |
| 123 Update(file_path, type, change); | 122 Update(file_path, type, change); |
| 124 } | 123 } |
| 125 | 124 |
| 126 void FileChange::Apply(const FileChange& new_changed_files) { | 125 void FileChange::Apply(const FileChange& new_changed_files) { |
| 127 for (Map::const_iterator it = new_changed_files.map().begin(); | 126 for (Map::const_iterator it = new_changed_files.map().begin(); |
| 128 it != new_changed_files.map().end(); | 127 it != new_changed_files.map().end(); |
| 129 it++) { | 128 it++) { |
| 130 Update(it->first, it->second); | 129 Update(it->first, it->second); |
| 131 } | 130 } |
| 132 } | 131 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 145 ss << "{ "; | 144 ss << "{ "; |
| 146 for (FileChange::Map::const_iterator it = map_.begin(); it != map_.end(); | 145 for (FileChange::Map::const_iterator it = map_.begin(); it != map_.end(); |
| 147 it++) { | 146 it++) { |
| 148 ss << it->first.value() << ": " << it->second.DebugString() << ", "; | 147 ss << it->first.value() << ": " << it->second.DebugString() << ", "; |
| 149 } | 148 } |
| 150 ss << "}"; | 149 ss << "}"; |
| 151 return ss.str(); | 150 return ss.str(); |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace drive | 153 } // namespace drive |
| OLD | NEW |