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

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

Issue 15573003: New architecture of the activity logging: Policies for summarization (and compression) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A few more fixes :-( Created 7 years, 7 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
(Empty)
1 // Copyright $YEAR 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 using namespace base;
9 using namespace content;
10
11 namespace extensions {
12
13 StreamWithoutArgsUIPolicy::StreamWithoutArgsUIPolicy(
14 Profile* profile,
15 content::BrowserThread::ID thread_id)
16 : FullStreamUIPolicy(profile, thread_id) {
17 for (int i = 0; i < APIAction::kSizeAlwaysLog; i++) {
felt 2013/05/24 18:43:38 ++i (I often do it the other way around out of hab
dbabic 2013/05/28 21:11:49 Why? Preincrement is used for iterators (in most
felt 2013/05/29 03:41:15 Because that's what the style guide says to do. Pl
dbabic 2013/05/29 18:41:40 Since this is a simple data type (not an iterator)
felt 2013/05/29 19:12:29 Whoops, you're right, misremembered. :) On 2013/0
18 arg_whitelist_api_.insert(std::string(APIAction::kAlwaysLog[i]));
19 }
20 }
21
22 StreamWithoutArgsUIPolicy::~StreamWithoutArgsUIPolicy() {}
23
24 void StreamWithoutArgsUIPolicy::ProcessArguments(
25 ActionType action_type,
26 const std::string& name,
27 const base::ListValue* args,
28 std::stringstream& args_string) const {
29
30 if (action_type == ACTION_DOM ||
31 arg_whitelist_api_.find(name) != arg_whitelist_api_.end()) {
32 FullStreamUIPolicy::ProcessArguments(action_type, name, args, args_string);
33 } else {
34 return;
35 }
36 }
37
38 void StreamWithoutArgsUIPolicy::ProcessWebRequestModifications(
39 base::DictionaryValue& details,
40 std::string& details_string) const {
41 // Strip details of the web request modifications (for privacy reasons),
42 // unless testing is enabled.
felt 2013/05/24 18:43:38 Change comment to match what's happening here
dbabic 2013/05/28 21:11:49 Done.
43 DictionaryValue::Iterator details_iterator(details);
44 while (!details_iterator.IsAtEnd()) {
45 details.SetBoolean(details_iterator.key(), true);
46 details_iterator.Advance();
47 }
48 JSONStringValueSerializer serializer(&details_string);
49 serializer.SerializeAndOmitBinaryValues(details);
50 }
51
52 } // End of the extensions namespace
felt 2013/05/24 18:43:38 "namespace extensions"
dbabic 2013/05/28 21:11:49 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698