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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 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 | Annotate | Revision Log
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/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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 2174
2175 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const { 2175 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const {
2176 DriveFileSystemMetadata metadata; 2176 DriveFileSystemMetadata metadata;
2177 metadata.largest_changestamp = resource_metadata_->largest_changestamp(); 2177 metadata.largest_changestamp = resource_metadata_->largest_changestamp();
2178 metadata.origin = ContentOriginToString(resource_metadata_->origin()); 2178 metadata.origin = ContentOriginToString(resource_metadata_->origin());
2179 if (feed_loader_->refreshing()) 2179 if (feed_loader_->refreshing())
2180 metadata.origin += " (refreshing)"; 2180 metadata.origin += " (refreshing)";
2181 return metadata; 2181 return metadata;
2182 } 2182 }
2183 2183
2184 void DriveFileSystem::Observe(int type, 2184 void DriveFileSystem::OnPreferenceChanged(PrefServiceBase* service,
2185 const content::NotificationSource& source, 2185 const std::string& pref_name) {
2186 const content::NotificationDetails& details) {
2187 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2187 DCHECK(pref_name == prefs::kDisableDriveHostedFiles);
2188 2188
2189 if (type == chrome::NOTIFICATION_PREF_CHANGED) { 2189 PrefService* pref_service = profile_->GetPrefs();
2190 PrefService* pref_service = profile_->GetPrefs(); 2190 SetHideHostedDocuments(
2191 std::string* pref_name = content::Details<std::string>(details).ptr(); 2191 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles));
2192 if (*pref_name == prefs::kDisableDriveHostedFiles) {
2193 SetHideHostedDocuments(
2194 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles));
2195 }
2196 } else {
2197 NOTREACHED();
2198 }
2199 } 2192 }
2200 2193
2201 void DriveFileSystem::SetHideHostedDocuments(bool hide) { 2194 void DriveFileSystem::SetHideHostedDocuments(bool hide) {
2202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2203 2196
2204 if (hide == hide_hosted_docs_) 2197 if (hide == hide_hosted_docs_)
2205 return; 2198 return;
2206 2199
2207 hide_hosted_docs_ = hide; 2200 hide_hosted_docs_ = hide;
2208 const FilePath root_path = resource_metadata_->root()->GetFilePath(); 2201 const FilePath root_path = resource_metadata_->root()->GetFilePath();
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 return; 2538 return;
2546 } 2539 }
2547 2540
2548 PlatformFileInfoProto entry_file_info; 2541 PlatformFileInfoProto entry_file_info;
2549 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 2542 DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
2550 *entry_proto->mutable_file_info() = entry_file_info; 2543 *entry_proto->mutable_file_info() = entry_file_info;
2551 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); 2544 callback.Run(DRIVE_FILE_OK, entry_proto.Pass());
2552 } 2545 }
2553 2546
2554 } // namespace drive 2547 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698