| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 if (action->page_url().is_valid()) | 107 if (action->page_url().is_valid()) |
| 108 action->set_page_url(action->page_url().ReplaceComponents(url_sanitizer)); | 108 action->set_page_url(action->page_url().ReplaceComponents(url_sanitizer)); |
| 109 if (action->arg_url().is_valid()) | 109 if (action->arg_url().is_valid()) |
| 110 action->set_arg_url(action->arg_url().ReplaceComponents(url_sanitizer)); | 110 action->set_arg_url(action->arg_url().ReplaceComponents(url_sanitizer)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Clear WebRequest details; only keep a record of which types of | 113 // Clear WebRequest details; only keep a record of which types of |
| 114 // modifications were performed. | 114 // modifications were performed. |
| 115 if (action->action_type() == Action::ACTION_WEB_REQUEST) { | 115 if (action->action_type() == Action::ACTION_WEB_REQUEST) { |
| 116 DictionaryValue* details = NULL; | 116 base::DictionaryValue* details = NULL; |
| 117 if (action->mutable_other()->GetDictionary(constants::kActionWebRequest, | 117 if (action->mutable_other()->GetDictionary(constants::kActionWebRequest, |
| 118 &details)) { | 118 &details)) { |
| 119 DictionaryValue::Iterator details_iterator(*details); | 119 base::DictionaryValue::Iterator details_iterator(*details); |
| 120 while (!details_iterator.IsAtEnd()) { | 120 while (!details_iterator.IsAtEnd()) { |
| 121 details->SetBoolean(details_iterator.key(), true); | 121 details->SetBoolean(details_iterator.key(), true); |
| 122 details_iterator.Advance(); | 122 details_iterator.Advance(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 // static | 128 // static |
| 129 void ActivityLogPolicy::Util::StripArguments(const ApiSet& api_whitelist, | 129 void ActivityLogPolicy::Util::StripArguments(const ApiSet& api_whitelist, |
| 130 scoped_refptr<Action> action) { | 130 scoped_refptr<Action> action) { |
| 131 if (api_whitelist.find( | 131 if (api_whitelist.find( |
| 132 std::make_pair(action->action_type(), action->api_name())) == | 132 std::make_pair(action->action_type(), action->api_name())) == |
| 133 api_whitelist.end()) { | 133 api_whitelist.end()) { |
| 134 action->set_args(scoped_ptr<ListValue>()); | 134 action->set_args(scoped_ptr<base::ListValue>()); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 // static | 138 // static |
| 139 base::Time ActivityLogPolicy::Util::AddDays(const base::Time& base_date, | 139 base::Time ActivityLogPolicy::Util::AddDays(const base::Time& base_date, |
| 140 int days) { | 140 int days) { |
| 141 // To allow for time zone changes, add an additional partial day then round | 141 // To allow for time zone changes, add an additional partial day then round |
| 142 // down to midnight. | 142 // down to midnight. |
| 143 return (base_date + base::TimeDelta::FromDays(days) + | 143 return (base_date + base::TimeDelta::FromDays(days) + |
| 144 base::TimeDelta::FromHours(4)).LocalMidnight(); | 144 base::TimeDelta::FromHours(4)).LocalMidnight(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 170 base::StringPrintf("DROP TABLE %s", table_name); | 170 base::StringPrintf("DROP TABLE %s", table_name); |
| 171 if (!db->Execute(drop_statement.c_str())) { | 171 if (!db->Execute(drop_statement.c_str())) { |
| 172 return false; | 172 return false; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 return true; | 176 return true; |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace extensions | 179 } // namespace extensions |
| OLD | NEW |