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

Side by Side Diff: chrome/browser/ui/app_list/search/common/json_response_fetcher.cc

Issue 23874015: Implement people search. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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/ui/app_list/search/common/json_response_fetcher.h" 5 #include "chrome/browser/ui/app_list/search/common/json_response_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/safe_json_parser.h" 9 #include "chrome/browser/safe_json_parser.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 CHECK_EQ(fetcher_.get(), source); 65 CHECK_EQ(fetcher_.get(), source);
66 66
67 scoped_ptr<net::URLFetcher> fetcher(fetcher_.Pass()); 67 scoped_ptr<net::URLFetcher> fetcher(fetcher_.Pass());
68 68
69 if (!fetcher->GetStatus().is_success() || 69 if (!fetcher->GetStatus().is_success() ||
70 fetcher->GetResponseCode() != 200) { 70 fetcher->GetResponseCode() != 200) {
71 OnJsonParseError(kBadResponse); 71 OnJsonParseError(kBadResponse);
72 return; 72 return;
73 } 73 }
74 74
75 std::string webstore_json_data; 75 std::string json_data;
76 fetcher->GetResponseAsString(&webstore_json_data); 76 fetcher->GetResponseAsString(&json_data);
77 77
78 scoped_refptr<SafeJsonParser> parser = 78 scoped_refptr<SafeJsonParser> parser =
79 new SafeJsonParser(webstore_json_data, 79 new SafeJsonParser(json_data,
80 base::Bind( 80 base::Bind(
81 &JSONResponseFetcher::OnJsonParseSuccess, 81 &JSONResponseFetcher::OnJsonParseSuccess,
82 weak_factory_.GetWeakPtr()), 82 weak_factory_.GetWeakPtr()),
83 base::Bind( 83 base::Bind(
84 &JSONResponseFetcher::OnJsonParseError, 84 &JSONResponseFetcher::OnJsonParseError,
85 weak_factory_.GetWeakPtr())); 85 weak_factory_.GetWeakPtr()));
86 // The parser will call us back via one of the callbacks. 86 // The parser will call us back via one of the callbacks.
87 parser->Start(); 87 parser->Start();
88 } 88 }
89 89
90 } // namespace app_list 90 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698