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