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

Side by Side Diff: chrome/browser/extensions/webstore_data_fetcher.cc

Issue 1140053003: Refactoring: Moving the SafeJsonParser to its own component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing export macro, duplicate android string Created 5 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/extensions/webstore_data_fetcher.h" 5 #include "chrome/browser/extensions/webstore_data_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h" 9 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h"
10 #include "chrome/browser/safe_json_parser.h" 10 #include "components/safe_json_parser/safe_json_parser.h"
11 #include "extensions/common/extension_urls.h" 11 #include "extensions/common/extension_urls.h"
12 #include "net/base/load_flags.h" 12 #include "net/base/load_flags.h"
13 #include "net/url_request/url_fetcher.h" 13 #include "net/url_request/url_fetcher.h"
14 #include "net/url_request/url_request_status.h" 14 #include "net/url_request/url_request_status.h"
15 15
16 namespace { 16 namespace {
17 17
18 const char kInvalidWebstoreResponseError[] = "Invalid Chrome Web Store reponse"; 18 const char kInvalidWebstoreResponseError[] = "Invalid Chrome Web Store reponse";
19 19
20 } // namespace 20 } // namespace
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 if (!fetcher->GetStatus().is_success() || 76 if (!fetcher->GetStatus().is_success() ||
77 fetcher->GetResponseCode() != 200) { 77 fetcher->GetResponseCode() != 200) {
78 delegate_->OnWebstoreRequestFailure(); 78 delegate_->OnWebstoreRequestFailure();
79 return; 79 return;
80 } 80 }
81 81
82 std::string webstore_json_data; 82 std::string webstore_json_data;
83 fetcher->GetResponseAsString(&webstore_json_data); 83 fetcher->GetResponseAsString(&webstore_json_data);
84 84
85 scoped_refptr<SafeJsonParser> parser = 85 scoped_refptr<safe_json_parser::SafeJsonParser> parser =
86 new SafeJsonParser(webstore_json_data, 86 new safe_json_parser::SafeJsonParser(
87 base::Bind(&WebstoreDataFetcher::OnJsonParseSuccess, 87 webstore_json_data,
88 AsWeakPtr()), 88 base::Bind(&WebstoreDataFetcher::OnJsonParseSuccess, AsWeakPtr()),
89 base::Bind(&WebstoreDataFetcher::OnJsonParseFailure, 89 base::Bind(&WebstoreDataFetcher::OnJsonParseFailure, AsWeakPtr()));
90 AsWeakPtr()));
91 // The parser will call us back via one of the callbacks. 90 // The parser will call us back via one of the callbacks.
92 parser->Start(); 91 parser->Start();
93 } 92 }
94 93
95 } // namespace extensions 94 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698