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

Side by Side Diff: chrome/installer/util/legacy_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/legacy_firewall_manager_win.h" 5 #include "chrome/installer/util/legacy_firewall_manager_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/win/scoped_bstr.h" 8 #include "base/win/scoped_bstr.h"
9 9
10 namespace installer { 10 namespace installer {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 VARIANT_BOOL is_enabled = VARIANT_TRUE; 45 VARIANT_BOOL is_enabled = VARIANT_TRUE;
46 HRESULT hr = current_profile_->get_FirewallEnabled(&is_enabled); 46 HRESULT hr = current_profile_->get_FirewallEnabled(&is_enabled);
47 return SUCCEEDED(hr) && is_enabled != VARIANT_FALSE; 47 return SUCCEEDED(hr) && is_enabled != VARIANT_FALSE;
48 } 48 }
49 49
50 bool LegacyFirewallManager::GetAllowIncomingConnection(bool* value) { 50 bool LegacyFirewallManager::GetAllowIncomingConnection(bool* value) {
51 // Otherwise, check to see if there is a rule either allowing or disallowing 51 // Otherwise, check to see if there is a rule either allowing or disallowing
52 // this chrome.exe. 52 // this chrome.exe.
53 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps( 53 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps(
54 GetAuthorizedApplications()); 54 GetAuthorizedApplications());
55 if (!authorized_apps.get()) 55 if (!authorized_apps.Get())
56 return false; 56 return false;
57 57
58 base::win::ScopedComPtr<INetFwAuthorizedApplication> chrome_application; 58 base::win::ScopedComPtr<INetFwAuthorizedApplication> chrome_application;
59 HRESULT hr = authorized_apps->Item( 59 HRESULT hr = authorized_apps->Item(
60 base::win::ScopedBstr(app_path_.value().c_str()), 60 base::win::ScopedBstr(app_path_.value().c_str()),
61 chrome_application.Receive()); 61 chrome_application.Receive());
62 if (FAILED(hr)) 62 if (FAILED(hr))
63 return false; 63 return false;
64 VARIANT_BOOL is_enabled = VARIANT_FALSE; 64 VARIANT_BOOL is_enabled = VARIANT_FALSE;
65 hr = chrome_application->get_Enabled(&is_enabled); 65 hr = chrome_application->get_Enabled(&is_enabled);
66 if (FAILED(hr)) 66 if (FAILED(hr))
67 return false; 67 return false;
68 if (value) 68 if (value)
69 *value = (is_enabled == VARIANT_TRUE); 69 *value = (is_enabled == VARIANT_TRUE);
70 return true; 70 return true;
71 } 71 }
72 72
73 // The SharedAccess service must be running. 73 // The SharedAccess service must be running.
74 bool LegacyFirewallManager::SetAllowIncomingConnection(bool allow) { 74 bool LegacyFirewallManager::SetAllowIncomingConnection(bool allow) {
75 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps( 75 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps(
76 GetAuthorizedApplications()); 76 GetAuthorizedApplications());
77 if (!authorized_apps.get()) 77 if (!authorized_apps.Get())
78 return false; 78 return false;
79 79
80 // Authorize chrome. 80 // Authorize chrome.
81 base::win::ScopedComPtr<INetFwAuthorizedApplication> authorization = 81 base::win::ScopedComPtr<INetFwAuthorizedApplication> authorization =
82 CreateChromeAuthorization(allow); 82 CreateChromeAuthorization(allow);
83 if (!authorization.get()) 83 if (!authorization.Get())
84 return false; 84 return false;
85 HRESULT hr = authorized_apps->Add(authorization.get()); 85 HRESULT hr = authorized_apps->Add(authorization.Get());
86 DLOG_IF(ERROR, FAILED(hr)) << logging::SystemErrorCodeToString(hr); 86 DLOG_IF(ERROR, FAILED(hr)) << logging::SystemErrorCodeToString(hr);
87 return SUCCEEDED(hr); 87 return SUCCEEDED(hr);
88 } 88 }
89 89
90 void LegacyFirewallManager::DeleteRule() { 90 void LegacyFirewallManager::DeleteRule() {
91 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps( 91 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps(
92 GetAuthorizedApplications()); 92 GetAuthorizedApplications());
93 if (!authorized_apps.get()) 93 if (!authorized_apps.Get())
94 return; 94 return;
95 authorized_apps->Remove(base::win::ScopedBstr(app_path_.value().c_str())); 95 authorized_apps->Remove(base::win::ScopedBstr(app_path_.value().c_str()));
96 } 96 }
97 97
98 base::win::ScopedComPtr<INetFwAuthorizedApplications> 98 base::win::ScopedComPtr<INetFwAuthorizedApplications>
99 LegacyFirewallManager::GetAuthorizedApplications() { 99 LegacyFirewallManager::GetAuthorizedApplications() {
100 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps; 100 base::win::ScopedComPtr<INetFwAuthorizedApplications> authorized_apps;
101 HRESULT hr = 101 HRESULT hr =
102 current_profile_->get_AuthorizedApplications(authorized_apps.Receive()); 102 current_profile_->get_AuthorizedApplications(authorized_apps.Receive());
103 if (FAILED(hr)) { 103 if (FAILED(hr)) {
(...skipping 20 matching lines...) Expand all
124 base::win::ScopedBstr(app_path_.value().c_str())); 124 base::win::ScopedBstr(app_path_.value().c_str()));
125 // IpVersion defaults to NET_FW_IP_VERSION_ANY. 125 // IpVersion defaults to NET_FW_IP_VERSION_ANY.
126 // Scope defaults to NET_FW_SCOPE_ALL. 126 // Scope defaults to NET_FW_SCOPE_ALL.
127 // RemoteAddresses defaults to "*". 127 // RemoteAddresses defaults to "*".
128 chrome_application->put_Enabled(allow ? VARIANT_TRUE : VARIANT_FALSE); 128 chrome_application->put_Enabled(allow ? VARIANT_TRUE : VARIANT_FALSE);
129 129
130 return chrome_application; 130 return chrome_application;
131 } 131 }
132 132
133 } // namespace installer 133 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/advanced_firewall_manager_win.cc ('k') | chrome/installer/util/shell_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698