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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service.cc

Issue 2342673004: Clear browsing data from ContentSuggestionService only if exists. (Closed)
Patch Set: Last comment of Bernhard Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ntp_snippets/content_suggestions_service_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 971
972 switch (state) { 972 switch (state) {
973 case State::NOT_INITED: 973 case State::NOT_INITED:
974 // Initial state, it should not be possible to get back there. 974 // Initial state, it should not be possible to get back there.
975 NOTREACHED(); 975 NOTREACHED();
976 return; 976 return;
977 977
978 case State::READY: { 978 case State::READY: {
979 DCHECK(state_ == State::NOT_INITED || state_ == State::DISABLED); 979 DCHECK(state_ == State::NOT_INITED || state_ == State::DISABLED);
980 980
981 // TODO(jkrcal): fetching snippets automatically upon creation of this
982 // lazily created service can cause troubles, e.g. in unittests where
983 // network I/O is not allowed.
984 // Either add a DCHECK here that we actually are allowed to do network I/O
985 // or change the logic so that some explicit call is always needed for the
986 // network request.
981 bool fetch_snippets = 987 bool fetch_snippets =
982 categories_[articles_category_].snippets.empty() || fetch_after_load_; 988 categories_[articles_category_].snippets.empty() || fetch_after_load_;
983 DVLOG(1) << "Entering state: READY"; 989 DVLOG(1) << "Entering state: READY";
984 state_ = State::READY; 990 state_ = State::READY;
985 fetch_after_load_ = false; 991 fetch_after_load_ = false;
986 EnterStateEnabled(fetch_snippets); 992 EnterStateEnabled(fetch_snippets);
987 return; 993 return;
988 } 994 }
989 995
990 case State::DISABLED: 996 case State::DISABLED:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 } 1061 }
1056 1062
1057 NTPSnippetsService::CategoryContent::CategoryContent() = default; 1063 NTPSnippetsService::CategoryContent::CategoryContent() = default;
1058 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) = 1064 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) =
1059 default; 1065 default;
1060 NTPSnippetsService::CategoryContent::~CategoryContent() = default; 1066 NTPSnippetsService::CategoryContent::~CategoryContent() = default;
1061 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent:: 1067 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent::
1062 operator=(CategoryContent&&) = default; 1068 operator=(CategoryContent&&) = default;
1063 1069
1064 } // namespace ntp_snippets 1070 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « chrome/browser/ntp_snippets/content_suggestions_service_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698