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

Unified Diff: extensions/common/event_filtering_info.cc

Issue 2940893002: [Extensions] Pass EventFilteringInfo directly in DispatchEvent message (Closed)
Patch Set: . Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/event_filtering_info.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/event_filtering_info.cc
diff --git a/extensions/common/event_filtering_info.cc b/extensions/common/event_filtering_info.cc
index 17ea7a079f123963d6d2611ca42bbb8ef4850e15..865b2b85e46d809c0b695221e81c33aa2500bb06 100644
--- a/extensions/common/event_filtering_info.cc
+++ b/extensions/common/event_filtering_info.cc
@@ -4,85 +4,11 @@
#include "extensions/common/event_filtering_info.h"
-#include <utility>
-
-#include "base/json/json_writer.h"
-#include "base/memory/ptr_util.h"
-#include "base/values.h"
-
namespace extensions {
-namespace {
-
-const char kInstanceId[] = "instanceId";
-const char kServiceType[] = "serviceType";
-const char kWindowType[] = "windowType";
-const char kWindowExposedByDefault[] = "windowExposedByDefault";
-
-}
-
EventFilteringInfo::EventFilteringInfo() {}
-
-EventFilteringInfo::EventFilteringInfo(const base::DictionaryValue& dict)
- : EventFilteringInfo() {
- {
- std::string dict_url;
- if (dict.GetString("url", &dict_url)) {
- GURL maybe_url(dict_url);
- if (maybe_url.is_valid())
- url = std::move(maybe_url);
- }
- }
-
- {
- int dict_instance_id = 0;
- if (dict.GetInteger(kInstanceId, &dict_instance_id))
- instance_id = dict_instance_id;
- }
-
- {
- std::string dict_service_type;
- if (dict.GetString(kServiceType, &dict_service_type))
- service_type = std::move(dict_service_type);
- }
-
- {
- std::string dict_window_type;
- if (dict.GetString(kWindowType, &dict_window_type))
- window_type = std::move(dict_window_type);
- }
-
- {
- bool dict_window_exposed_by_default = false;
- if (dict.GetBoolean(kWindowExposedByDefault,
- &dict_window_exposed_by_default))
- window_exposed_by_default = dict_window_exposed_by_default;
- }
-}
-
EventFilteringInfo::EventFilteringInfo(const EventFilteringInfo& other) =
default;
-
EventFilteringInfo::~EventFilteringInfo() {}
-std::unique_ptr<base::DictionaryValue> EventFilteringInfo::AsValue() const {
- auto result = base::MakeUnique<base::DictionaryValue>();
- if (url)
- result->SetString("url", url->spec());
-
- if (instance_id)
- result->SetInteger(kInstanceId, *instance_id);
-
- if (service_type)
- result->SetString(kServiceType, *service_type);
-
- if (window_type)
- result->SetString(kWindowType, *window_type);
-
- if (window_exposed_by_default)
- result->SetBoolean(kWindowExposedByDefault, *window_exposed_by_default);
-
- return result;
-}
-
} // namespace extensions
« no previous file with comments | « extensions/common/event_filtering_info.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698