| 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/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 11 #include "chrome/browser/api/infobars/infobar_service.h" | 11 #include "chrome/browser/api/infobars/infobar_service.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 18 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 18 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" | 19 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 19 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 20 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
| 20 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 21 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| 21 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 22 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 22 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 23 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 23 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" | 24 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" |
| 24 #include "chrome/browser/ui/search/search.h" | 25 #include "chrome/browser/ui/search/search.h" |
| 25 #include "chrome/browser/ui/search/search_model.h" | 26 #include "chrome/browser/ui/search/search_model.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 view_list.push_back(VIEW_ID_INFO_BAR); | 265 view_list.push_back(VIEW_ID_INFO_BAR); |
| 265 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); | 266 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); |
| 266 view_list.push_back(VIEW_ID_FIND_BAR); | 267 view_list.push_back(VIEW_ID_FIND_BAR); |
| 267 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); | 268 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); |
| 268 VerifyZOrder(view_list); | 269 VerifyZOrder(view_list); |
| 269 } | 270 } |
| 270 | 271 |
| 271 // Verify that in non-instant presentation mode that the info bar is below the | 272 // Verify that in non-instant presentation mode that the info bar is below the |
| 272 // content are and everything else is above it. | 273 // content are and everything else is above it. |
| 273 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ZOrderPresentationMode) { | 274 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, ZOrderPresentationMode) { |
| 274 browser()->TogglePresentationMode(); | 275 chrome::ToggleFullscreenMode(browser()); |
| 275 browser()->GetFindBarController(); // add find bar | 276 browser()->GetFindBarController(); // add find bar |
| 276 | 277 |
| 277 std::vector<ViewID> view_list; | 278 std::vector<ViewID> view_list; |
| 278 view_list.push_back(VIEW_ID_INFO_BAR); | 279 view_list.push_back(VIEW_ID_INFO_BAR); |
| 279 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); | 280 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); |
| 280 view_list.push_back(VIEW_ID_FULLSCREEN_FLOATING_BAR); | 281 view_list.push_back(VIEW_ID_FULLSCREEN_FLOATING_BAR); |
| 281 view_list.push_back(VIEW_ID_BOOKMARK_BAR); | 282 view_list.push_back(VIEW_ID_BOOKMARK_BAR); |
| 282 view_list.push_back(VIEW_ID_TOOLBAR); | 283 view_list.push_back(VIEW_ID_TOOLBAR); |
| 283 view_list.push_back(VIEW_ID_FIND_BAR); | 284 view_list.push_back(VIEW_ID_FIND_BAR); |
| 284 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); | 285 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 298 view_list.push_back(VIEW_ID_FIND_BAR); | 299 view_list.push_back(VIEW_ID_FIND_BAR); |
| 299 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); | 300 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); |
| 300 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); | 301 view_list.push_back(VIEW_ID_DOWNLOAD_SHELF); |
| 301 VerifyZOrder(view_list); | 302 VerifyZOrder(view_list); |
| 302 } | 303 } |
| 303 | 304 |
| 304 // Presentation mode with instant results showing. Should be exact same as | 305 // Presentation mode with instant results showing. Should be exact same as |
| 305 // non-instant presentation mode. | 306 // non-instant presentation mode. |
| 306 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 307 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 307 ZOrderInstantPresentationMode) { | 308 ZOrderInstantPresentationMode) { |
| 308 browser()->TogglePresentationMode(); | 309 chrome::ToggleFullscreenMode(browser()); |
| 309 ShowInstantResults(); | 310 ShowInstantResults(); |
| 310 browser()->GetFindBarController(); // add find bar | 311 browser()->GetFindBarController(); // add find bar |
| 311 | 312 |
| 312 std::vector<ViewID> view_list; | 313 std::vector<ViewID> view_list; |
| 313 view_list.push_back(VIEW_ID_INFO_BAR); | 314 view_list.push_back(VIEW_ID_INFO_BAR); |
| 314 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); | 315 view_list.push_back(VIEW_ID_TAB_CONTENT_AREA); |
| 315 view_list.push_back(VIEW_ID_FULLSCREEN_FLOATING_BAR); | 316 view_list.push_back(VIEW_ID_FULLSCREEN_FLOATING_BAR); |
| 316 view_list.push_back(VIEW_ID_BOOKMARK_BAR); | 317 view_list.push_back(VIEW_ID_BOOKMARK_BAR); |
| 317 view_list.push_back(VIEW_ID_TOOLBAR); | 318 view_list.push_back(VIEW_ID_TOOLBAR); |
| 318 view_list.push_back(VIEW_ID_FIND_BAR); | 319 view_list.push_back(VIEW_ID_FIND_BAR); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 346 // Minus bookmark bar. | 347 // Minus bookmark bar. |
| 347 browser()->window()->ToggleBookmarkBar(); | 348 browser()->window()->ToggleBookmarkBar(); |
| 348 EXPECT_EQ(0, [preview previewOffset]); | 349 EXPECT_EQ(0, [preview previewOffset]); |
| 349 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview activeContainerOffset]); | 350 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview activeContainerOffset]); |
| 350 } | 351 } |
| 351 | 352 |
| 352 // Verify that in non-instant presentation mode the content area is beneath | 353 // Verify that in non-instant presentation mode the content area is beneath |
| 353 // the info bar. | 354 // the info bar. |
| 354 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 355 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 355 ContentOffsetPresentationMode) { | 356 ContentOffsetPresentationMode) { |
| 356 browser()->TogglePresentationMode(); | 357 chrome::ToggleFullscreenMode(browser()); |
| 357 PreviewableContentsController* preview = | 358 PreviewableContentsController* preview = |
| 358 [controller() previewableContentsController]; | 359 [controller() previewableContentsController]; |
| 359 | 360 |
| 360 // Just toolbar. | 361 // Just toolbar. |
| 361 EXPECT_EQ(0, [preview previewOffset]); | 362 EXPECT_EQ(0, [preview previewOffset]); |
| 362 EXPECT_EQ(0, [preview activeContainerOffset]); | 363 EXPECT_EQ(0, [preview activeContainerOffset]); |
| 363 | 364 |
| 364 // Plus bookmark bar. | 365 // Plus bookmark bar. |
| 365 browser()->window()->ToggleBookmarkBar(); | 366 browser()->window()->ToggleBookmarkBar(); |
| 366 EXPECT_EQ(0, [preview previewOffset]); | 367 EXPECT_EQ(0, [preview previewOffset]); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 [preview previewOffset]); | 430 [preview previewOffset]); |
| 430 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + | 431 EXPECT_EQ(GetViewHeight(VIEW_ID_BOOKMARK_BAR) + |
| 431 GetViewHeight(VIEW_ID_INFO_BAR), | 432 GetViewHeight(VIEW_ID_INFO_BAR), |
| 432 [preview activeContainerOffset]); | 433 [preview activeContainerOffset]); |
| 433 | 434 |
| 434 // Minus bookmark bar. | 435 // Minus bookmark bar. |
| 435 browser()->window()->ToggleBookmarkBar(); | 436 browser()->window()->ToggleBookmarkBar(); |
| 436 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview previewOffset]); | 437 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview previewOffset]); |
| 437 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview activeContainerOffset]); | 438 EXPECT_EQ(GetViewHeight(VIEW_ID_INFO_BAR), [preview activeContainerOffset]); |
| 438 } | 439 } |
| OLD | NEW |