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

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

Issue 12049052: Move core url data manager classes to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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: content/browser/webui/url_data_manager.cc
===================================================================
--- content/browser/webui/url_data_manager.cc (revision 178359)
+++ content/browser/webui/url_data_manager.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+#include "content/browser/webui/url_data_manager.h"
#include <vector>
@@ -13,14 +13,16 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/synchronization/lock.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h"
-#include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
-#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
+#include "content/browser/webui/url_data_manager_backend.h"
+#include "content/browser/webui/web_ui_data_source.h"
+#include "content/browser/storage_partition_impl.h"
+#include "content/browser/resource_context_impl.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/url_data_source.h"
using content::BrowserThread;
+using content::StoragePartitionImpl;
static base::LazyInstance<base::Lock>::Leaky
g_delete_lock = LAZY_INSTANCE_INITIALIZER;
@@ -31,15 +33,16 @@
// Invoked on the IO thread to do the actual adding of the DataSource.
static void AddDataSourceOnIOThread(
- const base::Callback<ChromeURLDataManagerBackend*(void)>& backend,
+ content::ResourceContext* resource_context,
scoped_refptr<URLDataSourceImpl> data_source) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- backend.Run()->AddDataSource(data_source.get());
+ GetURLDataManagerForResourceContext(resource_context)->AddDataSource(
+ data_source.get());
}
ChromeURLDataManager::ChromeURLDataManager(
- const base::Callback<ChromeURLDataManagerBackend*(void)>& backend)
- : backend_(backend) {
+ content::BrowserContext* browser_context)
+ : browser_context_(browser_context) {
}
ChromeURLDataManager::~ChromeURLDataManager() {
@@ -50,7 +53,8 @@
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&AddDataSourceOnIOThread,
- backend_, make_scoped_refptr(source)));
+ browser_context_->GetResourceContext(),
+ make_scoped_refptr(source)));
}
// static
@@ -97,18 +101,23 @@
// static
void ChromeURLDataManager::AddDataSource(
- Profile* profile,
+ content::BrowserContext* browser_context,
content::URLDataSource* source) {
- ChromeURLDataManagerFactory::GetForProfile(profile)->AddDataSource(
- new URLDataSourceImpl(source->GetSource(), source));
+ content::StoragePartition* storage_partition =
+ content::BrowserContext::GetDefaultStoragePartition(browser_context);
+ static_cast<StoragePartitionImpl*>(storage_partition)->url_data_manager()->
+ AddDataSource(new URLDataSourceImpl(source->GetSource(), source));
}
// static
void ChromeURLDataManager::AddWebUIDataSource(
- Profile* profile,
+ content::BrowserContext* browser_context,
content::WebUIDataSource* source) {
ChromeWebUIDataSource* impl = static_cast<ChromeWebUIDataSource*>(source);
- ChromeURLDataManagerFactory::GetForProfile(profile)->AddDataSource(impl);
+ content::StoragePartition* storage_partition =
+ content::BrowserContext::GetDefaultStoragePartition(browser_context);
+ static_cast<StoragePartitionImpl*>(storage_partition)->url_data_manager()->
+ AddDataSource(impl);
}
// static

Powered by Google App Engine
This is Rietveld 408576698