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

Side by Side Diff: components/suggestions/suggestions_store.cc

Issue 1549993003: Switch to standard integer types in components/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/suggestions/suggestions_store.h" 5 #include "components/suggestions/suggestions_store.h"
6 6
7 #include <stdint.h>
8
7 #include <string> 9 #include <string>
8 10
9 #include "base/base64.h" 11 #include "base/base64.h"
10 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
11 #include "base/time/default_clock.h" 13 #include "base/time/default_clock.h"
12 #include "base/time/time.h" 14 #include "base/time/time.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 15 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "components/suggestions/suggestions_pref_names.h" 16 #include "components/suggestions/suggestions_pref_names.h"
15 17
16 namespace suggestions { 18 namespace suggestions {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 StoreSuggestions(*suggestions); 64 StoreSuggestions(*suggestions);
63 } 65 }
64 } 66 }
65 67
66 return true; 68 return true;
67 } 69 }
68 70
69 void SuggestionsStore::FilterExpiredSuggestions( 71 void SuggestionsStore::FilterExpiredSuggestions(
70 SuggestionsProfile* suggestions) { 72 SuggestionsProfile* suggestions) {
71 SuggestionsProfile filtered_suggestions; 73 SuggestionsProfile filtered_suggestions;
72 int64 now_usec = 74 int64_t now_usec =
73 (this->clock_->Now() - base::Time::UnixEpoch()).ToInternalValue(); 75 (this->clock_->Now() - base::Time::UnixEpoch()).ToInternalValue();
74 76
75 for (int i = 0; i < suggestions->suggestions_size(); ++i) { 77 for (int i = 0; i < suggestions->suggestions_size(); ++i) {
76 ChromeSuggestion* suggestion = suggestions->mutable_suggestions(i); 78 ChromeSuggestion* suggestion = suggestions->mutable_suggestions(i);
77 if (!suggestion->has_expiry_ts() || suggestion->expiry_ts() > now_usec) { 79 if (!suggestion->has_expiry_ts() || suggestion->expiry_ts() > now_usec) {
78 filtered_suggestions.add_suggestions()->Swap(suggestion); 80 filtered_suggestions.add_suggestions()->Swap(suggestion);
79 } 81 }
80 } 82 }
81 suggestions->Swap(&filtered_suggestions); 83 suggestions->Swap(&filtered_suggestions);
82 } 84 }
(...skipping 13 matching lines...) Expand all
96 pref_service_->ClearPref(prefs::kSuggestionsData); 98 pref_service_->ClearPref(prefs::kSuggestionsData);
97 } 99 }
98 100
99 // static 101 // static
100 void SuggestionsStore::RegisterProfilePrefs( 102 void SuggestionsStore::RegisterProfilePrefs(
101 user_prefs::PrefRegistrySyncable* registry) { 103 user_prefs::PrefRegistrySyncable* registry) {
102 registry->RegisterStringPref(prefs::kSuggestionsData, std::string()); 104 registry->RegisterStringPref(prefs::kSuggestionsData, std::string());
103 } 105 }
104 106
105 } // namespace suggestions 107 } // namespace suggestions
OLDNEW
« no previous file with comments | « components/suggestions/suggestions_service_unittest.cc ('k') | components/suggestions/suggestions_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698