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

Side by Side Diff: chrome/installer/util/advanced_firewall_manager_win.cc

Issue 2824773002: Rename ScopedComPtr::get() to ScopedComPtr::Get() (Closed)
Patch Set: Update to 5293966 Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/installer/util/advanced_firewall_manager_win.h" 5 #include "chrome/installer/util/advanced_firewall_manager_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const base::string16& description, 73 const base::string16& description,
74 uint16_t port) { 74 uint16_t port) {
75 // Delete the rule. According MDSN |INetFwRules::Add| should replace rule with 75 // Delete the rule. According MDSN |INetFwRules::Add| should replace rule with
76 // same "rule identifier". It's not clear what is "rule identifier", but it 76 // same "rule identifier". It's not clear what is "rule identifier", but it
77 // can successfully create many rule with same name. 77 // can successfully create many rule with same name.
78 DeleteRuleByName(rule_name); 78 DeleteRuleByName(rule_name);
79 79
80 // Create the rule and add it to the rule set (only succeeds if elevated). 80 // Create the rule and add it to the rule set (only succeeds if elevated).
81 base::win::ScopedComPtr<INetFwRule> udp_rule = 81 base::win::ScopedComPtr<INetFwRule> udp_rule =
82 CreateUDPRule(rule_name, description, port); 82 CreateUDPRule(rule_name, description, port);
83 if (!udp_rule.get()) 83 if (!udp_rule.Get())
84 return false; 84 return false;
85 85
86 HRESULT hr = firewall_rules_->Add(udp_rule.get()); 86 HRESULT hr = firewall_rules_->Add(udp_rule.Get());
87 DLOG_IF(ERROR, FAILED(hr)) << logging::SystemErrorCodeToString(hr); 87 DLOG_IF(ERROR, FAILED(hr)) << logging::SystemErrorCodeToString(hr);
88 return SUCCEEDED(hr); 88 return SUCCEEDED(hr);
89 } 89 }
90 90
91 void AdvancedFirewallManager::DeleteRuleByName( 91 void AdvancedFirewallManager::DeleteRuleByName(
92 const base::string16& rule_name) { 92 const base::string16& rule_name) {
93 std::vector<base::win::ScopedComPtr<INetFwRule> > rules; 93 std::vector<base::win::ScopedComPtr<INetFwRule> > rules;
94 GetAllRules(&rules); 94 GetAllRules(&rules);
95 for (size_t i = 0; i < rules.size(); ++i) { 95 for (size_t i = 0; i < rules.size(); ++i) {
96 base::win::ScopedBstr name; 96 base::win::ScopedBstr name;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void AdvancedFirewallManager::GetAllRules( 151 void AdvancedFirewallManager::GetAllRules(
152 std::vector<base::win::ScopedComPtr<INetFwRule> >* rules) { 152 std::vector<base::win::ScopedComPtr<INetFwRule> >* rules) {
153 base::win::ScopedComPtr<IUnknown> rules_enum_unknown; 153 base::win::ScopedComPtr<IUnknown> rules_enum_unknown;
154 HRESULT hr = firewall_rules_->get__NewEnum(rules_enum_unknown.Receive()); 154 HRESULT hr = firewall_rules_->get__NewEnum(rules_enum_unknown.Receive());
155 if (FAILED(hr)) { 155 if (FAILED(hr)) {
156 DLOG(ERROR) << logging::SystemErrorCodeToString(hr); 156 DLOG(ERROR) << logging::SystemErrorCodeToString(hr);
157 return; 157 return;
158 } 158 }
159 159
160 base::win::ScopedComPtr<IEnumVARIANT> rules_enum; 160 base::win::ScopedComPtr<IEnumVARIANT> rules_enum;
161 hr = rules_enum.QueryFrom(rules_enum_unknown.get()); 161 hr = rules_enum.QueryFrom(rules_enum_unknown.Get());
162 if (FAILED(hr)) { 162 if (FAILED(hr)) {
163 DLOG(ERROR) << logging::SystemErrorCodeToString(hr); 163 DLOG(ERROR) << logging::SystemErrorCodeToString(hr);
164 return; 164 return;
165 } 165 }
166 166
167 for (;;) { 167 for (;;) {
168 base::win::ScopedVariant rule_var; 168 base::win::ScopedVariant rule_var;
169 hr = rules_enum->Next(1, rule_var.Receive(), NULL); 169 hr = rules_enum->Next(1, rule_var.Receive(), NULL);
170 DLOG_IF(ERROR, FAILED(hr)) << logging::SystemErrorCodeToString(hr); 170 DLOG_IF(ERROR, FAILED(hr)) << logging::SystemErrorCodeToString(hr);
171 if (hr != S_OK) 171 if (hr != S_OK)
(...skipping 21 matching lines...) Expand all
193 !base::FilePath::CompareEqualIgnoreCase(static_cast<BSTR>(path), 193 !base::FilePath::CompareEqualIgnoreCase(static_cast<BSTR>(path),
194 app_path_.value())) { 194 app_path_.value())) {
195 continue; 195 continue;
196 } 196 }
197 197
198 rules->push_back(rule); 198 rules->push_back(rule);
199 } 199 }
200 } 200 }
201 201
202 } // namespace installer 202 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/browser/win/settings_app_monitor.cc ('k') | chrome/installer/util/legacy_firewall_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698