OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/message_loop_helpers.h" |
14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
15 #include "base/task.h" | |
16 | 16 |
17 class ChromeURLDataManagerBackend; | 17 class ChromeURLDataManagerBackend; |
18 class MessageLoop; | 18 class MessageLoop; |
19 class RefCountedMemory; | 19 class RefCountedMemory; |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class DictionaryValue; | 22 class DictionaryValue; |
23 } | 23 } |
24 | 24 |
25 // To serve dynamic data off of chrome: URLs, implement the | 25 // To serve dynamic data off of chrome: URLs, implement the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 static void SetFontAndTextDirection( | 108 static void SetFontAndTextDirection( |
109 base::DictionaryValue* localized_strings); | 109 base::DictionaryValue* localized_strings); |
110 | 110 |
111 protected: | 111 protected: |
112 virtual ~DataSource(); | 112 virtual ~DataSource(); |
113 | 113 |
114 private: | 114 private: |
115 friend class ChromeURLDataManagerBackend; | 115 friend class ChromeURLDataManagerBackend; |
116 friend class ChromeURLDataManager; | 116 friend class ChromeURLDataManager; |
117 friend class DeleteTask<DataSource>; | 117 friend class base::DeleteHelper<DataSource>; |
118 | 118 |
119 // SendResponse invokes this on the IO thread. Notifies the backend to | 119 // SendResponse invokes this on the IO thread. Notifies the backend to |
120 // handle the actual work of sending the data. | 120 // handle the actual work of sending the data. |
121 virtual void SendResponseOnIOThread(int request_id, | 121 virtual void SendResponseOnIOThread(int request_id, |
122 scoped_refptr<RefCountedMemory> bytes); | 122 scoped_refptr<RefCountedMemory> bytes); |
123 | 123 |
124 // The name of this source. | 124 // The name of this source. |
125 // E.g., for favicons, this could be "favicon", which results in paths for | 125 // E.g., for favicons, this could be "favicon", which results in paths for |
126 // specific resources like "favicon/34" getting sent to this source. | 126 // specific resources like "favicon/34" getting sent to this source. |
127 const std::string source_name_; | 127 const std::string source_name_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const base::Callback<ChromeURLDataManagerBackend*(void)> backend_; | 178 const base::Callback<ChromeURLDataManagerBackend*(void)> backend_; |
179 | 179 |
180 // |data_sources_| that are no longer referenced and scheduled for deletion. | 180 // |data_sources_| that are no longer referenced and scheduled for deletion. |
181 // Protected by g_delete_lock in the .cc file. | 181 // Protected by g_delete_lock in the .cc file. |
182 static DataSources* data_sources_; | 182 static DataSources* data_sources_; |
183 | 183 |
184 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManager); | 184 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManager); |
185 }; | 185 }; |
186 | 186 |
187 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ | 187 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ |
OLD | NEW |