Index: ios/web/webui/url_data_manager_ios.h |
diff --git a/content/browser/webui/url_data_manager.h b/ios/web/webui/url_data_manager_ios.h |
similarity index 55% |
copy from content/browser/webui/url_data_manager.h |
copy to ios/web/webui/url_data_manager_ios.h |
index 8a318b73dbaed2f85e8525bb2b60b6f38cef3f69..c23eda524aecb894ccdb7b7258c03c6cd89e26b8 100644 |
--- a/content/browser/webui/url_data_manager.h |
+++ b/ios/web/webui/url_data_manager_ios.h |
@@ -1,32 +1,31 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ |
-#define CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ |
+#ifndef IOS_WEB_WEBUI_URL_DATA_MANAGER_IOS_H_ |
+#define IOS_WEB_WEBUI_URL_DATA_MANAGER_IOS_H_ |
#include <string> |
#include <vector> |
#include "base/memory/ref_counted.h" |
#include "base/supports_user_data.h" |
-#include "content/common/content_export.h" |
-namespace content { |
-class BrowserContext; |
-class URLDataSource; |
-class URLDataSourceImpl; |
-class WebUIDataSource; |
+namespace web { |
+class BrowserState; |
+class URLDataSourceIOS; |
+class URLDataSourceIOSImpl; |
+class WebUIIOSDataSource; |
// To serve dynamic data off of chrome: URLs, implement the |
-// URLDataManager::DataSource interface and register your handler |
+// URLDataManagerIOS::DataSource interface and register your handler |
// with AddDataSource. DataSources must be added on the UI thread (they are also |
// deleted on the UI thread). Internally the DataSources are maintained by |
-// URLDataManagerBackend, see it for details. |
-class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { |
+// URLDataManagerIOSBackend, see it for details. |
+class URLDataManagerIOS : public base::SupportsUserData::Data { |
public: |
- explicit URLDataManager(BrowserContext* browser_context); |
- ~URLDataManager() override; |
+ explicit URLDataManagerIOS(BrowserState* browser_state); |
+ ~URLDataManagerIOS() override; |
// Adds a DataSource to the collection of data sources. This *must* be invoked |
// on the UI thread. |
@@ -38,45 +37,50 @@ class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { |
// thread. This is necessary as some |DataSource|s notably |FileIconSource| |
// and |FaviconSource|, have members that will DCHECK if they are not |
// destructed in the same thread as they are constructed (the UI thread). |
- void AddDataSource(URLDataSourceImpl* source); |
+ void AddDataSource(URLDataSourceIOSImpl* source); |
// Deletes any data sources no longer referenced. This is normally invoked |
// for you, but can be invoked to force deletion (such as during shutdown). |
static void DeleteDataSources(); |
// Convenience wrapper function to add |source| to |browser_context|'s |
- // |URLDataManager|. Creates a URLDataSourceImpl to wrap the given |
+ // |URLDataManagerIOS|. Creates a URLDataSourceIOSImpl to wrap the given |
// source. |
- static void AddDataSource(BrowserContext* browser_context, |
- URLDataSource* source); |
+ static void AddDataSource(BrowserState* browser_context, |
+ URLDataSourceIOS* source); |
- // Adds a WebUI data source to |browser_context|'s |URLDataManager|. |
- static void AddWebUIDataSource(BrowserContext* browser_context, |
- WebUIDataSource* source); |
+ // Adds a WebUI data source to |browser_context|'s |URLDataManagerIOS|. |
+ static void AddWebUIIOSDataSource(BrowserState* browser_state, |
+ WebUIIOSDataSource* source); |
private: |
- friend class URLDataSourceImpl; |
- friend struct DeleteURLDataSource; |
- typedef std::vector<const URLDataSourceImpl*> URLDataSources; |
+ friend class URLDataSourceIOSImpl; |
+ friend struct DeleteURLDataSourceIOS; |
+ typedef std::vector<const URLDataSourceIOSImpl*> URLDataSources; |
+ |
+ // Invoked on the IO thread to do the actual adding of the DataSource. |
+ static void AddDataSourceOnIOThread( |
+ BrowserState* browser_state, |
+ scoped_refptr<URLDataSourceIOSImpl> data_source); |
// If invoked on the UI thread the DataSource is deleted immediatlye, |
// otherwise it is added to |data_sources_| and a task is scheduled to handle |
// deletion on the UI thread. See note abouve DeleteDataSource for more info. |
- static void DeleteDataSource(const URLDataSourceImpl* data_source); |
+ static void DeleteDataSource(const URLDataSourceIOSImpl* data_source); |
// Returns true if |data_source| is scheduled for deletion (|DeleteDataSource| |
// was invoked). |
- static bool IsScheduledForDeletion(const URLDataSourceImpl* data_source); |
+ static bool IsScheduledForDeletion(const URLDataSourceIOSImpl* data_source); |
- BrowserContext* browser_context_; |
+ BrowserState* browser_state_; |
// |data_sources_| that are no longer referenced and scheduled for deletion. |
// Protected by g_delete_lock in the .cc file. |
static URLDataSources* data_sources_; |
- DISALLOW_COPY_AND_ASSIGN(URLDataManager); |
+ DISALLOW_COPY_AND_ASSIGN(URLDataManagerIOS); |
}; |
-} // namespace content |
+} // namespace web |
-#endif // CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ |
+#endif // IOS_WEB_WEBUI_URL_DATA_MANAGER_IOS_H_ |