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

Unified Diff: content/browser/webui/url_data_manager.cc

Issue 2475593002: MD History: update (instead of re-create) data sources on sign in change (Closed)
Patch Set: old history as well Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/webui/url_data_manager.cc
diff --git a/content/browser/webui/url_data_manager.cc b/content/browser/webui/url_data_manager.cc
index a9ec107df4631f18239851dc13f9187d8475abe2..0a482ad8ae00ea890634668dfe676ebc7375e76f 100644
--- a/content/browser/webui/url_data_manager.cc
+++ b/content/browser/webui/url_data_manager.cc
@@ -9,6 +9,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/lazy_instance.h"
#include "base/memory/ref_counted_memory.h"
#include "base/message_loop/message_loop.h"
@@ -46,6 +47,14 @@ static void AddDataSourceOnIOThread(
data_source.get());
}
+static void UpdateWebUIDataSourceOnIOThread(
+ ResourceContext* resource_context,
+ std::string source_name,
+ const base::DictionaryValue* update) {
+ GetURLDataManagerForResourceContext(resource_context)
+ ->UpdateWebUIDataSource(source_name, *update);
+}
+
} // namespace
// static
@@ -67,6 +76,17 @@ void URLDataManager::AddDataSource(URLDataSourceImpl* source) {
make_scoped_refptr(source)));
}
+void URLDataManager::UpdateWebUIDataSource(
+ const std::string& source_name,
+ std::unique_ptr<base::DictionaryValue> update) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&UpdateWebUIDataSourceOnIOThread,
+ browser_context_->GetResourceContext(), source_name,
+ base::Owned(update.release())));
+}
+
// static
void URLDataManager::DeleteDataSources() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -122,6 +142,14 @@ void URLDataManager::AddWebUIDataSource(BrowserContext* browser_context,
GetFromBrowserContext(browser_context)->AddDataSource(impl);
}
+void URLDataManager::UpdateWebUIDataSource(
+ BrowserContext* browser_context,
+ const std::string& source_name,
+ std::unique_ptr<base::DictionaryValue> update) {
+ GetFromBrowserContext(browser_context)
+ ->UpdateWebUIDataSource(source_name, std::move(update));
+}
+
// static
bool URLDataManager::IsScheduledForDeletion(
const URLDataSourceImpl* data_source) {

Powered by Google App Engine
This is Rietveld 408576698