Roll src/third_party/WebKit 9e29598:6a61df7 (svn 201110:201111)
[chromium-blink-merge.git] / chrome / browser / web_resource / chrome_web_resource_service.cc
blob47a1335316ebe87ca1856f1b675138890687497d
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.
5 #include "chrome/browser/web_resource/chrome_web_resource_service.h"
7 #include <string>
9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "components/safe_json/safe_json_parser.h"
13 #include "url/gurl.h"
15 ChromeWebResourceService::ChromeWebResourceService(
16 PrefService* prefs,
17 const GURL& web_resource_server,
18 bool apply_locale_to_url,
19 const char* last_update_time_pref_name,
20 int start_fetch_delay_ms,
21 int cache_update_delay_ms)
22 : web_resource::WebResourceService(
23 prefs,
24 web_resource_server,
25 apply_locale_to_url ? g_browser_process->GetApplicationLocale()
26 : std::string(),
27 last_update_time_pref_name,
28 start_fetch_delay_ms,
29 cache_update_delay_ms,
30 g_browser_process->system_request_context(),
31 switches::kDisableBackgroundNetworking) {
34 ChromeWebResourceService::~ChromeWebResourceService() {
37 void ChromeWebResourceService::ParseJSON(
38 const std::string& data,
39 const SuccessCallback& success_callback,
40 const ErrorCallback& error_callback) {
41 safe_json::SafeJsonParser::Parse(data, success_callback, error_callback);