OLD | NEW |
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/firewall_manager_win.h" | 5 #include "chrome/installer/util/firewall_manager_win.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "chrome/installer/util/advanced_firewall_manager_win.h" | 9 #include "chrome/installer/util/advanced_firewall_manager_win.h" |
10 #include "chrome/installer/util/browser_distribution.h" | 10 #include "chrome/installer/util/browser_distribution.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class FirewallManagerAdvancedImpl : public FirewallManager { | 23 class FirewallManagerAdvancedImpl : public FirewallManager { |
24 public: | 24 public: |
25 FirewallManagerAdvancedImpl() {} | 25 FirewallManagerAdvancedImpl() {} |
26 virtual ~FirewallManagerAdvancedImpl() {} | 26 virtual ~FirewallManagerAdvancedImpl() {} |
27 | 27 |
28 bool Init(const base::string16& app_name, const base::FilePath& app_path) { | 28 bool Init(const base::string16& app_name, const base::FilePath& app_path) { |
29 return manager_.Init(app_name, app_path); | 29 return manager_.Init(app_name, app_path); |
30 } | 30 } |
31 | 31 |
32 // FirewallManager methods. | 32 // FirewallManager methods. |
33 virtual bool CanUseLocalPorts() OVERRIDE { | 33 virtual bool CanUseLocalPorts() override { |
34 return !manager_.IsFirewallEnabled() || manager_.HasAnyRule(); | 34 return !manager_.IsFirewallEnabled() || manager_.HasAnyRule(); |
35 }; | 35 }; |
36 | 36 |
37 virtual bool AddFirewallRules() OVERRIDE { | 37 virtual bool AddFirewallRules() override { |
38 return manager_.AddUDPRule(GetMdnsRuleName(), GetMdnsRuleDescription(), | 38 return manager_.AddUDPRule(GetMdnsRuleName(), GetMdnsRuleDescription(), |
39 kDefaultMdnsPort); | 39 kDefaultMdnsPort); |
40 } | 40 } |
41 | 41 |
42 virtual void RemoveFirewallRules() OVERRIDE { | 42 virtual void RemoveFirewallRules() override { |
43 manager_.DeleteAllRules(); | 43 manager_.DeleteAllRules(); |
44 } | 44 } |
45 | 45 |
46 private: | 46 private: |
47 static base::string16 GetMdnsRuleName() { | 47 static base::string16 GetMdnsRuleName() { |
48 #if defined(GOOGLE_CHROME_BUILD) | 48 #if defined(GOOGLE_CHROME_BUILD) |
49 if (InstallUtil::IsChromeSxSProcess()) | 49 if (InstallUtil::IsChromeSxSProcess()) |
50 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_NAME_CANARY_BASE); | 50 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_NAME_CANARY_BASE); |
51 #endif | 51 #endif |
52 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_NAME_BASE); | 52 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_NAME_BASE); |
(...skipping 14 matching lines...) Expand all Loading... |
67 class FirewallManagerLegacyImpl : public FirewallManager { | 67 class FirewallManagerLegacyImpl : public FirewallManager { |
68 public: | 68 public: |
69 FirewallManagerLegacyImpl() {} | 69 FirewallManagerLegacyImpl() {} |
70 virtual ~FirewallManagerLegacyImpl() {} | 70 virtual ~FirewallManagerLegacyImpl() {} |
71 | 71 |
72 bool Init(const base::string16& app_name, const base::FilePath& app_path) { | 72 bool Init(const base::string16& app_name, const base::FilePath& app_path) { |
73 return manager_.Init(app_name, app_path); | 73 return manager_.Init(app_name, app_path); |
74 } | 74 } |
75 | 75 |
76 // FirewallManager methods. | 76 // FirewallManager methods. |
77 virtual bool CanUseLocalPorts() OVERRIDE { | 77 virtual bool CanUseLocalPorts() override { |
78 return !manager_.IsFirewallEnabled() || | 78 return !manager_.IsFirewallEnabled() || |
79 manager_.GetAllowIncomingConnection(NULL); | 79 manager_.GetAllowIncomingConnection(NULL); |
80 }; | 80 }; |
81 | 81 |
82 virtual bool AddFirewallRules() OVERRIDE { | 82 virtual bool AddFirewallRules() override { |
83 // Change nothing if rule is set. | 83 // Change nothing if rule is set. |
84 return manager_.GetAllowIncomingConnection(NULL) || | 84 return manager_.GetAllowIncomingConnection(NULL) || |
85 manager_.SetAllowIncomingConnection(true); | 85 manager_.SetAllowIncomingConnection(true); |
86 } | 86 } |
87 | 87 |
88 virtual void RemoveFirewallRules() OVERRIDE { | 88 virtual void RemoveFirewallRules() override { |
89 manager_.DeleteRule(); | 89 manager_.DeleteRule(); |
90 } | 90 } |
91 | 91 |
92 private: | 92 private: |
93 LegacyFirewallManager manager_; | 93 LegacyFirewallManager manager_; |
94 DISALLOW_COPY_AND_ASSIGN(FirewallManagerLegacyImpl); | 94 DISALLOW_COPY_AND_ASSIGN(FirewallManagerLegacyImpl); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace | 97 } // namespace |
98 | 98 |
(...skipping 15 matching lines...) Expand all Loading... |
114 if (legacy_manager->Init(dist->GetDisplayName(), chrome_path)) | 114 if (legacy_manager->Init(dist->GetDisplayName(), chrome_path)) |
115 return legacy_manager.PassAs<FirewallManager>(); | 115 return legacy_manager.PassAs<FirewallManager>(); |
116 | 116 |
117 return scoped_ptr<FirewallManager>(); | 117 return scoped_ptr<FirewallManager>(); |
118 } | 118 } |
119 | 119 |
120 FirewallManager::FirewallManager() { | 120 FirewallManager::FirewallManager() { |
121 } | 121 } |
122 | 122 |
123 } // namespace installer | 123 } // namespace installer |
OLD | NEW |