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

Side by Side Diff: chrome/browser/ui/webui/chrome_url_data_manager_backend.h

Issue 11881055: Simplify WebUI data sources. Currently WebUI data sources implement a URLDataSourceDelegate interfa… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix issue in about_ui exposed by cros tests Created 7 years, 11 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 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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 26 matching lines...) Expand all
37 typedef int RequestID; 37 typedef int RequestID;
38 38
39 ChromeURLDataManagerBackend(); 39 ChromeURLDataManagerBackend();
40 ~ChromeURLDataManagerBackend(); 40 ~ChromeURLDataManagerBackend();
41 41
42 // Invoked to create the protocol handler for chrome://. 42 // Invoked to create the protocol handler for chrome://.
43 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler( 43 static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler(
44 ChromeURLDataManagerBackend* backend); 44 ChromeURLDataManagerBackend* backend);
45 45
46 // Adds a DataSource to the collection of data sources. 46 // Adds a DataSource to the collection of data sources.
47 void AddDataSource(URLDataSource* source); 47 void AddDataSource(URLDataSourceImpl* source);
48 48
49 // DataSource invokes this. Sends the data to the URLRequest. 49 // DataSource invokes this. Sends the data to the URLRequest.
50 void DataAvailable(RequestID request_id, base::RefCountedMemory* bytes); 50 void DataAvailable(RequestID request_id, base::RefCountedMemory* bytes);
51 51
52 static net::URLRequestJob* Factory(net::URLRequest* request, 52 static net::URLRequestJob* Factory(net::URLRequest* request,
53 const std::string& scheme); 53 const std::string& scheme);
54 54
55 private: 55 private:
56 friend class URLRequestChromeJob; 56 friend class URLRequestChromeJob;
57 57
58 typedef std::map<std::string, 58 typedef std::map<std::string,
59 scoped_refptr<URLDataSource> > DataSourceMap; 59 scoped_refptr<URLDataSourceImpl> > DataSourceMap;
60 typedef std::map<RequestID, URLRequestChromeJob*> PendingRequestMap; 60 typedef std::map<RequestID, URLRequestChromeJob*> PendingRequestMap;
61 61
62 // Called by the job when it's starting up. 62 // Called by the job when it's starting up.
63 // Returns false if |url| is not a URL managed by this object. 63 // Returns false if |url| is not a URL managed by this object.
64 bool StartRequest(const GURL& url, URLRequestChromeJob* job); 64 bool StartRequest(const GURL& url, URLRequestChromeJob* job);
65 65
66 // Helper function to call StartDataRequest on |source|'s delegate. This is 66 // Helper function to call StartDataRequest on |source|'s delegate. This is
67 // needed because while we want to call URLDataSourceDelegate's method, we 67 // needed because while we want to call URLDataSourceDelegate's method, we
68 // need to add a refcount on the source. 68 // need to add a refcount on the source.
69 static void CallStartRequest(scoped_refptr<URLDataSource> source, 69 static void CallStartRequest(scoped_refptr<URLDataSourceImpl> source,
70 const std::string& path, 70 const std::string& path,
71 bool is_incognito, 71 bool is_incognito,
72 int request_id); 72 int request_id);
73 73
74 // Remove a request from the list of pending requests. 74 // Remove a request from the list of pending requests.
75 void RemoveRequest(URLRequestChromeJob* job); 75 void RemoveRequest(URLRequestChromeJob* job);
76 76
77 // Returns true if the job exists in |pending_requests_|. False otherwise. 77 // Returns true if the job exists in |pending_requests_|. False otherwise.
78 // Called by ~URLRequestChromeJob to verify that |pending_requests_| is kept 78 // Called by ~URLRequestChromeJob to verify that |pending_requests_| is kept
79 // up to date. 79 // up to date.
(...skipping 11 matching lines...) Expand all
91 RequestID next_request_id_; 91 RequestID next_request_id_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManagerBackend); 93 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManagerBackend);
94 }; 94 };
95 95
96 net::URLRequestJobFactory::ProtocolHandler* 96 net::URLRequestJobFactory::ProtocolHandler*
97 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend, 97 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend,
98 net::NetworkDelegate* network_delegate); 98 net::NetworkDelegate* network_delegate);
99 99
100 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_ 100 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698