Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Side by Side Diff: chrome/browser/extensions/activity_log/stream_noargs_ui_policy.cc

Issue 19690003: Extension activity log database refactoring (step 3) (Closed) Base URL: http://git.chromium.org/chromium/src.git@refactor2
Patch Set: Do not set bad BlockedChromeActivityDetail::Reason values Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 scoped_ptr<base::ListValue> StreamWithoutArgsUIPolicy::ProcessArguments( 19 void StreamWithoutArgsUIPolicy::ProcessArguments(
20 ActionType action_type, 20 scoped_refptr<Action> action) const {
21 const std::string& name, 21 if (action->action_type() == Action::ACTION_DOM_ACCESS ||
22 const base::ListValue* args) const { 22 action->action_type() == Action::ACTION_DOM_EVENT ||
23 if (action_type == ACTION_DOM || 23 action->action_type() == Action::ACTION_DOM_XHR ||
24 arg_whitelist_api_.find(name) != arg_whitelist_api_.end()) { 24 action->action_type() == Action::ACTION_WEB_REQUEST ||
25 return FullStreamUIPolicy::ProcessArguments(action_type, name, args).Pass(); 25 arg_whitelist_api_.find(action->api_name()) != arg_whitelist_api_.end()) {
26 // No stripping of arguments
26 } else { 27 } else {
27 return make_scoped_ptr(new ListValue()); 28 action->set_args(scoped_ptr<ListValue>());
28 } 29 }
29 } 30 }
30 31
31 void StreamWithoutArgsUIPolicy::ProcessWebRequestModifications( 32 void StreamWithoutArgsUIPolicy::ProcessWebRequestModifications(
32 base::DictionaryValue& details, 33 base::DictionaryValue& details,
33 std::string& details_string) const { 34 std::string& details_string) const {
34 // Strip details of the web request modifications (for privacy reasons). 35 // Strip details of the web request modifications (for privacy reasons).
35 DictionaryValue::Iterator details_iterator(details); 36 DictionaryValue::Iterator details_iterator(details);
36 while (!details_iterator.IsAtEnd()) { 37 while (!details_iterator.IsAtEnd()) {
37 details.SetBoolean(details_iterator.key(), true); 38 details.SetBoolean(details_iterator.key(), true);
38 details_iterator.Advance(); 39 details_iterator.Advance();
39 } 40 }
40 JSONStringValueSerializer serializer(&details_string); 41 JSONStringValueSerializer serializer(&details_string);
41 serializer.SerializeAndOmitBinaryValues(details); 42 serializer.SerializeAndOmitBinaryValues(details);
42 } 43 }
43 44
44 } // namespace extensions 45 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698