Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: content/browser/webui/url_data_manager_backend.h

Issue 11308362: Add StoragePartition's ProtocolHandlers at URLRequestContext construction time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address awong's comments Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
41 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler( 42 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler(
42 URLDataManagerBackend* backend, 43 content::ResourceContext* resource_context,
43 bool is_incognito); 44 bool is_incognito);
44 45
45 // Adds a DataSource to the collection of data sources. 46 // Adds a DataSource to the collection of data sources.
46 void AddDataSource(URLDataSourceImpl* source); 47 void AddDataSource(URLDataSourceImpl* source);
47 48
48 // DataSource invokes this. Sends the data to the URLRequest. 49 // DataSource invokes this. Sends the data to the URLRequest.
49 void DataAvailable(RequestID request_id, base::RefCountedMemory* bytes); 50 void DataAvailable(RequestID request_id, base::RefCountedMemory* bytes);
50 51
51 static net::URLRequestJob* Factory(net::URLRequest* request, 52 static net::URLRequestJob* Factory(net::URLRequest* request,
52 const std::string& scheme); 53 const std::string& scheme);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 89
89 // The ID we'll use for the next request we receive. 90 // The ID we'll use for the next request we receive.
90 RequestID next_request_id_; 91 RequestID next_request_id_;
91 92
92 DISALLOW_COPY_AND_ASSIGN(URLDataManagerBackend); 93 DISALLOW_COPY_AND_ASSIGN(URLDataManagerBackend);
93 }; 94 };
94 95
95 // Creates protocol handler for chrome-devtools://. |is_incognito| should be 96 // Creates protocol handler for chrome-devtools://. |is_incognito| should be
96 // set for incognito profiles. 97 // set for incognito profiles.
97 net::URLRequestJobFactory::ProtocolHandler* 98 net::URLRequestJobFactory::ProtocolHandler*
98 CreateDevToolsProtocolHandler(URLDataManagerBackend* backend, 99 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context,
99 bool is_incognito); 100 bool is_incognito);
100 101
101 } // namespace content 102 } // namespace content
102 103
103 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_BACKEND_H_ 104 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_MANAGER_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698