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

Side by Side Diff: extensions/common/event_filtering_info.cc

Issue 1099553002: extensions: windows: list all windows from the current profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 4 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
« no previous file with comments | « extensions/common/event_filtering_info.h ('k') | extensions/common/event_matcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "extensions/common/event_filtering_info.h" 5 #include "extensions/common/event_filtering_info.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 9
10 namespace extensions { 10 namespace extensions {
11 11
12 EventFilteringInfo::EventFilteringInfo() 12 EventFilteringInfo::EventFilteringInfo()
13 : has_url_(false), 13 : has_url_(false),
14 has_instance_id_(false), 14 has_instance_id_(false),
15 instance_id_(0) { 15 instance_id_(0),
16 has_window_type_(false) {}
17
18 EventFilteringInfo::~EventFilteringInfo() {
16 } 19 }
17 20
18 EventFilteringInfo::~EventFilteringInfo() { 21 void EventFilteringInfo::SetWindowType(const std::string& window_type) {
22 window_type_ = window_type;
23 has_window_type_ = true;
19 } 24 }
20 25
21 void EventFilteringInfo::SetURL(const GURL& url) { 26 void EventFilteringInfo::SetURL(const GURL& url) {
22 url_ = url; 27 url_ = url;
23 has_url_ = true; 28 has_url_ = true;
24 } 29 }
25 30
26 void EventFilteringInfo::SetInstanceID(int instance_id) { 31 void EventFilteringInfo::SetInstanceID(int instance_id) {
27 instance_id_ = instance_id; 32 instance_id_ = instance_id;
28 has_instance_id_ = true; 33 has_instance_id_ = true;
29 } 34 }
30 35
31 scoped_ptr<base::Value> EventFilteringInfo::AsValue() const { 36 scoped_ptr<base::Value> EventFilteringInfo::AsValue() const {
32 if (IsEmpty()) 37 if (IsEmpty())
33 return base::Value::CreateNullValue(); 38 return base::Value::CreateNullValue();
34 39
35 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); 40 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
36 if (has_url_) 41 if (has_url_)
37 result->SetString("url", url_.spec()); 42 result->SetString("url", url_.spec());
38 43
39 if (has_instance_id_) 44 if (has_instance_id_)
40 result->SetInteger("instanceId", instance_id_); 45 result->SetInteger("instanceId", instance_id_);
41 46
42 if (!service_type_.empty()) 47 if (!service_type_.empty())
43 result->SetString("serviceType", service_type_); 48 result->SetString("serviceType", service_type_);
44 49
50 if (has_window_type_)
51 result->SetString("windowType", window_type_);
52
45 return result.Pass(); 53 return result.Pass();
46 } 54 }
47 55
48 bool EventFilteringInfo::IsEmpty() const { 56 bool EventFilteringInfo::IsEmpty() const {
49 return !has_url_ && service_type_.empty() && !has_instance_id_; 57 return !has_window_type_ && !has_url_ && service_type_.empty() &&
58 !has_instance_id_;
50 } 59 }
51 60
52 } // namespace extensions 61 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/event_filtering_info.h ('k') | extensions/common/event_matcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698