OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/activity_log/activity_log_policy.h" | 5 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 "activitylog_blocked", | 31 "activitylog_blocked", |
32 "activitylog_urls"}; | 32 "activitylog_urls"}; |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 namespace extensions { | 35 namespace extensions { |
36 | 36 |
37 ActivityLogPolicy::ActivityLogPolicy(Profile* profile) {} | 37 ActivityLogPolicy::ActivityLogPolicy(Profile* profile) {} |
38 | 38 |
39 ActivityLogPolicy::~ActivityLogPolicy() {} | 39 ActivityLogPolicy::~ActivityLogPolicy() {} |
40 | 40 |
41 void ActivityLogPolicy::SetClockForTesting(scoped_ptr<base::Clock> clock) { | 41 void ActivityLogPolicy::SetClockForTesting(std::unique_ptr<base::Clock> clock) { |
42 testing_clock_.reset(clock.release()); | 42 testing_clock_.reset(clock.release()); |
43 } | 43 } |
44 | 44 |
45 base::Time ActivityLogPolicy::Now() const { | 45 base::Time ActivityLogPolicy::Now() const { |
46 if (testing_clock_) | 46 if (testing_clock_) |
47 return testing_clock_->Now(); | 47 return testing_clock_->Now(); |
48 else | 48 else |
49 return base::Time::Now(); | 49 return base::Time::Now(); |
50 } | 50 } |
51 | 51 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 // static | 131 // static |
132 void ActivityLogPolicy::Util::StripArguments(const ApiSet& api_whitelist, | 132 void ActivityLogPolicy::Util::StripArguments(const ApiSet& api_whitelist, |
133 scoped_refptr<Action> action) { | 133 scoped_refptr<Action> action) { |
134 if (api_whitelist.find( | 134 if (api_whitelist.find( |
135 std::make_pair(action->action_type(), action->api_name())) == | 135 std::make_pair(action->action_type(), action->api_name())) == |
136 api_whitelist.end()) { | 136 api_whitelist.end()) { |
137 action->set_args(scoped_ptr<base::ListValue>()); | 137 action->set_args(std::unique_ptr<base::ListValue>()); |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 // static | 141 // static |
142 base::Time ActivityLogPolicy::Util::AddDays(const base::Time& base_date, | 142 base::Time ActivityLogPolicy::Util::AddDays(const base::Time& base_date, |
143 int days) { | 143 int days) { |
144 // To allow for time zone changes, add an additional partial day then round | 144 // To allow for time zone changes, add an additional partial day then round |
145 // down to midnight. | 145 // down to midnight. |
146 return (base_date + base::TimeDelta::FromDays(days) + | 146 return (base_date + base::TimeDelta::FromDays(days) + |
147 base::TimeDelta::FromHours(4)).LocalMidnight(); | 147 base::TimeDelta::FromHours(4)).LocalMidnight(); |
(...skipping 25 matching lines...) Expand all Loading... |
173 base::StringPrintf("DROP TABLE %s", table_name); | 173 base::StringPrintf("DROP TABLE %s", table_name); |
174 if (!db->Execute(drop_statement.c_str())) { | 174 if (!db->Execute(drop_statement.c_str())) { |
175 return false; | 175 return false; |
176 } | 176 } |
177 } | 177 } |
178 } | 178 } |
179 return true; | 179 return true; |
180 } | 180 } |
181 | 181 |
182 } // namespace extensions | 182 } // namespace extensions |
OLD | NEW |