OLD | NEW |
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 #ifndef CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ |
6 #define CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ | 6 #define CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class BrowserContext; | 16 class BrowserContext; |
17 class URLDataSource; | 17 class URLDataSource; |
18 class URLDataSourceImpl; | 18 class URLDataSourceImpl; |
19 class WebUIDataSource; | 19 class WebUIDataSource; |
20 | 20 |
21 // To serve dynamic data off of chrome: URLs, implement the | 21 // To serve dynamic data off of chrome: URLs, implement the |
22 // URLDataManager::DataSource interface and register your handler | 22 // URLDataManager::DataSource interface and register your handler |
23 // with AddDataSource. DataSources must be added on the UI thread (they are also | 23 // with AddDataSource. DataSources must be added on the UI thread (they are also |
24 // deleted on the UI thread). Internally the DataSources are maintained by | 24 // deleted on the UI thread). Internally the DataSources are maintained by |
25 // URLDataManagerBackend, see it for details. | 25 // URLDataManagerBackend, see it for details. |
26 class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { | 26 class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { |
27 public: | 27 public: |
28 explicit URLDataManager(BrowserContext* browser_context); | 28 explicit URLDataManager(BrowserContext* browser_context); |
29 virtual ~URLDataManager(); | 29 ~URLDataManager() override; |
30 | 30 |
31 // Adds a DataSource to the collection of data sources. This *must* be invoked | 31 // Adds a DataSource to the collection of data sources. This *must* be invoked |
32 // on the UI thread. | 32 // on the UI thread. |
33 // | 33 // |
34 // If |AddDataSource| is called more than once for a particular name it will | 34 // If |AddDataSource| is called more than once for a particular name it will |
35 // release the old |DataSource|, most likely resulting in it getting deleted | 35 // release the old |DataSource|, most likely resulting in it getting deleted |
36 // as there are no other references to it. |DataSource| uses the | 36 // as there are no other references to it. |DataSource| uses the |
37 // |DeleteOnUIThread| trait to insure that the destructor is called on the UI | 37 // |DeleteOnUIThread| trait to insure that the destructor is called on the UI |
38 // thread. This is necessary as some |DataSource|s notably |FileIconSource| | 38 // thread. This is necessary as some |DataSource|s notably |FileIconSource| |
39 // and |FaviconSource|, have members that will DCHECK if they are not | 39 // and |FaviconSource|, have members that will DCHECK if they are not |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // |data_sources_| that are no longer referenced and scheduled for deletion. | 73 // |data_sources_| that are no longer referenced and scheduled for deletion. |
74 // Protected by g_delete_lock in the .cc file. | 74 // Protected by g_delete_lock in the .cc file. |
75 static URLDataSources* data_sources_; | 75 static URLDataSources* data_sources_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(URLDataManager); | 77 DISALLOW_COPY_AND_ASSIGN(URLDataManager); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace content | 80 } // namespace content |
81 | 81 |
82 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ | 82 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_H_ |
OLD | NEW |