Home | History | Annotate | Download | only in mac
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_COMMON_MAC_OBJC_METHOD_SWIZZLE_H_
      6 #define CHROME_COMMON_MAC_OBJC_METHOD_SWIZZLE_H_
      7 
      8 #import <objc/runtime.h>
      9 
     10 // You should think twice every single time you use anything from this
     11 // namespace.
     12 namespace ObjcEvilDoers {
     13 
     14 // This is similar to class_getInstanceMethod(), except that it
     15 // returns NULL if |aClass| does not directly implement |aSelector|.
     16 Method GetImplementedInstanceMethod(Class aClass, SEL aSelector);
     17 
     18 // Exchanges the implementation of |originalSelector| and
     19 // |alternateSelector| within |aClass|.  Both selectors must be
     20 // implemented directly by |aClass|, not inherited.  The IMP returned
     21 // is for |originalSelector| (for purposes of forwarding).
     22 IMP SwizzleImplementedInstanceMethods(
     23     Class aClass, const SEL originalSelector, const SEL alternateSelector);
     24 
     25 }  // namespace ObjcEvilDoers
     26 
     27 #endif  // CHROME_COMMON_MAC_OBJC_METHOD_SWIZZLE_H_
     28