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

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

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_matcher.h" 5 #include "extensions/common/event_matcher.h"
6 6
7 #include "extensions/common/event_filtering_info.h" 7 #include "extensions/common/event_filtering_info.h"
8 8
9 namespace { 9 namespace {
10 const char kUrlFiltersKey[] = "url"; 10 const char kUrlFiltersKey[] = "url";
(...skipping 17 matching lines...) Expand all
28 if (event_info.has_instance_id()) { 28 if (event_info.has_instance_id()) {
29 return event_info.instance_id() == GetInstanceID(); 29 return event_info.instance_id() == GetInstanceID();
30 } 30 }
31 31
32 const std::string& service_type_filter = GetServiceTypeFilter(); 32 const std::string& service_type_filter = GetServiceTypeFilter();
33 return service_type_filter.empty() || 33 return service_type_filter.empty() ||
34 service_type_filter == event_info.service_type(); 34 service_type_filter == event_info.service_type();
35 } 35 }
36 36
37 int EventMatcher::GetURLFilterCount() const { 37 int EventMatcher::GetURLFilterCount() const {
38 base::ListValue* url_filters = NULL; 38 base::ListValue* url_filters = nullptr;
39 if (filter_->GetList(kUrlFiltersKey, &url_filters)) 39 if (filter_->GetList(kUrlFiltersKey, &url_filters))
40 return url_filters->GetSize(); 40 return url_filters->GetSize();
41 return 0; 41 return 0;
42 } 42 }
43 43
44 bool EventMatcher::GetURLFilter(int i, base::DictionaryValue** url_filter_out) { 44 bool EventMatcher::GetURLFilter(int i, base::DictionaryValue** url_filter_out) {
45 base::ListValue* url_filters = NULL; 45 base::ListValue* url_filters = nullptr;
46 if (filter_->GetList(kUrlFiltersKey, &url_filters)) { 46 if (filter_->GetList(kUrlFiltersKey, &url_filters)) {
47 return url_filters->GetDictionary(i, url_filter_out); 47 return url_filters->GetDictionary(i, url_filter_out);
48 } 48 }
49 return false; 49 return false;
50 } 50 }
51 51
52 int EventMatcher::HasURLFilters() const { 52 int EventMatcher::HasURLFilters() const {
53 return GetURLFilterCount() != 0; 53 return GetURLFilterCount() != 0;
54 } 54 }
55 55
56 std::string EventMatcher::GetServiceTypeFilter() const { 56 std::string EventMatcher::GetServiceTypeFilter() const {
57 std::string service_type_filter; 57 std::string service_type_filter;
58 filter_->GetStringASCII(kEventFilterServiceTypeKey, &service_type_filter); 58 filter_->GetStringASCII(kEventFilterServiceTypeKey, &service_type_filter);
59 return service_type_filter; 59 return service_type_filter;
60 } 60 }
61 61
62 int EventMatcher::GetInstanceID() const { 62 int EventMatcher::GetInstanceID() const {
63 int instance_id = 0; 63 int instance_id = 0;
64 filter_->GetInteger("instanceId", &instance_id); 64 filter_->GetInteger("instanceId", &instance_id);
65 return instance_id; 65 return instance_id;
66 } 66 }
67 67
68 int EventMatcher::GetRoutingID() const { 68 int EventMatcher::GetRoutingID() const {
69 return routing_id_; 69 return routing_id_;
70 } 70 }
71 71
72 } // namespace extensions 72 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698