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 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 | 2133 |
2134 // Metadata related to delta update. | 2134 // Metadata related to delta update. |
2135 metadata.push_notification_enabled = push_notification_enabled_; | 2135 metadata.push_notification_enabled = push_notification_enabled_; |
2136 metadata.polling_interval_sec = polling_interval_sec_; | 2136 metadata.polling_interval_sec = polling_interval_sec_; |
2137 metadata.last_update_check_time = last_update_check_time_; | 2137 metadata.last_update_check_time = last_update_check_time_; |
2138 metadata.last_update_check_error = last_update_check_error_; | 2138 metadata.last_update_check_error = last_update_check_error_; |
2139 | 2139 |
2140 return metadata; | 2140 return metadata; |
2141 } | 2141 } |
2142 | 2142 |
2143 void DriveFileSystem::Observe(int type, | 2143 void DriveFileSystem::OnPreferenceChanged(PrefServiceBase* service, |
2144 const content::NotificationSource& source, | 2144 const std::string& pref_name) { |
2145 const content::NotificationDetails& details) { | |
2146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2146 DCHECK(pref_name == prefs::kDisableDriveHostedFiles); |
2147 | 2147 |
2148 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 2148 PrefService* pref_service = profile_->GetPrefs(); |
2149 PrefService* pref_service = profile_->GetPrefs(); | 2149 SetHideHostedDocuments( |
2150 std::string* pref_name = content::Details<std::string>(details).ptr(); | 2150 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); |
2151 if (*pref_name == prefs::kDisableDriveHostedFiles) { | |
2152 SetHideHostedDocuments( | |
2153 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); | |
2154 } | |
2155 } else { | |
2156 NOTREACHED(); | |
2157 } | |
2158 } | 2151 } |
2159 | 2152 |
2160 void DriveFileSystem::SetHideHostedDocuments(bool hide) { | 2153 void DriveFileSystem::SetHideHostedDocuments(bool hide) { |
2161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2162 | 2155 |
2163 if (hide == hide_hosted_docs_) | 2156 if (hide == hide_hosted_docs_) |
2164 return; | 2157 return; |
2165 | 2158 |
2166 hide_hosted_docs_ = hide; | 2159 hide_hosted_docs_ = hide; |
2167 const FilePath root_path = resource_metadata_->root()->GetFilePath(); | 2160 const FilePath root_path = resource_metadata_->root()->GetFilePath(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 return; | 2494 return; |
2502 } | 2495 } |
2503 | 2496 |
2504 PlatformFileInfoProto entry_file_info; | 2497 PlatformFileInfoProto entry_file_info; |
2505 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 2498 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
2506 *entry_proto->mutable_file_info() = entry_file_info; | 2499 *entry_proto->mutable_file_info() = entry_file_info; |
2507 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | 2500 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); |
2508 } | 2501 } |
2509 | 2502 |
2510 } // namespace drive | 2503 } // namespace drive |
OLD | NEW |