| 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 #import "chrome/browser/ui/cocoa/page_info_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/page_info_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 1000 /* milliseconds */); | 124 1000 /* milliseconds */); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Sets the controller. | 127 // Sets the controller. |
| 128 void set_controller(PageInfoBubbleController* controller) { | 128 void set_controller(PageInfoBubbleController* controller) { |
| 129 controller_ = controller; | 129 controller_ = controller; |
| 130 } | 130 } |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 void PerformLayout() { | 133 void PerformLayout() { |
| 134 // If the window is animating closed when this is called, the |
| 135 // animation could be holding the last reference to |controller_| |
| 136 // (and thus |this|). Pin it until the task is completed. |
| 137 scoped_nsobject<PageInfoBubbleController> keep_alive([controller_ retain]); |
| 134 [controller_ performLayout]; | 138 [controller_ performLayout]; |
| 135 } | 139 } |
| 136 | 140 |
| 137 PageInfoBubbleController* controller_; // weak | 141 PageInfoBubbleController* controller_; // weak |
| 138 | 142 |
| 139 // Factory that vends RunnableMethod tasks for scheduling layout. | 143 // Factory that vends RunnableMethod tasks for scheduling layout. |
| 140 ScopedRunnableMethodFactory<PageInfoModelBubbleBridge> task_factory_; | 144 ScopedRunnableMethodFactory<PageInfoModelBubbleBridge> task_factory_; |
| 141 | 145 |
| 142 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); | 146 DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); |
| 143 }; | 147 }; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 LocationBarViewMac* locationBar = [controller locationBarBridge]; | 475 LocationBarViewMac* locationBar = [controller locationBarBridge]; |
| 472 if (locationBar) { | 476 if (locationBar) { |
| 473 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); | 477 NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint(); |
| 474 origin = [parent convertBaseToScreen:bubblePoint]; | 478 origin = [parent convertBaseToScreen:bubblePoint]; |
| 475 } | 479 } |
| 476 } | 480 } |
| 477 return origin; | 481 return origin; |
| 478 } | 482 } |
| 479 | 483 |
| 480 @end | 484 @end |
| OLD | NEW |