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 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 [controller_ revealAnimatedWithFrame:finalFrame]; | 96 [controller_ revealAnimatedWithFrame:finalFrame]; |
97 } | 97 } |
98 | 98 |
99 gfx::Rect PanelBrowserWindowCocoa::GetPanelBounds() const { | 99 gfx::Rect PanelBrowserWindowCocoa::GetPanelBounds() const { |
100 return bounds_; | 100 return bounds_; |
101 } | 101 } |
102 | 102 |
103 // |bounds| is the platform-independent screen coordinates, with (0,0) at | 103 // |bounds| is the platform-independent screen coordinates, with (0,0) at |
104 // top-left of the primary screen. | 104 // top-left of the primary screen. |
105 void PanelBrowserWindowCocoa::SetPanelBounds(const gfx::Rect& bounds) { | 105 void PanelBrowserWindowCocoa::SetPanelBounds(const gfx::Rect& bounds) { |
| 106 setBoundsInternal(bounds, true); |
| 107 } |
| 108 |
| 109 void PanelBrowserWindowCocoa::SetPanelBoundsInstantly(const gfx::Rect& bounds) { |
| 110 setBoundsInternal(bounds, false); |
| 111 } |
| 112 |
| 113 void PanelBrowserWindowCocoa::setBoundsInternal(const gfx::Rect& bounds, |
| 114 bool animate) { |
106 if (bounds_ == bounds) | 115 if (bounds_ == bounds) |
107 return; | 116 return; |
108 | 117 |
109 bounds_ = bounds; | 118 bounds_ = bounds; |
110 | 119 |
111 NSRect frame = ConvertCoordinatesToCocoa(bounds); | 120 NSRect frame = ConvertCoordinatesToCocoa(bounds); |
112 [controller_ setPanelFrame:frame]; | 121 [controller_ setPanelFrame:frame animate:animate]; |
113 } | 122 } |
114 | 123 |
115 void PanelBrowserWindowCocoa::ClosePanel() { | 124 void PanelBrowserWindowCocoa::ClosePanel() { |
116 if (isClosed()) | 125 if (isClosed()) |
117 return; | 126 return; |
118 | 127 |
119 NSWindow* window = [controller_ window]; | 128 NSWindow* window = [controller_ window]; |
120 [window performClose:controller_]; | 129 [window performClose:controller_]; |
121 } | 130 } |
122 | 131 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 return false; | 367 return false; |
359 } | 368 } |
360 | 369 |
361 bool NativePanelTestingCocoa::IsWindowSizeKnown() const { | 370 bool NativePanelTestingCocoa::IsWindowSizeKnown() const { |
362 return true; | 371 return true; |
363 } | 372 } |
364 | 373 |
365 bool NativePanelTestingCocoa::IsAnimatingBounds() const { | 374 bool NativePanelTestingCocoa::IsAnimatingBounds() const { |
366 return [native_panel_window_->controller_ isAnimatingBounds]; | 375 return [native_panel_window_->controller_ isAnimatingBounds]; |
367 } | 376 } |
OLD | NEW |