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/remote/ntp_snippets_fetcher.h" | 5 #include "components/ntp_snippets/remote/ntp_snippets_fetcher.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 bool IsSendingTopLanguagesEnabled() { | 150 bool IsSendingTopLanguagesEnabled() { |
151 return IsBooleanParameterEnabled(kSendTopLanguagesName, false); | 151 return IsBooleanParameterEnabled(kSendTopLanguagesName, false); |
152 } | 152 } |
153 | 153 |
154 bool IsSendingUserClassEnabled() { | 154 bool IsSendingUserClassEnabled() { |
155 return IsBooleanParameterEnabled(kSendUserClassName, false); | 155 return IsBooleanParameterEnabled(kSendUserClassName, false); |
156 } | 156 } |
157 | 157 |
158 bool UsesChromeContentSuggestionsAPI(const GURL& endpoint) { | 158 bool UsesChromeContentSuggestionsAPI(const GURL& endpoint) { |
159 if (endpoint == GURL(kChromeReaderServer)) | 159 if (endpoint == kChromeReaderServer) |
160 return false; | 160 return false; |
161 | 161 |
162 if (endpoint != GURL(kContentSuggestionsServer) && | 162 if (endpoint != kContentSuggestionsServer && |
163 endpoint != GURL(kContentSuggestionsStagingServer) && | 163 endpoint != kContentSuggestionsStagingServer && |
164 endpoint != GURL(kContentSuggestionsAlphaServer)) { | 164 endpoint != kContentSuggestionsAlphaServer) { |
165 LOG(WARNING) << "Unknown value for " << kContentSuggestionsBackend << ": " | 165 LOG(WARNING) << "Unknown value for " << kContentSuggestionsBackend << ": " |
166 << "assuming chromecontentsuggestions-style API"; | 166 << "assuming chromecontentsuggestions-style API"; |
167 } | 167 } |
168 return true; | 168 return true; |
169 } | 169 } |
170 | 170 |
171 // Creates snippets from dictionary values in |list| and adds them to | 171 // Creates snippets from dictionary values in |list| and adds them to |
172 // |snippets|. Returns true on success, false if anything went wrong. | 172 // |snippets|. Returns true on success, false if anything went wrong. |
173 // |remote_category_id| is only used if |content_suggestions_api| is true. | 173 // |remote_category_id| is only used if |content_suggestions_api| is true. |
174 bool AddSnippetsFromListValue(bool content_suggestions_api, | 174 bool AddSnippetsFromListValue(bool content_suggestions_api, |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 interactive_request); | 817 interactive_request); |
818 case UserClassifier::UserClass::ACTIVE_SUGGESTIONS_CONSUMER: | 818 case UserClassifier::UserClass::ACTIVE_SUGGESTIONS_CONSUMER: |
819 return request_throttler_active_suggestions_consumer_ | 819 return request_throttler_active_suggestions_consumer_ |
820 .DemandQuotaForRequest(interactive_request); | 820 .DemandQuotaForRequest(interactive_request); |
821 } | 821 } |
822 NOTREACHED(); | 822 NOTREACHED(); |
823 return false; | 823 return false; |
824 } | 824 } |
825 | 825 |
826 } // namespace ntp_snippets | 826 } // namespace ntp_snippets |
OLD | NEW |