| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/history/core/browser/web_history_service.h" | 5 #include "components/history/core/browser/web_history_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 callback); | 353 callback); |
| 354 } | 354 } |
| 355 | 355 |
| 356 // static | 356 // static |
| 357 std::unique_ptr<base::DictionaryValue> WebHistoryService::ReadResponse( | 357 std::unique_ptr<base::DictionaryValue> WebHistoryService::ReadResponse( |
| 358 WebHistoryService::Request* request) { | 358 WebHistoryService::Request* request) { |
| 359 std::unique_ptr<base::DictionaryValue> result; | 359 std::unique_ptr<base::DictionaryValue> result; |
| 360 if (request->GetResponseCode() == net::HTTP_OK) { | 360 if (request->GetResponseCode() == net::HTTP_OK) { |
| 361 std::unique_ptr<base::Value> value = | 361 std::unique_ptr<base::Value> value = |
| 362 base::JSONReader::Read(request->GetResponseBody()); | 362 base::JSONReader::Read(request->GetResponseBody()); |
| 363 if (value.get() && value.get()->IsType(base::Value::TYPE_DICTIONARY)) | 363 if (value.get() && value.get()->IsType(base::Value::Type::DICTIONARY)) |
| 364 result.reset(static_cast<base::DictionaryValue*>(value.release())); | 364 result.reset(static_cast<base::DictionaryValue*>(value.release())); |
| 365 else | 365 else |
| 366 DLOG(WARNING) << "Non-JSON response received from history server."; | 366 DLOG(WARNING) << "Non-JSON response received from history server."; |
| 367 } | 367 } |
| 368 return result; | 368 return result; |
| 369 } | 369 } |
| 370 | 370 |
| 371 std::unique_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory( | 371 std::unique_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory( |
| 372 const base::string16& text_query, | 372 const base::string16& text_query, |
| 373 const QueryOptions& options, | 373 const QueryOptions& options, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 if (success && request->GetResponseCode() == net::HTTP_OK) { | 629 if (success && request->GetResponseCode() == net::HTTP_OK) { |
| 630 sync_pb::HistoryStatusResponse history_status; | 630 sync_pb::HistoryStatusResponse history_status; |
| 631 if (history_status.ParseFromString(request->GetResponseBody())) | 631 if (history_status.ParseFromString(request->GetResponseBody())) |
| 632 has_other_forms_of_browsing_history = history_status.has_derived_data(); | 632 has_other_forms_of_browsing_history = history_status.has_derived_data(); |
| 633 } | 633 } |
| 634 | 634 |
| 635 callback.Run(has_other_forms_of_browsing_history); | 635 callback.Run(has_other_forms_of_browsing_history); |
| 636 } | 636 } |
| 637 | 637 |
| 638 } // namespace history | 638 } // namespace history |
| OLD | NEW |