| 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 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 | 2127 |
| 2128 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const { | 2128 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const { |
| 2129 DriveFileSystemMetadata metadata; | 2129 DriveFileSystemMetadata metadata; |
| 2130 metadata.largest_changestamp = resource_metadata_->largest_changestamp(); | 2130 metadata.largest_changestamp = resource_metadata_->largest_changestamp(); |
| 2131 metadata.origin = ContentOriginToString(resource_metadata_->origin()); | 2131 metadata.origin = ContentOriginToString(resource_metadata_->origin()); |
| 2132 if (feed_loader_->refreshing()) | 2132 if (feed_loader_->refreshing()) |
| 2133 metadata.origin += " (refreshing)"; | 2133 metadata.origin += " (refreshing)"; |
| 2134 return metadata; | 2134 return metadata; |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 void DriveFileSystem::Observe(int type, | 2137 void DriveFileSystem::OnPreferenceChanged(PrefServiceBase* service, |
| 2138 const content::NotificationSource& source, | 2138 const std::string& pref_name) { |
| 2139 const content::NotificationDetails& details) { | |
| 2140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2140 DCHECK(pref_name == prefs::kDisableDriveHostedFiles); |
| 2141 | 2141 |
| 2142 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 2142 PrefService* pref_service = profile_->GetPrefs(); |
| 2143 PrefService* pref_service = profile_->GetPrefs(); | 2143 SetHideHostedDocuments( |
| 2144 std::string* pref_name = content::Details<std::string>(details).ptr(); | 2144 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); |
| 2145 if (*pref_name == prefs::kDisableDriveHostedFiles) { | |
| 2146 SetHideHostedDocuments( | |
| 2147 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); | |
| 2148 } | |
| 2149 } else { | |
| 2150 NOTREACHED(); | |
| 2151 } | |
| 2152 } | 2145 } |
| 2153 | 2146 |
| 2154 void DriveFileSystem::SetHideHostedDocuments(bool hide) { | 2147 void DriveFileSystem::SetHideHostedDocuments(bool hide) { |
| 2155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2156 | 2149 |
| 2157 if (hide == hide_hosted_docs_) | 2150 if (hide == hide_hosted_docs_) |
| 2158 return; | 2151 return; |
| 2159 | 2152 |
| 2160 hide_hosted_docs_ = hide; | 2153 hide_hosted_docs_ = hide; |
| 2161 const FilePath root_path = resource_metadata_->root()->GetFilePath(); | 2154 const FilePath root_path = resource_metadata_->root()->GetFilePath(); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2495 return; | 2488 return; |
| 2496 } | 2489 } |
| 2497 | 2490 |
| 2498 PlatformFileInfoProto entry_file_info; | 2491 PlatformFileInfoProto entry_file_info; |
| 2499 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 2492 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
| 2500 *entry_proto->mutable_file_info() = entry_file_info; | 2493 *entry_proto->mutable_file_info() = entry_file_info; |
| 2501 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | 2494 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); |
| 2502 } | 2495 } |
| 2503 | 2496 |
| 2504 } // namespace drive | 2497 } // namespace drive |
| OLD | NEW |