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 #ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_PAGE_INFO_VIEW_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_PAGE_INFO_VIEW_CONTROLLER_H_ |
6 #define IOS_CHROME_BROWSER_UI_OMNIBOX_PAGE_INFO_VIEW_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_UI_OMNIBOX_PAGE_INFO_VIEW_CONTROLLER_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // PageInfoModelObserver implementation. | 47 // PageInfoModelObserver implementation. |
48 void OnPageInfoModelChanged() override; | 48 void OnPageInfoModelChanged() override; |
49 | 49 |
50 // Sets the controller. | 50 // Sets the controller. |
51 void set_controller(PageInfoViewController* controller) { | 51 void set_controller(PageInfoViewController* controller) { |
52 controller_ = controller; | 52 controller_ = controller; |
53 } | 53 } |
54 | 54 |
55 private: | 55 private: |
56 void PerformLayout() { | 56 void PerformLayout(); |
57 // If the window is animating closed when this is called, the | |
58 // animation could be holding the last reference to |controller_| | |
59 // (and thus |this|). Pin it until the task is completed. | |
60 base::scoped_nsobject<PageInfoViewController> keep_alive( | |
61 [controller_ retain]); | |
62 [controller_ performLayout]; | |
63 } | |
64 | 57 |
65 PageInfoViewController* controller_; // weak | 58 __unsafe_unretained PageInfoViewController* controller_; |
66 | 59 |
67 base::WeakPtrFactory<PageInfoModelBubbleBridge> weak_ptr_factory_; | 60 base::WeakPtrFactory<PageInfoModelBubbleBridge> weak_ptr_factory_; |
68 | 61 |
69 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); | 62 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); |
70 }; | 63 }; |
71 | 64 |
72 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_PAGE_INFO_VIEW_CONTROLLER_H_ | 65 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_PAGE_INFO_VIEW_CONTROLLER_H_ |
OLD | NEW |