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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DictionaryValue::Iterator details_iterator(*details); | 116 DictionaryValue::Iterator details_iterator(*details); |
117 while (!details_iterator.IsAtEnd()) { | 117 while (!details_iterator.IsAtEnd()) { |
118 details->SetBoolean(details_iterator.key(), true); | 118 details->SetBoolean(details_iterator.key(), true); |
119 details_iterator.Advance(); | 119 details_iterator.Advance(); |
120 } | 120 } |
121 } | 121 } |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 // static | 125 // static |
126 void ActivityLogPolicy::Util::StripArguments( | 126 void ActivityLogPolicy::Util::StripArguments(const ApiSet& api_whitelist, |
127 const std::set<std::string>& api_whitelist, | 127 scoped_refptr<Action> action) { |
128 scoped_refptr<Action> action) { | 128 if (api_whitelist.find( |
129 if (action->action_type() != Action::ACTION_API_CALL && | 129 std::make_pair(action->action_type(), action->api_name())) == |
130 action->action_type() != Action::ACTION_API_EVENT && | 130 api_whitelist.end()) { |
131 action->action_type() != Action::UNUSED_ACTION_API_BLOCKED) | |
132 return; | |
133 | |
134 if (api_whitelist.find(action->api_name()) == api_whitelist.end()) | |
135 action->set_args(scoped_ptr<ListValue>()); | 131 action->set_args(scoped_ptr<ListValue>()); |
| 132 } |
136 } | 133 } |
137 | 134 |
138 // static | 135 // static |
139 base::Time ActivityLogPolicy::Util::AddDays(const base::Time& base_date, | 136 base::Time ActivityLogPolicy::Util::AddDays(const base::Time& base_date, |
140 int days) { | 137 int days) { |
141 // To allow for time zone changes, add an additional partial day then round | 138 // To allow for time zone changes, add an additional partial day then round |
142 // down to midnight. | 139 // down to midnight. |
143 return (base_date + base::TimeDelta::FromDays(days) + | 140 return (base_date + base::TimeDelta::FromDays(days) + |
144 base::TimeDelta::FromHours(4)).LocalMidnight(); | 141 base::TimeDelta::FromHours(4)).LocalMidnight(); |
145 } | 142 } |
(...skipping 24 matching lines...) Expand all Loading... |
170 base::StringPrintf("DROP TABLE %s", table_name); | 167 base::StringPrintf("DROP TABLE %s", table_name); |
171 if (!db->Execute(drop_statement.c_str())) { | 168 if (!db->Execute(drop_statement.c_str())) { |
172 return false; | 169 return false; |
173 } | 170 } |
174 } | 171 } |
175 } | 172 } |
176 return true; | 173 return true; |
177 } | 174 } |
178 | 175 |
179 } // namespace extensions | 176 } // namespace extensions |
OLD | NEW |