| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_INTERNAL_WEB_WEBUI_URL_DATA_MANAGER_BACKEND_IOS_H_ | 5 #ifndef IOS_INTERNAL_WEB_WEBUI_URL_DATA_MANAGER_BACKEND_IOS_H_ |
| 6 #define IOS_INTERNAL_WEB_WEBUI_URL_DATA_MANAGER_BACKEND_IOS_H_ | 6 #define IOS_INTERNAL_WEB_WEBUI_URL_DATA_MANAGER_BACKEND_IOS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
| 16 #include "ios/web/public/url_data_source_ios.h" | 16 #include "ios/web/public/url_data_source_ios.h" |
| 17 #include "ios/web/webui/url_data_manager_ios.h" | 17 #include "ios/web/webui/url_data_manager_ios.h" |
| 18 #include "net/url_request/url_request_job_factory.h" | 18 #include "net/url_request/url_request_job_factory.h" |
| 19 | 19 |
| 20 class GURL; | 20 class GURL; |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class RefCountedMemory; | 23 class RefCountedMemory; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace web { | 26 namespace web { |
| 27 class BrowserState; | 27 class BrowserState; |
| 28 class URLDataSourceIOSImpl; | 28 class URLDataSourceIOSImpl; |
| 29 class URLRequestChromeJob; | 29 class URLRequestChromeJob; |
| 30 | 30 |
| 31 // URLDataManagerIOSBackend is used internally by URLDataManagerIOS on | 31 // URLDataManagerIOSBackend is used internally by URLDataManagerIOS on |
| 32 // the IO thread. In most cases you can use the API in URLDataManagerIOS | 32 // the IO thread. In most cases you can use the API in URLDataManagerIOS |
| 33 // and ignore this class. URLDataManagerIOSBackend is owned by BrowserState. | 33 // and ignore this class. URLDataManagerIOSBackend is owned by BrowserState. |
| 34 class URLDataManagerIOSBackend : public base::SupportsUserData::Data { | 34 class URLDataManagerIOSBackend : public base::SupportsUserData::Data { |
| 35 public: | 35 public: |
| 36 typedef int RequestID; | 36 typedef int RequestID; |
| 37 | 37 |
| 38 URLDataManagerIOSBackend(); | 38 URLDataManagerIOSBackend(); |
| 39 ~URLDataManagerIOSBackend() override; | 39 ~URLDataManagerIOSBackend() override; |
| 40 | 40 |
| 41 // Invoked to create the protocol handler for chrome://. |is_incognito| should | 41 // Invoked to create the protocol handler for chrome://. |is_incognito| should |
| 42 // be set for incognito browser states. Called on the UI thread. | 42 // be set for incognito browser states. Called on the UI thread. |
| 43 static scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 43 static std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 44 CreateProtocolHandler(BrowserState* browser_state); | 44 CreateProtocolHandler(BrowserState* browser_state); |
| 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(URLDataSourceIOSImpl* source); | 47 void AddDataSource(URLDataSourceIOSImpl* 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); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // The ID we'll use for the next request we receive. | 93 // The ID we'll use for the next request we receive. |
| 94 RequestID next_request_id_; | 94 RequestID next_request_id_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(URLDataManagerIOSBackend); | 96 DISALLOW_COPY_AND_ASSIGN(URLDataManagerIOSBackend); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace web | 99 } // namespace web |
| 100 | 100 |
| 101 #endif // IOS_INTERNAL_WEB_WEBUI_URL_DATA_MANAGER_BACKEND_IOS_H_ | 101 #endif // IOS_INTERNAL_WEB_WEBUI_URL_DATA_MANAGER_BACKEND_IOS_H_ |
| OLD | NEW |