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 #ifndef CHROME_INSTALLER_UTIL_FIREWALL_MANAGER_WIN_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_FIREWALL_MANAGER_WIN_H_ |
6 #define CHROME_INSTALLER_UTIL_FIREWALL_MANAGER_WIN_H_ | 6 #define CHROME_INSTALLER_UTIL_FIREWALL_MANAGER_WIN_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 | 11 |
11 class BrowserDistribution; | 12 class BrowserDistribution; |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class FilePath; | 15 class FilePath; |
15 } | 16 } |
16 | 17 |
17 namespace installer { | 18 namespace installer { |
18 | 19 |
19 // Requires that COM be initialized on the calling thread. | 20 // Requires that COM be initialized on the calling thread. |
20 class FirewallManager { | 21 class FirewallManager { |
21 public: | 22 public: |
22 virtual ~FirewallManager(); | 23 virtual ~FirewallManager(); |
23 | 24 |
24 // Creates instance of |FirewallManager|. Implementation chooses best version | 25 // Creates instance of |FirewallManager|. Implementation chooses best version |
25 // available for current version of Windows. | 26 // available for current version of Windows. |
26 static scoped_ptr<FirewallManager> Create(BrowserDistribution* dist, | 27 static std::unique_ptr<FirewallManager> Create( |
27 const base::FilePath& chrome_path); | 28 BrowserDistribution* dist, |
| 29 const base::FilePath& chrome_path); |
28 | 30 |
29 // Returns true if application can one ports for incoming connections without | 31 // Returns true if application can one ports for incoming connections without |
30 // triggering firewall alert. It still does not guarantee that traffic | 32 // triggering firewall alert. It still does not guarantee that traffic |
31 // would pass firewall. | 33 // would pass firewall. |
32 virtual bool CanUseLocalPorts() = 0; | 34 virtual bool CanUseLocalPorts() = 0; |
33 | 35 |
34 // Installs all windows firewall rules needed by Chrome. | 36 // Installs all windows firewall rules needed by Chrome. |
35 // Return true if operation succeeded. Needs elevation. | 37 // Return true if operation succeeded. Needs elevation. |
36 virtual bool AddFirewallRules() = 0; | 38 virtual bool AddFirewallRules() = 0; |
37 | 39 |
38 // Removes all windows firewall related to Chrome. Needs elevation. | 40 // Removes all windows firewall related to Chrome. Needs elevation. |
39 virtual void RemoveFirewallRules() = 0; | 41 virtual void RemoveFirewallRules() = 0; |
40 | 42 |
41 protected: | 43 protected: |
42 FirewallManager(); | 44 FirewallManager(); |
43 | 45 |
44 DISALLOW_COPY_AND_ASSIGN(FirewallManager); | 46 DISALLOW_COPY_AND_ASSIGN(FirewallManager); |
45 }; | 47 }; |
46 | 48 |
47 } // namespace installer | 49 } // namespace installer |
48 | 50 |
49 #endif // CHROME_INSTALLER_UTIL_FIREWALL_MANAGER_WIN_H_ | 51 #endif // CHROME_INSTALLER_UTIL_FIREWALL_MANAGER_WIN_H_ |
OLD | NEW |