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_BACKEND_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_BACKEND_H_ |
6 #define CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_BACKEND_H_ | 6 #define CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_BACKEND_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/supports_user_data.h" | 14 #include "base/supports_user_data.h" |
15 #include "content/browser/webui/url_data_manager.h" | 15 #include "content/browser/webui/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 GURL; | 18 class GURL; |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class RefCountedMemory; | 21 class RefCountedMemory; |
22 } | 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 class ResourceContext; | |
25 class URLDataManagerBackend; | 26 class URLDataManagerBackend; |
26 class URLDataSourceImpl; | 27 class URLDataSourceImpl; |
27 class URLRequestChromeJob; | 28 class URLRequestChromeJob; |
28 | 29 |
29 // URLDataManagerBackend is used internally by ChromeURLDataManager on the IO | 30 // URLDataManagerBackend is used internally by ChromeURLDataManager on the IO |
30 // thread. In most cases you can use the API in ChromeURLDataManager and ignore | 31 // thread. In most cases you can use the API in ChromeURLDataManager and ignore |
31 // this class. URLDataManagerBackend is owned by ResourceContext. | 32 // this class. URLDataManagerBackend is owned by ResourceContext. |
32 class URLDataManagerBackend : public base::SupportsUserData::Data { | 33 class URLDataManagerBackend : public base::SupportsUserData::Data { |
33 public: | 34 public: |
34 typedef int RequestID; | 35 typedef int RequestID; |
35 | 36 |
36 URLDataManagerBackend(); | 37 URLDataManagerBackend(); |
37 virtual ~URLDataManagerBackend(); | 38 virtual ~URLDataManagerBackend(); |
38 | 39 |
39 // Invoked to create the protocol handler for chrome://. |is_incognito| should | 40 // Invoked to create the protocol handler for chrome://. |is_incognito| should |
40 // be set for incognito profiles. | 41 // be set for incognito profiles. Called on the UI thread, though the protocol |
awong
2013/02/05 02:57:11
Just saying "Called on the UI Thread." is probably
| |
42 // handler is used on the IO thread. | |
41 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler( | 43 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler( |
42 URLDataManagerBackend* backend, | 44 content::ResourceContext* resource_context, |
43 bool is_incognito); | 45 bool is_incognito); |
44 | 46 |
45 // Adds a DataSource to the collection of data sources. | 47 // Adds a DataSource to the collection of data sources. |
46 void AddDataSource(URLDataSourceImpl* source); | 48 void AddDataSource(URLDataSourceImpl* source); |
47 | 49 |
48 // DataSource invokes this. Sends the data to the URLRequest. | 50 // DataSource invokes this. Sends the data to the URLRequest. |
49 void DataAvailable(RequestID request_id, base::RefCountedMemory* bytes); | 51 void DataAvailable(RequestID request_id, base::RefCountedMemory* bytes); |
50 | 52 |
51 static net::URLRequestJob* Factory(net::URLRequest* request, | 53 static net::URLRequestJob* Factory(net::URLRequest* request, |
52 const std::string& scheme); | 54 const std::string& scheme); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 | 90 |
89 // The ID we'll use for the next request we receive. | 91 // The ID we'll use for the next request we receive. |
90 RequestID next_request_id_; | 92 RequestID next_request_id_; |
91 | 93 |
92 DISALLOW_COPY_AND_ASSIGN(URLDataManagerBackend); | 94 DISALLOW_COPY_AND_ASSIGN(URLDataManagerBackend); |
93 }; | 95 }; |
94 | 96 |
95 // Creates protocol handler for chrome-devtools://. |is_incognito| should be | 97 // Creates protocol handler for chrome-devtools://. |is_incognito| should be |
96 // set for incognito profiles. | 98 // set for incognito profiles. |
97 net::URLRequestJobFactory::ProtocolHandler* | 99 net::URLRequestJobFactory::ProtocolHandler* |
98 CreateDevToolsProtocolHandler(URLDataManagerBackend* backend, | 100 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
99 bool is_incognito); | 101 bool is_incognito); |
100 | 102 |
101 } // namespace content | 103 } // namespace content |
102 | 104 |
103 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_BACKEND_H_ | 105 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_BACKEND_H_ |
OLD | NEW |