OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #include "chrome/browser/views/frame/browser_view.h" | 7 #include "chrome/browser/views/frame/browser_view.h" |
8 | 8 |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
12 #include "chrome/browser/app_modal_dialog_queue.h" | 12 #include "chrome/browser/app_modal_dialog_queue.h" |
13 #include "chrome/browser/browser.h" | 13 #include "chrome/browser/browser.h" |
14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
15 #include "chrome/browser/encoding_menu_controller_delegate.h" | 15 #include "chrome/browser/encoding_menu_controller_delegate.h" |
16 #include "chrome/browser/view_ids.h" | 16 #include "chrome/browser/view_ids.h" |
17 #include "chrome/browser/views/about_chrome_view.h" | 17 #include "chrome/browser/views/about_chrome_view.h" |
18 #include "chrome/browser/views/bookmark_bar_view.h" | 18 #include "chrome/browser/views/bookmark_bar_view.h" |
19 #include "chrome/browser/views/bookmark_bubble_view.h" | 19 #include "chrome/browser/views/bookmark_bubble_view.h" |
20 #include "chrome/browser/views/bookmark_manager_view.h" | 20 #include "chrome/browser/views/bookmark_manager_view.h" |
21 #include "chrome/browser/views/bug_report_view.h" | 21 #include "chrome/browser/views/bug_report_view.h" |
22 #include "chrome/browser/views/clear_browsing_data.h" | 22 #include "chrome/browser/views/clear_browsing_data.h" |
23 #include "chrome/browser/views/download_shelf_view.h" | 23 #include "chrome/browser/views/download_shelf_view.h" |
24 #include "chrome/browser/views/frame/browser_frame.h" | 24 #include "chrome/browser/views/frame/browser_frame.h" |
| 25 #include "chrome/browser/views/fullscreen_exit_bubble.h" |
25 #include "chrome/browser/views/html_dialog_view.h" | 26 #include "chrome/browser/views/html_dialog_view.h" |
26 #include "chrome/browser/views/importer_view.h" | 27 #include "chrome/browser/views/importer_view.h" |
27 #include "chrome/browser/views/infobars/infobar_container.h" | 28 #include "chrome/browser/views/infobars/infobar_container.h" |
28 #include "chrome/browser/views/keyword_editor_view.h" | 29 #include "chrome/browser/views/keyword_editor_view.h" |
29 #include "chrome/browser/views/new_profile_dialog.h" | 30 #include "chrome/browser/views/new_profile_dialog.h" |
30 #include "chrome/browser/views/password_manager_view.h" | 31 #include "chrome/browser/views/password_manager_view.h" |
31 #include "chrome/browser/views/select_profile_dialog.h" | 32 #include "chrome/browser/views/select_profile_dialog.h" |
32 #include "chrome/browser/views/status_bubble_views.h" | 33 #include "chrome/browser/views/status_bubble_views.h" |
33 #include "chrome/browser/views/tab_contents_container_view.h" | 34 #include "chrome/browser/views/tab_contents_container_view.h" |
34 #include "chrome/browser/views/tabs/tab_strip.h" | 35 #include "chrome/browser/views/tabs/tab_strip.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 } | 571 } |
571 location_bar->SetFocusable(fullscreen_); | 572 location_bar->SetFocusable(fullscreen_); |
572 | 573 |
573 // Toggle fullscreen mode. | 574 // Toggle fullscreen mode. |
574 fullscreen_ = fullscreen; | 575 fullscreen_ = fullscreen; |
575 | 576 |
576 // Notify bookmark bar, so it can set itself to the appropriate drawing state. | 577 // Notify bookmark bar, so it can set itself to the appropriate drawing state. |
577 if (bookmark_bar_view_.get()) | 578 if (bookmark_bar_view_.get()) |
578 bookmark_bar_view_->OnFullscreenToggled(fullscreen_); | 579 bookmark_bar_view_->OnFullscreenToggled(fullscreen_); |
579 | 580 |
580 HWND hwnd = GetWidget()->GetHWND(); | 581 // Size/position/style window appropriately. |
| 582 views::Widget* widget = GetWidget(); |
| 583 HWND hwnd = widget->GetHWND(); |
581 gfx::Rect new_rect; | 584 gfx::Rect new_rect; |
582 if (fullscreen_) { | 585 if (fullscreen_) { |
583 // Save current window information. | 586 // Save current window information. |
584 saved_window_info_.style = GetWindowLong(hwnd, GWL_STYLE); | 587 saved_window_info_.style = GetWindowLong(hwnd, GWL_STYLE); |
585 saved_window_info_.ex_style = GetWindowLong(hwnd, GWL_EXSTYLE); | 588 saved_window_info_.ex_style = GetWindowLong(hwnd, GWL_EXSTYLE); |
586 GetWindowRect(hwnd, &saved_window_info_.window_rect); | 589 GetWindowRect(hwnd, &saved_window_info_.window_rect); |
587 | 590 |
588 // Set new window style and size. | 591 // Set new window style and size. |
589 SetWindowLong(hwnd, GWL_STYLE, | 592 SetWindowLong(hwnd, GWL_STYLE, |
590 saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME)); | 593 saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME)); |
591 SetWindowLong(hwnd, GWL_EXSTYLE, | 594 SetWindowLong(hwnd, GWL_EXSTYLE, |
592 saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME | | 595 saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME | |
593 WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); | 596 WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); |
594 MONITORINFO monitor_info; | 597 MONITORINFO monitor_info; |
595 monitor_info.cbSize = sizeof(monitor_info); | 598 monitor_info.cbSize = sizeof(monitor_info); |
596 GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), | 599 GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), |
597 &monitor_info); | 600 &monitor_info); |
598 new_rect = monitor_info.rcMonitor; | 601 new_rect = monitor_info.rcMonitor; |
599 } else { | 602 } else { |
600 // Reset original window style and size. | 603 // Reset original window style and size. |
601 SetWindowLong(hwnd, GWL_STYLE, saved_window_info_.style); | 604 SetWindowLong(hwnd, GWL_STYLE, saved_window_info_.style); |
602 SetWindowLong(hwnd, GWL_EXSTYLE, saved_window_info_.ex_style); | 605 SetWindowLong(hwnd, GWL_EXSTYLE, saved_window_info_.ex_style); |
603 new_rect = saved_window_info_.window_rect; | 606 new_rect = saved_window_info_.window_rect; |
604 } | 607 } |
605 // This will cause the window to re-layout. | 608 // This will cause the window to re-layout. |
606 SetWindowPos(hwnd, NULL, new_rect.x(), new_rect.y(), new_rect.width(), | 609 SetWindowPos(hwnd, NULL, new_rect.x(), new_rect.y(), new_rect.width(), |
607 new_rect.height(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); | 610 new_rect.height(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); |
| 611 |
| 612 // Turn fullscreen bubble on or off. |
| 613 fullscreen_bubble_.reset(fullscreen_ ? |
| 614 new FullscreenExitBubble(widget, browser_.get()) : NULL); |
608 } | 615 } |
609 | 616 |
610 bool BrowserView::IsFullscreen() const { | 617 bool BrowserView::IsFullscreen() const { |
611 return fullscreen_; | 618 return fullscreen_; |
612 } | 619 } |
613 | 620 |
614 LocationBar* BrowserView::GetLocationBar() const { | 621 LocationBar* BrowserView::GetLocationBar() const { |
615 return toolbar_->GetLocationBarView(); | 622 return toolbar_->GetLocationBarView(); |
616 } | 623 } |
617 | 624 |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 | 1562 |
1556 // static | 1563 // static |
1557 void BrowserView::InitClass() { | 1564 void BrowserView::InitClass() { |
1558 static bool initialized = false; | 1565 static bool initialized = false; |
1559 if (!initialized) { | 1566 if (!initialized) { |
1560 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1567 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
1561 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 1568 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
1562 initialized = true; | 1569 initialized = true; |
1563 } | 1570 } |
1564 } | 1571 } |
OLD | NEW |