OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/json/json_string_value_serializer.h" |
| 6 #include "chrome/browser/extensions/activity_log/stream_noargs_ui_policy.h" |
| 7 |
| 8 namespace extensions { |
| 9 |
| 10 StreamWithoutArgsUIPolicy::StreamWithoutArgsUIPolicy(Profile* profile) |
| 11 : FullStreamUIPolicy(profile) { |
| 12 for (int i = 0; i < APIAction::kSizeAlwaysLog; i++) { |
| 13 arg_whitelist_api_.insert(APIAction::kAlwaysLog[i]); |
| 14 } |
| 15 } |
| 16 |
| 17 StreamWithoutArgsUIPolicy::~StreamWithoutArgsUIPolicy() {} |
| 18 |
| 19 std::string StreamWithoutArgsUIPolicy::ProcessArguments( |
| 20 ActionType action_type, |
| 21 const std::string& name, |
| 22 const base::ListValue* args) const { |
| 23 if (action_type == ACTION_DOM || |
| 24 arg_whitelist_api_.find(name) != arg_whitelist_api_.end()) { |
| 25 return FullStreamUIPolicy::ProcessArguments(action_type, name, args); |
| 26 } else { |
| 27 return std::string(); |
| 28 } |
| 29 } |
| 30 |
| 31 void StreamWithoutArgsUIPolicy::ProcessWebRequestModifications( |
| 32 base::DictionaryValue& details, |
| 33 std::string& details_string) const { |
| 34 // Strip details of the web request modifications (for privacy reasons). |
| 35 DictionaryValue::Iterator details_iterator(details); |
| 36 while (!details_iterator.IsAtEnd()) { |
| 37 details.SetBoolean(details_iterator.key(), true); |
| 38 details_iterator.Advance(); |
| 39 } |
| 40 JSONStringValueSerializer serializer(&details_string); |
| 41 serializer.SerializeAndOmitBinaryValues(details); |
| 42 } |
| 43 |
| 44 } // namespace extensions |
OLD | NEW |