Index: chrome/browser/extensions/activity_log/stream_noargs_ui_policy.cc |
diff --git a/chrome/browser/extensions/activity_log/stream_noargs_ui_policy.cc b/chrome/browser/extensions/activity_log/stream_noargs_ui_policy.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9aa721f8778f061077c116ce564f5b94e9b8e9d5 |
--- /dev/null |
+++ b/chrome/browser/extensions/activity_log/stream_noargs_ui_policy.cc |
@@ -0,0 +1,52 @@ |
+// Copyright $YEAR The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/json/json_string_value_serializer.h" |
+#include "chrome/browser/extensions/activity_log/stream_noargs_ui_policy.h" |
+ |
+using namespace base; |
+using namespace content; |
+ |
+namespace extensions { |
+ |
+StreamWithoutArgsUIPolicy::StreamWithoutArgsUIPolicy( |
+ Profile* profile, |
+ content::BrowserThread::ID thread_id) |
+ : FullStreamUIPolicy(profile, thread_id) { |
+ 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
|
+ arg_whitelist_api_.insert(std::string(APIAction::kAlwaysLog[i])); |
+ } |
+} |
+ |
+StreamWithoutArgsUIPolicy::~StreamWithoutArgsUIPolicy() {} |
+ |
+void StreamWithoutArgsUIPolicy::ProcessArguments( |
+ ActionType action_type, |
+ const std::string& name, |
+ const base::ListValue* args, |
+ std::stringstream& args_string) const { |
+ |
+ if (action_type == ACTION_DOM || |
+ arg_whitelist_api_.find(name) != arg_whitelist_api_.end()) { |
+ FullStreamUIPolicy::ProcessArguments(action_type, name, args, args_string); |
+ } else { |
+ return; |
+ } |
+} |
+ |
+void StreamWithoutArgsUIPolicy::ProcessWebRequestModifications( |
+ base::DictionaryValue& details, |
+ std::string& details_string) const { |
+ // Strip details of the web request modifications (for privacy reasons), |
+ // 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.
|
+ DictionaryValue::Iterator details_iterator(details); |
+ while (!details_iterator.IsAtEnd()) { |
+ details.SetBoolean(details_iterator.key(), true); |
+ details_iterator.Advance(); |
+ } |
+ JSONStringValueSerializer serializer(&details_string); |
+ serializer.SerializeAndOmitBinaryValues(details); |
+} |
+ |
+} // End of the extensions namespace |
felt
2013/05/24 18:43:38
"namespace extensions"
dbabic
2013/05/28 21:11:49
Done.
|