Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc

Issue 2691393002: Fix auto raw pointer deduction on linux (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/scheduling_remote_suggestions_provider. h" 5 #include "components/ntp_snippets/remote/scheduling_remote_suggestions_provider. h"
6 6
7 #include <random> 7 #include <random>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 532 }
533 533
534 std::vector<std::string> tokens = base::SplitString( 534 std::vector<std::string> tokens = base::SplitString(
535 param_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 535 param_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
536 if (tokens.empty()) { 536 if (tokens.empty()) {
537 return GetDefaultEnabledTriggerTypes(); 537 return GetDefaultEnabledTriggerTypes();
538 } 538 }
539 539
540 std::set<TriggerType> enabled_types; 540 std::set<TriggerType> enabled_types;
541 for (const auto& token : tokens) { 541 for (const auto& token : tokens) {
542 auto it = std::find(std::begin(kTriggerTypeNames), 542 auto** it = std::find(std::begin(kTriggerTypeNames),
543 std::end(kTriggerTypeNames), token); 543 std::end(kTriggerTypeNames), token);
544 if (it == std::end(kTriggerTypeNames)) { 544 if (it == std::end(kTriggerTypeNames)) {
545 DLOG(WARNING) << "Failed to parse variation param " 545 DLOG(WARNING) << "Failed to parse variation param "
546 << kTriggerTypesParamName << " with string value " 546 << kTriggerTypesParamName << " with string value "
547 << param_value 547 << param_value
548 << " into a comma-separated list of keywords. " 548 << " into a comma-separated list of keywords. "
549 << "Unknown token " << token 549 << "Unknown token " << token
550 << " found. Falling back to default value."; 550 << " found. Falling back to default value.";
551 return GetDefaultEnabledTriggerTypes(); 551 return GetDefaultEnabledTriggerTypes();
552 } 552 }
553 553
554 // Add the enabled type represented by |token| into the result set. 554 // Add the enabled type represented by |token| into the result set.
555 enabled_types.insert( 555 enabled_types.insert(
556 static_cast<TriggerType>(it - std::begin(kTriggerTypeNames))); 556 static_cast<TriggerType>(it - std::begin(kTriggerTypeNames)));
557 } 557 }
558 return enabled_types; 558 return enabled_types;
559 } 559 }
560 560
561 std::set<SchedulingRemoteSuggestionsProvider::TriggerType> 561 std::set<SchedulingRemoteSuggestionsProvider::TriggerType>
562 SchedulingRemoteSuggestionsProvider::GetDefaultEnabledTriggerTypes() { 562 SchedulingRemoteSuggestionsProvider::GetDefaultEnabledTriggerTypes() {
563 return {TriggerType::PERSISTENT_SCHEDULER_WAKE_UP, TriggerType::NTP_OPENED, 563 return {TriggerType::PERSISTENT_SCHEDULER_WAKE_UP, TriggerType::NTP_OPENED,
564 TriggerType::BROWSER_FOREGROUNDED}; 564 TriggerType::BROWSER_FOREGROUNDED};
565 } 565 }
566 566
567 } // namespace ntp_snippets 567 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698