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 "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #import "base/mac/mac_util.h" | 7 #import "base/mac/mac_util.h" |
8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 timer.Start( | 193 timer.Start( |
194 FROM_HERE, | 194 FROM_HERE, |
195 base::TimeDelta::FromMilliseconds(15), | 195 base::TimeDelta::FromMilliseconds(15), |
196 base::Bind(&CheckBookmarkBarAnimation, | 196 base::Bind(&CheckBookmarkBarAnimation, |
197 [controller() bookmarkBarController], | 197 [controller() bookmarkBarController], |
198 runner->QuitClosure())); | 198 runner->QuitClosure())); |
199 runner->Run(); | 199 runner->Run(); |
200 } | 200 } |
201 | 201 |
202 NSInteger GetExpectedTopInfoBarTipHeight() { | 202 NSInteger GetExpectedTopInfoBarTipHeight() { |
203 InfoBarContainerController* info_bar_container_controller = | 203 // Bubble point in window coordinates. |
204 [controller() infoBarContainerController]; | |
205 CGFloat overlapping_tip_height = | |
206 [info_bar_container_controller overlappingTipHeight]; | |
207 LocationBarViewMac* location_bar_view = [controller() locationBarBridge]; | 204 LocationBarViewMac* location_bar_view = [controller() locationBarBridge]; |
208 NSPoint icon_bottom = location_bar_view->GetPageInfoBubblePoint(); | 205 NSPoint icon_bottom = location_bar_view->GetPageInfoBubblePoint(); |
209 | 206 |
210 NSPoint info_bar_top = NSMakePoint(0, | 207 // Toolbar's frame in window coordinates. |
211 NSHeight([info_bar_container_controller view].frame) - | 208 NSView* toolbar = [[controller() toolbarController] view]; |
212 overlapping_tip_height); | 209 NSRect toolbarFrame = [toolbar convertRect:toolbar.bounds toView:nil]; |
213 info_bar_top = [[info_bar_container_controller view] | 210 |
214 convertPoint:info_bar_top toView:nil]; | 211 return icon_bottom.y - NSMinY(toolbarFrame); |
215 return icon_bottom.y - info_bar_top.y; | |
216 } | 212 } |
| 213 |
217 // The traffic lights should always be in front of the content view and the | 214 // The traffic lights should always be in front of the content view and the |
218 // tab strip view. Since the traffic lights change across OSX versions, this | 215 // tab strip view. Since the traffic lights change across OSX versions, this |
219 // test verifies that the contentView is in the back, and if the tab strip | 216 // test verifies that the contentView is in the back, and if the tab strip |
220 // view is a sibling, it is directly in front of the content view. | 217 // view is a sibling, it is directly in front of the content view. |
221 void VerifyTrafficLightZOrder() const { | 218 void VerifyTrafficLightZOrder() const { |
222 NSView* contentView = [[controller() window] contentView]; | 219 NSView* contentView = [[controller() window] contentView]; |
223 NSView* rootView = [contentView superview]; | 220 NSView* rootView = [contentView superview]; |
224 EXPECT_EQ(contentView, [[rootView subviews] objectAtIndex:0]); | 221 EXPECT_EQ(contentView, [[rootView subviews] objectAtIndex:0]); |
225 | 222 |
226 NSView* tabStripView = [controller() tabStripView]; | 223 NSView* tabStripView = [controller() tabStripView]; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 return; | 333 return; |
337 | 334 |
338 chrome::ToggleFullscreenMode(browser()); | 335 chrome::ToggleFullscreenMode(browser()); |
339 | 336 |
340 NSView* fullscreen_floating_bar = | 337 NSView* fullscreen_floating_bar = |
341 GetViewWithID(VIEW_ID_FULLSCREEN_FLOATING_BAR); | 338 GetViewWithID(VIEW_ID_FULLSCREEN_FLOATING_BAR); |
342 [fullscreen_floating_bar removeFromSuperview]; | 339 [fullscreen_floating_bar removeFromSuperview]; |
343 [[[controller() window] contentView] addSubview:fullscreen_floating_bar | 340 [[[controller() window] contentView] addSubview:fullscreen_floating_bar |
344 positioned:NSWindowBelow | 341 positioned:NSWindowBelow |
345 relativeTo:nil]; | 342 relativeTo:nil]; |
346 [controller() updateSubviewZOrder:[controller() inPresentationMode]]; | 343 [controller() updateSubviewZOrder]; |
347 | 344 |
348 std::vector<ViewID> view_list; | 345 std::vector<ViewID> view_list; |
349 view_list.push_back(VIEW_ID_INFO_BAR); | 346 view_list.push_back(VIEW_ID_INFO_BAR); |
350 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); | 347 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); |
351 view_list.push_back(VIEW_ID_FULLSCREEN_FLOATING_BAR); | 348 view_list.push_back(VIEW_ID_FULLSCREEN_FLOATING_BAR); |
352 view_list.push_back(VIEW_ID_BOOKMARK_BAR); | 349 view_list.push_back(VIEW_ID_BOOKMARK_BAR); |
353 view_list.push_back(VIEW_ID_TOOLBAR); | 350 view_list.push_back(VIEW_ID_TOOLBAR); |
354 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); | 351 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); |
355 VerifyZOrder(view_list); | 352 VerifyZOrder(view_list); |
356 } | 353 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 // Toggle overlay, then verify z order. | 481 // Toggle overlay, then verify z order. |
485 [controller() showOverlay]; | 482 [controller() showOverlay]; |
486 [controller() removeOverlay]; | 483 [controller() removeOverlay]; |
487 VerifyTrafficLightZOrder(); | 484 VerifyTrafficLightZOrder(); |
488 | 485 |
489 // Toggle immersive fullscreen, then verify z order. | 486 // Toggle immersive fullscreen, then verify z order. |
490 [controller() enterImmersiveFullscreen]; | 487 [controller() enterImmersiveFullscreen]; |
491 [controller() exitImmersiveFullscreen]; | 488 [controller() exitImmersiveFullscreen]; |
492 VerifyTrafficLightZOrder(); | 489 VerifyTrafficLightZOrder(); |
493 } | 490 } |
OLD | NEW |