Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 "https://chromereader-pa.googleapis.com/v1/fetch"; | 31 "https://chromereader-pa.googleapis.com/v1/fetch"; |
| 32 const char kAuthorizationRequestHeaderFormat[] = "Bearer %s"; | 32 const char kAuthorizationRequestHeaderFormat[] = "Bearer %s"; |
| 33 | 33 |
| 34 const char kRequestParameterFormat[] = | 34 const char kRequestParameterFormat[] = |
| 35 "{" | 35 "{" |
| 36 " \"response_detail_level\": \"STANDARD\"," | 36 " \"response_detail_level\": \"STANDARD\"," |
| 37 " \"advanced_options\": {" | 37 " \"advanced_options\": {" |
| 38 " \"local_scoring_params\": {" | 38 " \"local_scoring_params\": {" |
| 39 " \"content_params\": {" | 39 " \"content_params\": {" |
| 40 " \"only_return_personalized_results\": false" | 40 " \"only_return_personalized_results\": false" |
| 41 " }," | |
| 42 " \"content_restricts\": {" | |
| 43 " \"type\": \"METADATA\"," | |
| 44 " \"value\": \"ALL\"" | |
|
May
2016/04/06 13:39:20
Does ALL mean title, snippet, thumbnail, URL? Or w
Marc Treib
2016/04/06 13:52:54
ALL means title, snippet, and thumbnail. (Presumab
May
2016/04/07 16:05:12
Yeah, I think so. It would insulate us better from
Marc Treib
2016/04/07 16:15:52
Done.
| |
| 41 " }" | 45 " }" |
| 42 "%s" | 46 "%s" |
| 43 " }," | 47 " }," |
| 44 " \"global_scoring_params\": {" | 48 " \"global_scoring_params\": {" |
| 45 " \"num_to_return\": 10" | 49 " \"num_to_return\": 10" |
| 46 " }" | 50 " }" |
| 47 " }" | 51 " }" |
| 48 "}"; | 52 "}"; |
| 49 | 53 |
| 50 const char kHostRestrictFormat[] = | 54 const char kHostRestrictFormat[] = |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 } | 169 } |
| 166 | 170 |
| 167 std::string response; | 171 std::string response; |
| 168 bool stores_result_to_string = source->GetResponseAsString(&response); | 172 bool stores_result_to_string = source->GetResponseAsString(&response); |
| 169 DCHECK(stores_result_to_string); | 173 DCHECK(stores_result_to_string); |
| 170 | 174 |
| 171 callback_list_.Notify(response); | 175 callback_list_.Notify(response); |
| 172 } | 176 } |
| 173 | 177 |
| 174 } // namespace ntp_snippets | 178 } // namespace ntp_snippets |
| OLD | NEW |