OLD | NEW |
1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
16 #include "net/url_request/url_request_job_factory.h" | 16 #include "net/url_request/url_request_job_factory.h" |
17 | 17 |
18 class ChromeURLDataManagerBackend; | 18 class ChromeURLDataManagerBackend; |
19 class GURL; | 19 class GURL; |
| 20 class URLRequestChromeJob; |
| 21 |
| 22 namespace base { |
20 class RefCountedMemory; | 23 class RefCountedMemory; |
21 class URLRequestChromeJob; | 24 } |
22 | 25 |
23 namespace net { | 26 namespace net { |
24 class URLRequest; | 27 class URLRequest; |
25 class URLRequestJob; | 28 class URLRequestJob; |
26 } | 29 } |
27 | 30 |
28 // ChromeURLDataManagerBackend is used internally by ChromeURLDataManager on the | 31 // ChromeURLDataManagerBackend is used internally by ChromeURLDataManager on the |
29 // IO thread. In most cases you can use the API in ChromeURLDataManager and | 32 // IO thread. In most cases you can use the API in ChromeURLDataManager and |
30 // ignore this class. ChromeURLDataManagerBackend is owned by | 33 // ignore this class. ChromeURLDataManagerBackend is owned by |
31 // ChromeURLRequestContext. | 34 // ChromeURLRequestContext. |
32 class ChromeURLDataManagerBackend { | 35 class ChromeURLDataManagerBackend { |
33 public: | 36 public: |
34 typedef int RequestID; | 37 typedef int RequestID; |
35 | 38 |
36 ChromeURLDataManagerBackend(); | 39 ChromeURLDataManagerBackend(); |
37 ~ChromeURLDataManagerBackend(); | 40 ~ChromeURLDataManagerBackend(); |
38 | 41 |
39 // Invoked to create the protocol handler for chrome://. | 42 // Invoked to create the protocol handler for chrome://. |
40 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler( | 43 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler( |
41 ChromeURLDataManagerBackend* backend); | 44 ChromeURLDataManagerBackend* backend); |
42 | 45 |
43 // Adds a DataSource to the collection of data sources. | 46 // Adds a DataSource to the collection of data sources. |
44 void AddDataSource(ChromeURLDataManager::DataSource* source); | 47 void AddDataSource(ChromeURLDataManager::DataSource* source); |
45 | 48 |
46 // DataSource invokes this. Sends the data to the URLRequest. | 49 // DataSource invokes this. Sends the data to the URLRequest. |
47 void DataAvailable(RequestID request_id, RefCountedMemory* bytes); | 50 void DataAvailable(RequestID request_id, base::RefCountedMemory* bytes); |
48 | 51 |
49 static net::URLRequestJob* Factory(net::URLRequest* request, | 52 static net::URLRequestJob* Factory(net::URLRequest* request, |
50 const std::string& scheme); | 53 const std::string& scheme); |
51 | 54 |
52 private: | 55 private: |
53 friend class URLRequestChromeJob; | 56 friend class URLRequestChromeJob; |
54 | 57 |
55 typedef std::map<std::string, | 58 typedef std::map<std::string, |
56 scoped_refptr<ChromeURLDataManager::DataSource> > DataSourceMap; | 59 scoped_refptr<ChromeURLDataManager::DataSource> > DataSourceMap; |
57 typedef std::map<RequestID, URLRequestChromeJob*> PendingRequestMap; | 60 typedef std::map<RequestID, URLRequestChromeJob*> PendingRequestMap; |
(...skipping 21 matching lines...) Expand all Loading... |
79 // The ID we'll use for the next request we receive. | 82 // The ID we'll use for the next request we receive. |
80 RequestID next_request_id_; | 83 RequestID next_request_id_; |
81 | 84 |
82 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManagerBackend); | 85 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManagerBackend); |
83 }; | 86 }; |
84 | 87 |
85 net::URLRequestJobFactory::ProtocolHandler* | 88 net::URLRequestJobFactory::ProtocolHandler* |
86 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend); | 89 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend); |
87 | 90 |
88 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_ | 91 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_ |
OLD | NEW |