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/drive_file_system.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2177 | 2177 |
2178 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const { | 2178 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const { |
2179 DriveFileSystemMetadata metadata; | 2179 DriveFileSystemMetadata metadata; |
2180 metadata.largest_changestamp = resource_metadata_->largest_changestamp(); | 2180 metadata.largest_changestamp = resource_metadata_->largest_changestamp(); |
2181 metadata.origin = ContentOriginToString(resource_metadata_->origin()); | 2181 metadata.origin = ContentOriginToString(resource_metadata_->origin()); |
2182 if (feed_loader_->refreshing()) | 2182 if (feed_loader_->refreshing()) |
2183 metadata.origin += " (refreshing)"; | 2183 metadata.origin += " (refreshing)"; |
2184 return metadata; | 2184 return metadata; |
2185 } | 2185 } |
2186 | 2186 |
2187 void DriveFileSystem::Observe(int type, | 2187 void DriveFileSystem::OnPreferenceChanged(PrefServiceBase* service, |
2188 const content::NotificationSource& source, | 2188 const std::string& pref_name) { |
2189 const content::NotificationDetails& details) { | |
2190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2190 DCHECK(pref_name == prefs::kDisableDriveHostedFiles); | |
Mattias Nissler (ping if slow)
2012/10/30 13:37:07
same comment regarding if() {} else NOTREACHED();
| |
2191 | 2191 |
2192 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 2192 PrefService* pref_service = profile_->GetPrefs(); |
2193 PrefService* pref_service = profile_->GetPrefs(); | 2193 SetHideHostedDocuments( |
2194 std::string* pref_name = content::Details<std::string>(details).ptr(); | 2194 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); |
2195 if (*pref_name == prefs::kDisableDriveHostedFiles) { | |
2196 SetHideHostedDocuments( | |
2197 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); | |
2198 } | |
2199 } else { | |
2200 NOTREACHED(); | |
2201 } | |
2202 } | 2195 } |
2203 | 2196 |
2204 void DriveFileSystem::SetHideHostedDocuments(bool hide) { | 2197 void DriveFileSystem::SetHideHostedDocuments(bool hide) { |
2205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2206 | 2199 |
2207 if (hide == hide_hosted_docs_) | 2200 if (hide == hide_hosted_docs_) |
2208 return; | 2201 return; |
2209 | 2202 |
2210 hide_hosted_docs_ = hide; | 2203 hide_hosted_docs_ = hide; |
2211 const FilePath root_path = resource_metadata_->root()->GetFilePath(); | 2204 const FilePath root_path = resource_metadata_->root()->GetFilePath(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2548 return; | 2541 return; |
2549 } | 2542 } |
2550 | 2543 |
2551 PlatformFileInfoProto entry_file_info; | 2544 PlatformFileInfoProto entry_file_info; |
2552 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 2545 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
2553 *entry_proto->mutable_file_info() = entry_file_info; | 2546 *entry_proto->mutable_file_info() = entry_file_info; |
2554 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | 2547 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); |
2555 } | 2548 } |
2556 | 2549 |
2557 } // namespace drive | 2550 } // namespace drive |
OLD | NEW |