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

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: Rebase Created 9 years, 3 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 && !browser_->is_devtools()) { 1652 && !browser_->is_devtools()) {
1656 // We are a popup window. The value passed in |bounds| represents two 1653 // We are a popup window. The value passed in |bounds| represents two
1657 // pieces of information: 1654 // pieces of information:
1658 // - the position of the window, in screen coordinates (outer position). 1655 // - the position of the window, in screen coordinates (outer position).
1659 // - the size of the content area (inner size). 1656 // - the size of the content area (inner size).
1660 // We need to use these values to determine the appropriate size and 1657 // We need to use these values to determine the appropriate size and
1661 // position of the resulting window. 1658 // position of the resulting window.
1662 if (IsToolbarVisible()) { 1659 if (IsToolbarVisible()) {
1663 // If we're showing the toolbar, we need to adjust |*bounds| to include 1660 // If we're showing the toolbar, we need to adjust |*bounds| to include
(...skipping 18 matching lines...) Expand all
1682 *bounds = window_rect; 1679 *bounds = window_rect;
1683 } 1680 }
1684 1681
1685 // We return true because we can _always_ locate reasonable bounds using the 1682 // We return true because we can _always_ locate reasonable bounds using the
1686 // WindowSizer, and we don't want to trigger the Window's built-in "size to 1683 // WindowSizer, and we don't want to trigger the Window's built-in "size to
1687 // default" handling because the browser window has no default preferred 1684 // default" handling because the browser window has no default preferred
1688 // size. 1685 // size.
1689 return true; 1686 return true;
1690 } 1687 }
1691 1688
1692 bool BrowserView::GetSavedMaximizedState(bool* maximized) const {
1693 // TODO(dhollowa): Add support for session restore of minimized state.
1694 // http://crbug.com/43274
1695 *maximized = browser_->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED;
1696 return true;
1697 }
1698
1699 views::View* BrowserView::GetContentsView() { 1689 views::View* BrowserView::GetContentsView() {
1700 return contents_container_; 1690 return contents_container_;
1701 } 1691 }
1702 1692
1703 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { 1693 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) {
1704 return this; 1694 return this;
1705 } 1695 }
1706 1696
1707 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, 1697 void BrowserView::OnWidgetActivationChanged(views::Widget* widget,
1708 bool active) { 1698 bool active) {
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2674 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2685 // Create the view and the frame. The frame will attach itself via the view 2675 // Create the view and the frame. The frame will attach itself via the view
2686 // so we don't need to do anything with the pointer. 2676 // so we don't need to do anything with the pointer.
2687 BrowserView* view = new BrowserView(browser); 2677 BrowserView* view = new BrowserView(browser);
2688 (new BrowserFrame(view))->InitBrowserFrame(); 2678 (new BrowserFrame(view))->InitBrowserFrame();
2689 view->GetWidget()->non_client_view()->SetAccessibleName( 2679 view->GetWidget()->non_client_view()->SetAccessibleName(
2690 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 2680 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
2691 return view; 2681 return view;
2692 } 2682 }
2693 #endif 2683 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/menu_model_adapter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698