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