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