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

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

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 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
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 {
(...skipping 12 matching lines...) Expand all
23 has_url_ = true; 23 has_url_ = true;
24 } 24 }
25 25
26 void EventFilteringInfo::SetInstanceID(int instance_id) { 26 void EventFilteringInfo::SetInstanceID(int instance_id) {
27 instance_id_ = instance_id; 27 instance_id_ = instance_id;
28 has_instance_id_ = true; 28 has_instance_id_ = true;
29 } 29 }
30 30
31 scoped_ptr<base::Value> EventFilteringInfo::AsValue() const { 31 scoped_ptr<base::Value> EventFilteringInfo::AsValue() const {
32 if (IsEmpty()) 32 if (IsEmpty())
33 return scoped_ptr<base::Value>(base::Value::CreateNullValue()); 33 return base::Value::CreateNullValue();
34 34
35 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); 35 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
36 if (has_url_) 36 if (has_url_)
37 result->SetString("url", url_.spec()); 37 result->SetString("url", url_.spec());
38 38
39 if (has_instance_id_) 39 if (has_instance_id_)
40 result->SetInteger("instanceId", instance_id_); 40 result->SetInteger("instanceId", instance_id_);
41 41
42 if (!service_type_.empty()) 42 if (!service_type_.empty())
43 result->SetString("serviceType", service_type_); 43 result->SetString("serviceType", service_type_);
44 44
45 return result.Pass(); 45 return result.Pass();
46 } 46 }
47 47
48 bool EventFilteringInfo::IsEmpty() const { 48 bool EventFilteringInfo::IsEmpty() const {
49 return !has_url_ && service_type_.empty() && !has_instance_id_; 49 return !has_url_ && service_type_.empty() && !has_instance_id_;
50 } 50 }
51 51
52 } // namespace extensions 52 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_function.cc ('k') | extensions/common/permissions/manifest_permission_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698