Remove obsolete for_web_contents parameter in FontRenderParamsQuery.
[chromium-blink-merge.git] / chrome / installer / util / legacy_firewall_manager_win.h
blob6c8afbdd3781f750de89ad1da301efec7861f552
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.
5 #ifndef CHROME_INSTALLER_UTIL_LEGACY_FIREWALL_MANAGER_WIN_H_
6 #define CHROME_INSTALLER_UTIL_LEGACY_FIREWALL_MANAGER_WIN_H_
8 #include <windows.h>
9 #include <netfw.h>
11 #include "base/files/file_path.h"
12 #include "base/strings/string16.h"
13 #include "base/win/scoped_comptr.h"
15 namespace installer {
17 // Manages firewall rules using Windows Firewall API. The API is
18 // available on Windows XP with SP2 and later. Applications should use
19 // |AdvancedFirewallManager| instead of this class on Windows Vista and later.
20 // Most methods need elevation.
21 class LegacyFirewallManager {
22 public:
23 LegacyFirewallManager();
24 ~LegacyFirewallManager();
26 // Initializes object to manage application win name |app_name| and path
27 // |app_path|.
28 bool Init(const base::string16& app_name, const base::FilePath& app_path);
30 // Returns true if firewall is enabled.
31 bool IsFirewallEnabled();
33 // Returns true if function can read rule for the current app. Sets |value|
34 // true, if rule allows incoming connections, or false otherwise.
35 bool GetAllowIncomingConnection(bool* value);
37 // Allows or blocks all incoming connection for current app. Needs elevation.
38 bool SetAllowIncomingConnection(bool allow);
40 // Deletes rule for current app. Needs elevation.
41 void DeleteRule();
43 private:
44 // Returns the authorized applications collection for the local firewall
45 // policy's current profile or an empty pointer in case of error.
46 base::win::ScopedComPtr<INetFwAuthorizedApplications>
47 GetAuthorizedApplications();
49 // Creates rule for the current application. If |allow| is true, incoming
50 // connections are allowed, blocked otherwise.
51 base::win::ScopedComPtr<INetFwAuthorizedApplication>
52 CreateChromeAuthorization(bool allow);
54 base::string16 app_name_;
55 base::FilePath app_path_;
56 base::win::ScopedComPtr<INetFwProfile> current_profile_;
58 DISALLOW_COPY_AND_ASSIGN(LegacyFirewallManager);
61 } // namespace installer
63 #endif // CHROME_INSTALLER_UTIL_LEGACY_FIREWALL_MANAGER_WIN_H_