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

Unified Diff: ios/chrome/browser/web_resource/ios_web_resource_service.h

Issue 880433002: In-process JSON parsing for web resources on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded include Created 5 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/web_resource/ios_web_resource_service.h
diff --git a/ios/chrome/browser/web_resource/ios_web_resource_service.h b/ios/chrome/browser/web_resource/ios_web_resource_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c7ec15f82d61025f6132315b38b21f3937f7b43
--- /dev/null
+++ b/ios/chrome/browser/web_resource/ios_web_resource_service.h
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_WEB_RESOURCE_IOS_WEB_RESOURCE_SERVICE_H_
+#define IOS_CHROME_BROWSER_WEB_RESOURCE_IOS_WEB_RESOURCE_SERVICE_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "components/web_resource/web_resource_service.h"
+
+// iOS implementation of WebResourceService.
+// IOSWebResourceService does not parses JSON out of process, because of
+// platform limitations.
+class IOSWebResourceService : public web_resource::WebResourceService {
+ public:
+ IOSWebResourceService(PrefService* prefs,
+ const GURL& web_resource_server,
+ bool apply_locale_to_url,
+ const char* last_update_time_pref_name,
+ int start_fetch_delay_ms,
+ int cache_update_delay_ms);
+
+ protected:
+ ~IOSWebResourceService() override;
+
+ private:
+ // Parses JSON in a background thread.
+ static base::Closure ParseJSONOnBackgroundThread(
Bernhard Bauer 2015/01/26 12:05:43 If this method is static and private, it can just
droger 2015/01/26 12:14:23 I put the method in the class because the SuccessC
Bernhard Bauer 2015/01/26 12:22:49 Oh, I see. Hm, in that case either approach is fi
droger 2015/01/26 12:28:19 Ok, I left it as is then, to minimize the size of
+ scoped_ptr<std::string> data,
+ const SuccessCallback& success_callback,
+ const ErrorCallback& error_callback);
+
+ // WebResourceService implementation:
+ void ParseJSON(const std::string& data,
+ const SuccessCallback& success_callback,
+ const ErrorCallback& error_callback) override;
+ net::URLRequestContextGetter* GetRequestContext() override;
+
+ DISALLOW_COPY_AND_ASSIGN(IOSWebResourceService);
+};
+
+#endif // IOS_CHROME_BROWSER_WEB_RESOURCE_IOS_WEB_RESOURCE_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698