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

Side by Side Diff: chrome/browser/ui/webui/snippets_internals_message_handler.cc

Issue 2519053002: 📰 Let the backend trigger sign in related refreshes (Closed)
Patch Set: Created 4 years 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 "chrome/browser/ui/webui/snippets_internals_message_handler.h" 5 #include "chrome/browser/ui/webui/snippets_internals_message_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SendContentSuggestions(); 143 SendContentSuggestions();
144 } 144 }
145 145
146 void SnippetsInternalsMessageHandler::OnSuggestionInvalidated( 146 void SnippetsInternalsMessageHandler::OnSuggestionInvalidated(
147 const ntp_snippets::ContentSuggestion::ID& suggestion_id) { 147 const ntp_snippets::ContentSuggestion::ID& suggestion_id) {
148 if (!dom_loaded_) 148 if (!dom_loaded_)
149 return; 149 return;
150 SendContentSuggestions(); 150 SendContentSuggestions();
151 } 151 }
152 152
153 void SnippetsInternalsMessageHandler::OnFullRefreshRequired() {
154 if (!dom_loaded_) {
Bernhard Bauer 2016/11/21 15:48:15 It might be worth moving this check into SendConte
dgn 2016/11/21 16:22:07 There are a bunch of calls below that don't check
155 return;
156 }
157 SendContentSuggestions();
158 }
159
153 void SnippetsInternalsMessageHandler::ContentSuggestionsServiceShutdown() {} 160 void SnippetsInternalsMessageHandler::ContentSuggestionsServiceShutdown() {}
154 161
155 void SnippetsInternalsMessageHandler::HandleRefreshContent( 162 void SnippetsInternalsMessageHandler::HandleRefreshContent(
156 const base::ListValue* args) { 163 const base::ListValue* args) {
157 DCHECK_EQ(0u, args->GetSize()); 164 DCHECK_EQ(0u, args->GetSize());
158 165
159 dom_loaded_ = true; 166 dom_loaded_ = true;
160 167
161 for (std::pair<const Category, DismissedState>& category_state_pair : 168 for (std::pair<const Category, DismissedState>& category_state_pair :
162 dismissed_state_) { 169 dismissed_state_) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 403
397 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( 404 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded(
398 Category category, 405 Category category,
399 std::vector<ContentSuggestion> dismissed_suggestions) { 406 std::vector<ContentSuggestion> dismissed_suggestions) {
400 if (dismissed_state_[category] == DismissedState::HIDDEN) 407 if (dismissed_state_[category] == DismissedState::HIDDEN)
401 return; 408 return;
402 dismissed_suggestions_[category] = std::move(dismissed_suggestions); 409 dismissed_suggestions_[category] = std::move(dismissed_suggestions);
403 dismissed_state_[category] = DismissedState::VISIBLE; 410 dismissed_state_[category] = DismissedState::VISIBLE;
404 SendContentSuggestions(); 411 SendContentSuggestions();
405 } 412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698