| OLD | NEW |
| 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/people/people_provider.h" | 5 #include "chrome/browser/ui/app_list/search/people/people_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 PeopleProvider::~PeopleProvider() {} | 50 PeopleProvider::~PeopleProvider() {} |
| 51 | 51 |
| 52 void PeopleProvider::Start(const base::string16& query) { | 52 void PeopleProvider::Start(const base::string16& query) { |
| 53 ClearResults(); | 53 ClearResults(); |
| 54 if (!IsValidQuery(query)) { | 54 if (!IsValidQuery(query)) { |
| 55 query_.clear(); | 55 query_.clear(); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 query_ = UTF16ToUTF8(query); | 59 query_ = base::UTF16ToUTF8(query); |
| 60 | 60 |
| 61 const CacheResult result = cache_->Get(WebserviceCache::PEOPLE, query_); | 61 const CacheResult result = cache_->Get(WebserviceCache::PEOPLE, query_); |
| 62 if (result.second) { | 62 if (result.second) { |
| 63 ProcessPeopleSearchResults(result.second); | 63 ProcessPeopleSearchResults(result.second); |
| 64 if (!people_search_fetched_callback_.is_null()) | 64 if (!people_search_fetched_callback_.is_null()) |
| 65 people_search_fetched_callback_.Run(); | 65 people_search_fetched_callback_.Run(); |
| 66 if (result.first == FRESH) | 66 if (result.first == FRESH) |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 | 69 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 void PeopleProvider::SetupForTest( | 192 void PeopleProvider::SetupForTest( |
| 193 const base::Closure& people_search_fetched_callback, | 193 const base::Closure& people_search_fetched_callback, |
| 194 const GURL& people_search_url) { | 194 const GURL& people_search_url) { |
| 195 people_search_fetched_callback_ = people_search_fetched_callback; | 195 people_search_fetched_callback_ = people_search_fetched_callback; |
| 196 people_search_url_ = people_search_url; | 196 people_search_url_ = people_search_url; |
| 197 skip_request_token_for_test_ = true; | 197 skip_request_token_for_test_ = true; |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace app_list | 200 } // namespace app_list |
| OLD | NEW |