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

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10830211: Revert 150436 - gdata: Remove hide_hosted_documents from ReadDirectoryCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata_file_system.cc
===================================================================
--- chrome/browser/chromeos/gdata/gdata_file_system.cc (revision 150519)
+++ chrome/browser/chromeos/gdata/gdata_file_system.cc (working copy)
@@ -516,6 +516,7 @@
documents_service_(documents_service),
webapps_registry_(webapps_registry),
update_timer_(true /* retain_user_task */, true /* is_repeating */),
+ hide_hosted_docs_(false),
blocking_task_runner_(blocking_task_runner),
ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
ui_weak_ptr_(ui_weak_ptr_factory_.GetWeakPtr()) {
@@ -536,6 +537,9 @@
blocking_task_runner_));
feed_loader_->AddObserver(this);
+ PrefService* pref_service = profile_->GetPrefs();
+ hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableGDataHostedFiles);
+
InitializePreferenceObserver();
}
@@ -1862,6 +1866,7 @@
if (error != GDATA_FILE_OK) {
if (!callback.is_null())
callback.Run(error,
+ hide_hosted_docs_,
scoped_ptr<GDataEntryProtoVector>());
return;
}
@@ -1871,6 +1876,7 @@
if (!directory) {
if (!callback.is_null())
callback.Run(GDATA_FILE_ERROR_NOT_FOUND,
+ hide_hosted_docs_,
scoped_ptr<GDataEntryProtoVector>());
return;
}
@@ -1892,7 +1898,7 @@
}
if (!callback.is_null())
- callback.Run(GDATA_FILE_OK, entries.Pass());
+ callback.Run(GDATA_FILE_OK, hide_hosted_docs_, entries.Pass());
}
void GDataFileSystem::RequestDirectoryRefresh(const FilePath& file_path) {
@@ -2964,18 +2970,31 @@
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (type == chrome::NOTIFICATION_PREF_CHANGED) {
+ PrefService* pref_service = profile_->GetPrefs();
std::string* pref_name = content::Details<std::string>(details).ptr();
if (*pref_name == prefs::kDisableGDataHostedFiles) {
- const FilePath root_path = directory_service_->root()->GetFilePath();
- // Kick off directory refresh when this setting changes.
- FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_,
- OnDirectoryChanged(root_path));
+ SetHideHostedDocuments(
+ pref_service->GetBoolean(prefs::kDisableGDataHostedFiles));
}
} else {
NOTREACHED();
}
}
+void GDataFileSystem::SetHideHostedDocuments(bool hide) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (hide == hide_hosted_docs_)
+ return;
+
+ hide_hosted_docs_ = hide;
+ const FilePath root_path = directory_service_->root()->GetFilePath();
+
+ // Kick off directory refresh when this setting changes.
+ FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_,
+ OnDirectoryChanged(root_path));
+}
+
//============= GDataFileSystem: internal helper functions =====================
void GDataFileSystem::InitializePreferenceObserver() {
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/gdata_file_system_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698