| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp_snippets/ntp_snippets_fetcher.h" | 5 #include "components/ntp_snippets/ntp_snippets_fetcher.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 const char kContentSnippetsServerFormat[] = | 27 const char kContentSnippetsServerFormat[] = |
| 28 "https://chromereader-pa.googleapis.com/v1/fetch?key=%s"; | 28 "https://chromereader-pa.googleapis.com/v1/fetch?key=%s"; |
| 29 | 29 |
| 30 const char kRequestParameterFormat[] = | 30 const char kRequestParameterFormat[] = |
| 31 "{" | 31 "{" |
| 32 " \"response_detail_level\": \"STANDARD\"," | 32 " \"response_detail_level\": \"STANDARD\"," |
| 33 " \"advanced_options\": {" | 33 " \"advanced_options\": {" |
| 34 " \"local_scoring_params\": {" | 34 " \"local_scoring_params\": {" |
| 35 " \"content_params\": {" | 35 " \"content_params\": {" |
| 36 " \"only_return_personalized_results\": false" | 36 " \"only_return_personalized_results\": false" |
| 37 " }," |
| 38 " \"content_restricts\": {" |
| 39 " \"type\": \"METADATA\"," |
| 40 " \"value\": \"TITLE\"" |
| 41 " }," |
| 42 " \"content_restricts\": {" |
| 43 " \"type\": \"METADATA\"," |
| 44 " \"value\": \"SNIPPET\"" |
| 45 " }," |
| 46 " \"content_restricts\": {" |
| 47 " \"type\": \"METADATA\"," |
| 48 " \"value\": \"THUMBNAIL\"" |
| 37 " }" | 49 " }" |
| 38 "%s" | 50 "%s" |
| 39 " }," | 51 " }," |
| 40 " \"global_scoring_params\": {" | 52 " \"global_scoring_params\": {" |
| 41 " \"num_to_return\": 10" | 53 " \"num_to_return\": 10" |
| 42 " }" | 54 " }" |
| 43 " }" | 55 " }" |
| 44 "}"; | 56 "}"; |
| 45 | 57 |
| 46 const char kHostRestrictFormat[] = | 58 const char kHostRestrictFormat[] = |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 126 } |
| 115 | 127 |
| 116 std::string response; | 128 std::string response; |
| 117 bool stores_result_to_string = source->GetResponseAsString(&response); | 129 bool stores_result_to_string = source->GetResponseAsString(&response); |
| 118 DCHECK(stores_result_to_string); | 130 DCHECK(stores_result_to_string); |
| 119 | 131 |
| 120 callback_list_.Notify(response); | 132 callback_list_.Notify(response); |
| 121 } | 133 } |
| 122 | 134 |
| 123 } // namespace ntp_snippets | 135 } // namespace ntp_snippets |
| OLD | NEW |