OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_WEB_RESOURCE_IOS_WEB_RESOURCE_SERVICE_H_ |
| 6 #define IOS_CHROME_BROWSER_WEB_RESOURCE_IOS_WEB_RESOURCE_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "components/web_resource/web_resource_service.h" |
| 13 |
| 14 // iOS implementation of WebResourceService. |
| 15 // IOSWebResourceService does not parses JSON out of process, because of |
| 16 // platform limitations. |
| 17 class IOSWebResourceService : public web_resource::WebResourceService { |
| 18 public: |
| 19 IOSWebResourceService(PrefService* prefs, |
| 20 const GURL& web_resource_server, |
| 21 bool apply_locale_to_url, |
| 22 const char* last_update_time_pref_name, |
| 23 int start_fetch_delay_ms, |
| 24 int cache_update_delay_ms); |
| 25 |
| 26 protected: |
| 27 ~IOSWebResourceService() override; |
| 28 |
| 29 private: |
| 30 // Parses JSON in a background thread. |
| 31 static base::Closure ParseJSONOnBackgroundThread( |
| 32 const std::string& data, |
| 33 const SuccessCallback& success_callback, |
| 34 const ErrorCallback& error_callback); |
| 35 |
| 36 // WebResourceService implementation: |
| 37 void ParseJSON(const std::string& data, |
| 38 const SuccessCallback& success_callback, |
| 39 const ErrorCallback& error_callback) override; |
| 40 net::URLRequestContextGetter* GetRequestContext() override; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(IOSWebResourceService); |
| 43 }; |
| 44 |
| 45 #endif // IOS_CHROME_BROWSER_WEB_RESOURCE_IOS_WEB_RESOURCE_SERVICE_H_ |
OLD | NEW |