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