Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 7748036: Restoring a session should restore window minimization state on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: GetSavedWindowPlacement consolidation, Test, and All case. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #if defined(TOOLKIT_USES_GTK) 7 #if defined(TOOLKIT_USES_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 783
784 gfx::Rect BrowserView::GetBounds() const { 784 gfx::Rect BrowserView::GetBounds() const {
785 return frame_->GetWindowScreenBounds(); 785 return frame_->GetWindowScreenBounds();
786 } 786 }
787 787
788 bool BrowserView::IsMaximized() const { 788 bool BrowserView::IsMaximized() const {
789 return frame_->IsMaximized(); 789 return frame_->IsMaximized();
790 } 790 }
791 791
792 bool BrowserView::IsMinimized() const { 792 bool BrowserView::IsMinimized() const {
793 // TODO(dhollowa): Add support for session restore of minimized state. 793 return frame_->IsMinimized();
794 // http://crbug.com/43274
795 return false;
796 } 794 }
797 795
798 void BrowserView::SetFullscreen(bool fullscreen) { 796 void BrowserView::SetFullscreen(bool fullscreen) {
799 if (IsFullscreen() == fullscreen) 797 if (IsFullscreen() == fullscreen)
800 return; // Nothing to do. 798 return; // Nothing to do.
801 799
802 #if defined(OS_WIN) 800 #if defined(OS_WIN)
803 ProcessFullscreen(fullscreen); 801 ProcessFullscreen(fullscreen);
804 #else 802 #else
805 // On Linux changing fullscreen is async. Ask the window to change it's 803 // On Linux changing fullscreen is async. Ask the window to change it's
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 command_id = command_id_from_app_command; 1625 command_id = command_id_from_app_command;
1628 1626
1629 return browser_->ExecuteCommandIfEnabled(command_id); 1627 return browser_->ExecuteCommandIfEnabled(command_id);
1630 } 1628 }
1631 1629
1632 std::wstring BrowserView::GetWindowName() const { 1630 std::wstring BrowserView::GetWindowName() const {
1633 return UTF8ToWide(browser_->GetWindowPlacementKey()); 1631 return UTF8ToWide(browser_->GetWindowPlacementKey());
1634 } 1632 }
1635 1633
1636 void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, 1634 void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds,
1637 bool maximized) { 1635 ui::WindowShowState show_state) {
1638 // TODO(dhollowa): Add support for session restore of minimized state.
1639 // http://crbug.com/43274
1640
1641 // If IsFullscreen() is true, we've just changed into fullscreen mode, and 1636 // If IsFullscreen() is true, we've just changed into fullscreen mode, and
1642 // we're catching the going-into-fullscreen sizing and positioning calls, 1637 // we're catching the going-into-fullscreen sizing and positioning calls,
1643 // which we want to ignore. 1638 // which we want to ignore.
1644 if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) { 1639 if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) {
1645 WidgetDelegate::SaveWindowPlacement(bounds, maximized); 1640 WidgetDelegate::SaveWindowPlacement(bounds, show_state);
1646 browser_->SaveWindowPlacement(bounds, 1641 browser_->SaveWindowPlacement(bounds, show_state);
1647 maximized ? ui::SHOW_STATE_MAXIMIZED :
1648 ui::SHOW_STATE_NORMAL);
1649 } 1642 }
1650 } 1643 }
1651 1644
1652 bool BrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { 1645 bool BrowserView::GetSavedWindowPlacement(
1646 gfx::Rect* bounds,
1647 ui::WindowShowState* show_state) const {
1653 *bounds = browser_->GetSavedWindowBounds(); 1648 *bounds = browser_->GetSavedWindowBounds();
1649 *show_state = browser_->GetSavedWindowShowState();
1650
1654 if (browser_->is_type_popup() || browser_->is_type_panel()) { 1651 if (browser_->is_type_popup() || browser_->is_type_panel()) {
1655 // We are a popup window. The value passed in |bounds| represents two 1652 // We are a popup window. The value passed in |bounds| represents two
1656 // pieces of information: 1653 // pieces of information:
1657 // - the position of the window, in screen coordinates (outer position). 1654 // - the position of the window, in screen coordinates (outer position).
1658 // - the size of the content area (inner size). 1655 // - the size of the content area (inner size).
1659 // We need to use these values to determine the appropriate size and 1656 // We need to use these values to determine the appropriate size and
1660 // position of the resulting window. 1657 // position of the resulting window.
1661 if (IsToolbarVisible()) { 1658 if (IsToolbarVisible()) {
1662 // If we're showing the toolbar, we need to adjust |*bounds| to include 1659 // If we're showing the toolbar, we need to adjust |*bounds| to include
1663 // its desired height, since the toolbar is considered part of the 1660 // its desired height, since the toolbar is considered part of the
(...skipping 17 matching lines...) Expand all
1681 *bounds = window_rect; 1678 *bounds = window_rect;
1682 } 1679 }
1683 1680
1684 // We return true because we can _always_ locate reasonable bounds using the 1681 // We return true because we can _always_ locate reasonable bounds using the
1685 // WindowSizer, and we don't want to trigger the Window's built-in "size to 1682 // WindowSizer, and we don't want to trigger the Window's built-in "size to
1686 // default" handling because the browser window has no default preferred 1683 // default" handling because the browser window has no default preferred
1687 // size. 1684 // size.
1688 return true; 1685 return true;
1689 } 1686 }
1690 1687
1691 bool BrowserView::GetSavedMaximizedState(bool* maximized) const {
1692 // TODO(dhollowa): Add support for session restore of minimized state.
1693 // http://crbug.com/43274
1694 *maximized = browser_->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED;
1695 return true;
1696 }
1697
1698 views::View* BrowserView::GetContentsView() { 1688 views::View* BrowserView::GetContentsView() {
1699 return contents_container_; 1689 return contents_container_;
1700 } 1690 }
1701 1691
1702 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { 1692 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) {
1703 return this; 1693 return this;
1704 } 1694 }
1705 1695
1706 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, 1696 void BrowserView::OnWidgetActivationChanged(views::Widget* widget,
1707 bool active) { 1697 bool active) {
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2673 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2684 // Create the view and the frame. The frame will attach itself via the view 2674 // Create the view and the frame. The frame will attach itself via the view
2685 // so we don't need to do anything with the pointer. 2675 // so we don't need to do anything with the pointer.
2686 BrowserView* view = new BrowserView(browser); 2676 BrowserView* view = new BrowserView(browser);
2687 (new BrowserFrame(view))->InitBrowserFrame(); 2677 (new BrowserFrame(view))->InitBrowserFrame();
2688 view->GetWidget()->non_client_view()->SetAccessibleName( 2678 view->GetWidget()->non_client_view()->SetAccessibleName(
2689 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 2679 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
2690 return view; 2680 return view;
2691 } 2681 }
2692 #endif 2682 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698