| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_MAC_CFBUNDLE_BLOCKER_H_ | 5 #ifndef CHROME_COMMON_MAC_CFBUNDLE_BLOCKER_H_ |
| 6 #define CHROME_COMMON_MAC_CFBUNDLE_BLOCKER_H_ | 6 #define CHROME_COMMON_MAC_CFBUNDLE_BLOCKER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(__OBJC__) |
| 10 @class NSString; |
| 11 #else |
| 12 class NSString; |
| 13 #endif |
| 14 |
| 9 namespace chrome { | 15 namespace chrome { |
| 10 namespace common { | 16 namespace common { |
| 11 namespace mac { | 17 namespace mac { |
| 12 | 18 |
| 13 // Arranges to block loading of some third-party plug-in code that might try | 19 // Arranges to block loading of some third-party plug-in code that might try |
| 14 // to inject itself into the process. Modules loaded by CFBundle are blocked | 20 // to inject itself into the process. Modules loaded by CFBundle are blocked |
| 15 // if located within specific directories. Because NSBundle uses CFBundle | 21 // if located within specific directories. Because NSBundle uses CFBundle |
| 16 // behind the scenes, this also blocks modules loaded by NSBundle when located | 22 // behind the scenes, this also blocks modules loaded by NSBundle when located |
| 17 // in those same specific directories. | 23 // in those same specific directories. |
| 18 // | 24 // |
| 19 // Blocked modules include input managers, contextual menu items, and | 25 // Blocked modules include input managers, contextual menu items, and |
| 20 // scripting additions installed in per-user (~/Library), per-machine | 26 // scripting additions installed in per-user (~/Library), per-machine |
| 21 // (/Library), or network (/Network/Library) locations. Modules installed in | 27 // (/Library), or network (/Network/Library) locations. Modules installed in |
| 22 // the operating system location (/System/Library) are never blocked. | 28 // the operating system location (/System/Library) are never blocked. |
| 23 // | 29 // |
| 24 // This mechanism does not prevent CFBundle (or NSBundle) objects from being | 30 // This mechanism does not prevent CFBundle (or NSBundle) objects from being |
| 25 // created, but it does block them from loading modules into the process. | 31 // created, but it does block them from loading modules into the process. |
| 26 void EnableCFBundleBlocker(); | 32 void EnableCFBundleBlocker(); |
| 27 | 33 |
| 34 // Returns true if |bundle_id| and |version| identify a bundle that is allowed |
| 35 // to be loaded even when found in a blocked directory. |
| 36 // |
| 37 // Exposed only for testing. Do not call from outside the implementation. |
| 38 bool IsBundleAllowed(NSString* bundle_id, NSString* version); |
| 39 |
| 28 } // namespace mac | 40 } // namespace mac |
| 29 } // namespace common | 41 } // namespace common |
| 30 } // namespace chrome | 42 } // namespace chrome |
| 31 | 43 |
| 32 #endif // CHROME_COMMON_MAC_CFBUNDLE_BLOCKER_H_ | 44 #endif // CHROME_COMMON_MAC_CFBUNDLE_BLOCKER_H_ |
| OLD | NEW |