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

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

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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/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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 29 matching lines...) Expand all
40 fetcher_->Start(); 40 fetcher_->Start();
41 } 41 }
42 42
43 void JSONResponseFetcher::Stop() { 43 void JSONResponseFetcher::Stop() {
44 fetcher_.reset(); 44 fetcher_.reset();
45 weak_factory_.InvalidateWeakPtrs(); 45 weak_factory_.InvalidateWeakPtrs();
46 } 46 }
47 47
48 void JSONResponseFetcher::OnJsonParseSuccess( 48 void JSONResponseFetcher::OnJsonParseSuccess(
49 std::unique_ptr<base::Value> parsed_json) { 49 std::unique_ptr<base::Value> parsed_json) {
50 if (!parsed_json->IsType(base::Value::TYPE_DICTIONARY)) { 50 if (!parsed_json->IsType(base::Value::Type::DICTIONARY)) {
51 OnJsonParseError(kBadResponse); 51 OnJsonParseError(kBadResponse);
52 return; 52 return;
53 } 53 }
54 54
55 callback_.Run(base::WrapUnique( 55 callback_.Run(base::WrapUnique(
56 static_cast<base::DictionaryValue*>(parsed_json.release()))); 56 static_cast<base::DictionaryValue*>(parsed_json.release())));
57 } 57 }
58 58
59 void JSONResponseFetcher::OnJsonParseError(const std::string& error) { 59 void JSONResponseFetcher::OnJsonParseError(const std::string& error) {
60 callback_.Run(std::unique_ptr<base::DictionaryValue>()); 60 callback_.Run(std::unique_ptr<base::DictionaryValue>());
(...skipping 16 matching lines...) Expand all
77 77
78 // The parser will call us back via one of the callbacks. 78 // The parser will call us back via one of the callbacks.
79 safe_json::SafeJsonParser::Parse( 79 safe_json::SafeJsonParser::Parse(
80 json_data, base::Bind(&JSONResponseFetcher::OnJsonParseSuccess, 80 json_data, base::Bind(&JSONResponseFetcher::OnJsonParseSuccess,
81 weak_factory_.GetWeakPtr()), 81 weak_factory_.GetWeakPtr()),
82 base::Bind(&JSONResponseFetcher::OnJsonParseError, 82 base::Bind(&JSONResponseFetcher::OnJsonParseError,
83 weak_factory_.GetWeakPtr())); 83 weak_factory_.GetWeakPtr()));
84 } 84 }
85 85
86 } // namespace app_list 86 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack_unittest.cc ('k') | chrome/browser/ui/cocoa/applescript/apple_event_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698