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

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

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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 <utility> 7 #include <utility>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 26 matching lines...) Expand all
37 void EventFilteringInfo::SetURL(const GURL& url) { 37 void EventFilteringInfo::SetURL(const GURL& url) {
38 url_ = url; 38 url_ = url;
39 has_url_ = true; 39 has_url_ = true;
40 } 40 }
41 41
42 void EventFilteringInfo::SetInstanceID(int instance_id) { 42 void EventFilteringInfo::SetInstanceID(int instance_id) {
43 instance_id_ = instance_id; 43 instance_id_ = instance_id;
44 has_instance_id_ = true; 44 has_instance_id_ = true;
45 } 45 }
46 46
47 scoped_ptr<base::Value> EventFilteringInfo::AsValue() const { 47 std::unique_ptr<base::Value> EventFilteringInfo::AsValue() const {
48 if (IsEmpty()) 48 if (IsEmpty())
49 return base::Value::CreateNullValue(); 49 return base::Value::CreateNullValue();
50 50
51 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); 51 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
52 if (has_url_) 52 if (has_url_)
53 result->SetString("url", url_.spec()); 53 result->SetString("url", url_.spec());
54 54
55 if (has_instance_id_) 55 if (has_instance_id_)
56 result->SetInteger("instanceId", instance_id_); 56 result->SetInteger("instanceId", instance_id_);
57 57
58 if (!service_type_.empty()) 58 if (!service_type_.empty())
59 result->SetString("serviceType", service_type_); 59 result->SetString("serviceType", service_type_);
60 60
61 if (has_window_type_) 61 if (has_window_type_)
62 result->SetString("windowType", window_type_); 62 result->SetString("windowType", window_type_);
63 63
64 if (has_window_exposed_by_default_) 64 if (has_window_exposed_by_default_)
65 result->SetBoolean("windowExposedByDefault", window_exposed_by_default_); 65 result->SetBoolean("windowExposedByDefault", window_exposed_by_default_);
66 66
67 return std::move(result); 67 return std::move(result);
68 } 68 }
69 69
70 bool EventFilteringInfo::IsEmpty() const { 70 bool EventFilteringInfo::IsEmpty() const {
71 return !has_window_type_ && !has_url_ && service_type_.empty() && 71 return !has_window_type_ && !has_url_ && service_type_.empty() &&
72 !has_instance_id_ && !has_window_exposed_by_default_; 72 !has_instance_id_ && !has_window_exposed_by_default_;
73 } 73 }
74 74
75 } // namespace extensions 75 } // 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