firewall_manager_win.h revision 0529e5d033099cbfc42635f6f6183833b09dff6e
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 10class BrowserDistribution; 11 12namespace base { 13class FilePath; 14} 15 16namespace installer { 17 18// Requires that COM be initialized on the calling thread. 19class 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