OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "content/browser/accessibility/browser_accessibility_mac.h" | 7 #import "content/browser/accessibility/browser_accessibility_mac.h" |
8 | 8 |
9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
10 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 // reference to the cocoa object. | 41 // reference to the cocoa object. |
42 [browser_accessibility_cocoa_ release]; | 42 [browser_accessibility_cocoa_ release]; |
43 // Finally, it's safe to delete this since we've detached. | 43 // Finally, it's safe to delete this since we've detached. |
44 delete this; | 44 delete this; |
45 } | 45 } |
46 | 46 |
47 bool BrowserAccessibilityMac::IsNative() const { | 47 bool BrowserAccessibilityMac::IsNative() const { |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 void BrowserAccessibilityMac::RecreateNativeObject() { | |
52 // Preserve the children so that recreating the native object doesn't | |
53 // end up recreating the whole subtree. | |
54 base::scoped_nsobject<NSMutableArray> children; | |
55 if (browser_accessibility_cocoa_) { | |
56 [browser_accessibility_cocoa_ swapChildren:&children]; | |
57 [browser_accessibility_cocoa_ detach]; | |
58 [browser_accessibility_cocoa_ release]; | |
59 } | |
60 browser_accessibility_cocoa_ = [[BrowserAccessibilityCocoa alloc] | |
David Tseng
2014/05/12 20:01:51
Doesn't it make sense to only recreate the cocoa o
dmazzoni
2014/05/13 07:28:19
Done.
| |
61 initWithObject:this]; | |
62 [browser_accessibility_cocoa_ swapChildren:&children]; | |
63 } | |
64 | |
51 BrowserAccessibilityCocoa* BrowserAccessibility::ToBrowserAccessibilityCocoa() { | 65 BrowserAccessibilityCocoa* BrowserAccessibility::ToBrowserAccessibilityCocoa() { |
52 return static_cast<BrowserAccessibilityMac*>(this)-> | 66 return static_cast<BrowserAccessibilityMac*>(this)-> |
53 native_view(); | 67 native_view(); |
54 } | 68 } |
55 | 69 |
56 } // namespace content | 70 } // namespace content |
OLD | NEW |