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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "chrome/installer/util/advanced_firewall_manager_win.h" | 14 #include "chrome/installer/util/advanced_firewall_manager_win.h" |
15 #include "chrome/installer/util/browser_distribution.h" | 15 #include "chrome/installer/util/browser_distribution.h" |
16 #include "chrome/installer/util/install_util.h" | |
17 #include "chrome/installer/util/installer_util_strings.h" | 16 #include "chrome/installer/util/installer_util_strings.h" |
18 #include "chrome/installer/util/l10n_string_util.h" | 17 #include "chrome/installer/util/l10n_string_util.h" |
19 #include "chrome/installer/util/legacy_firewall_manager_win.h" | 18 #include "chrome/installer/util/legacy_firewall_manager_win.h" |
20 | 19 |
21 namespace installer { | 20 namespace installer { |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 const uint16_t kDefaultMdnsPort = 5353; | 24 const uint16_t kDefaultMdnsPort = 5353; |
26 | 25 |
(...skipping 15 matching lines...) Expand all Loading... |
42 return manager_.AddUDPRule(GetMdnsRuleName(), GetMdnsRuleDescription(), | 41 return manager_.AddUDPRule(GetMdnsRuleName(), GetMdnsRuleDescription(), |
43 kDefaultMdnsPort); | 42 kDefaultMdnsPort); |
44 } | 43 } |
45 | 44 |
46 void RemoveFirewallRules() override { | 45 void RemoveFirewallRules() override { |
47 manager_.DeleteAllRules(); | 46 manager_.DeleteAllRules(); |
48 } | 47 } |
49 | 48 |
50 private: | 49 private: |
51 static base::string16 GetMdnsRuleName() { | 50 static base::string16 GetMdnsRuleName() { |
52 #if defined(GOOGLE_CHROME_BUILD) | |
53 if (InstallUtil::IsChromeSxSProcess()) | |
54 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_NAME_CANARY_BASE); | |
55 #endif | |
56 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_NAME_BASE); | 51 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_NAME_BASE); |
57 } | 52 } |
58 | 53 |
59 static base::string16 GetMdnsRuleDescription() { | 54 static base::string16 GetMdnsRuleDescription() { |
60 #if defined(GOOGLE_CHROME_BUILD) | 55 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_DESCRIPTION_BASE); |
61 if (InstallUtil::IsChromeSxSProcess()) | |
62 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_DESCRIPTION_CANARY_BASE); | |
63 #endif | |
64 return GetLocalizedString(IDS_INBOUND_MDNS_RULE_DESCRIPTION_BASE); | |
65 } | 56 } |
66 | 57 |
67 AdvancedFirewallManager manager_; | 58 AdvancedFirewallManager manager_; |
68 DISALLOW_COPY_AND_ASSIGN(FirewallManagerAdvancedImpl); | 59 DISALLOW_COPY_AND_ASSIGN(FirewallManagerAdvancedImpl); |
69 }; | 60 }; |
70 | 61 |
71 class FirewallManagerLegacyImpl : public FirewallManager { | 62 class FirewallManagerLegacyImpl : public FirewallManager { |
72 public: | 63 public: |
73 FirewallManagerLegacyImpl() {} | 64 FirewallManagerLegacyImpl() {} |
74 ~FirewallManagerLegacyImpl() override {} | 65 ~FirewallManagerLegacyImpl() override {} |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (legacy_manager->Init(dist->GetDisplayName(), chrome_path)) | 109 if (legacy_manager->Init(dist->GetDisplayName(), chrome_path)) |
119 return std::move(legacy_manager); | 110 return std::move(legacy_manager); |
120 | 111 |
121 return nullptr; | 112 return nullptr; |
122 } | 113 } |
123 | 114 |
124 FirewallManager::FirewallManager() { | 115 FirewallManager::FirewallManager() { |
125 } | 116 } |
126 | 117 |
127 } // namespace installer | 118 } // namespace installer |
OLD | NEW |