1 // Copyright (c) 2012 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.
5 #include "extensions/common/event_filtering_info.h"
7 #include "base/json/json_writer.h"
8 #include "base/values.h"
10 namespace extensions
{
12 EventFilteringInfo::EventFilteringInfo()
14 has_instance_id_(false),
18 EventFilteringInfo::~EventFilteringInfo() {
21 void EventFilteringInfo::SetURL(const GURL
& url
) {
26 void EventFilteringInfo::SetInstanceID(int instance_id
) {
27 instance_id_
= instance_id
;
28 has_instance_id_
= true;
31 scoped_ptr
<base::Value
> EventFilteringInfo::AsValue() const {
33 return base::Value::CreateNullValue();
35 scoped_ptr
<base::DictionaryValue
> result(new base::DictionaryValue
);
37 result
->SetString("url", url_
.spec());
40 result
->SetInteger("instanceId", instance_id_
);
42 if (!service_type_
.empty())
43 result
->SetString("serviceType", service_type_
);
48 bool EventFilteringInfo::IsEmpty() const {
49 return !has_url_
&& service_type_
.empty() && !has_instance_id_
;
52 } // namespace extensions