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