OLD | NEW |
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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 } | 776 } |
777 | 777 |
778 gfx::Rect BrowserView::GetBounds() const { | 778 gfx::Rect BrowserView::GetBounds() const { |
779 return frame_->GetWindowScreenBounds(); | 779 return frame_->GetWindowScreenBounds(); |
780 } | 780 } |
781 | 781 |
782 bool BrowserView::IsMaximized() const { | 782 bool BrowserView::IsMaximized() const { |
783 return frame_->IsMaximized(); | 783 return frame_->IsMaximized(); |
784 } | 784 } |
785 | 785 |
| 786 bool BrowserView::IsMinimized() const { |
| 787 // TODO(dhollowa): Add support for session restore of minimized state. |
| 788 // http://crbug.com/43274 |
| 789 return false; |
| 790 } |
| 791 |
786 void BrowserView::SetFullscreen(bool fullscreen) { | 792 void BrowserView::SetFullscreen(bool fullscreen) { |
787 if (IsFullscreen() == fullscreen) | 793 if (IsFullscreen() == fullscreen) |
788 return; // Nothing to do. | 794 return; // Nothing to do. |
789 | 795 |
790 #if defined(OS_WIN) | 796 #if defined(OS_WIN) |
791 ProcessFullscreen(fullscreen); | 797 ProcessFullscreen(fullscreen); |
792 #else | 798 #else |
793 // On Linux changing fullscreen is async. Ask the window to change it's | 799 // On Linux changing fullscreen is async. Ask the window to change it's |
794 // fullscreen state, and when done invoke ProcessFullscreen. | 800 // fullscreen state, and when done invoke ProcessFullscreen. |
795 frame_->SetFullscreen(fullscreen); | 801 frame_->SetFullscreen(fullscreen); |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 | 1622 |
1617 return browser_->ExecuteCommandIfEnabled(command_id); | 1623 return browser_->ExecuteCommandIfEnabled(command_id); |
1618 } | 1624 } |
1619 | 1625 |
1620 std::wstring BrowserView::GetWindowName() const { | 1626 std::wstring BrowserView::GetWindowName() const { |
1621 return UTF8ToWide(browser_->GetWindowPlacementKey()); | 1627 return UTF8ToWide(browser_->GetWindowPlacementKey()); |
1622 } | 1628 } |
1623 | 1629 |
1624 void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, | 1630 void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, |
1625 bool maximized) { | 1631 bool maximized) { |
| 1632 // TODO(dhollowa): Add support for session restore of minimized state. |
| 1633 // http://crbug.com/43274 |
| 1634 |
1626 // If IsFullscreen() is true, we've just changed into fullscreen mode, and | 1635 // If IsFullscreen() is true, we've just changed into fullscreen mode, and |
1627 // we're catching the going-into-fullscreen sizing and positioning calls, | 1636 // we're catching the going-into-fullscreen sizing and positioning calls, |
1628 // which we want to ignore. | 1637 // which we want to ignore. |
1629 if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) { | 1638 if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) { |
1630 WidgetDelegate::SaveWindowPlacement(bounds, maximized); | 1639 WidgetDelegate::SaveWindowPlacement(bounds, maximized); |
1631 browser_->SaveWindowPlacement(bounds, maximized); | 1640 browser_->SaveWindowPlacement(bounds, |
| 1641 maximized ? ui::SHOW_STATE_MAXIMIZED : |
| 1642 ui::SHOW_STATE_NORMAL); |
1632 } | 1643 } |
1633 } | 1644 } |
1634 | 1645 |
1635 bool BrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { | 1646 bool BrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { |
1636 *bounds = browser_->GetSavedWindowBounds(); | 1647 *bounds = browser_->GetSavedWindowBounds(); |
1637 if (browser_->is_type_popup() || browser_->is_type_panel()) { | 1648 if (browser_->is_type_popup() || browser_->is_type_panel()) { |
1638 // We are a popup window. The value passed in |bounds| represents two | 1649 // We are a popup window. The value passed in |bounds| represents two |
1639 // pieces of information: | 1650 // pieces of information: |
1640 // - the position of the window, in screen coordinates (outer position). | 1651 // - the position of the window, in screen coordinates (outer position). |
1641 // - the size of the content area (inner size). | 1652 // - the size of the content area (inner size). |
(...skipping 23 matching lines...) Expand all Loading... |
1665 } | 1676 } |
1666 | 1677 |
1667 // We return true because we can _always_ locate reasonable bounds using the | 1678 // We return true because we can _always_ locate reasonable bounds using the |
1668 // WindowSizer, and we don't want to trigger the Window's built-in "size to | 1679 // WindowSizer, and we don't want to trigger the Window's built-in "size to |
1669 // default" handling because the browser window has no default preferred | 1680 // default" handling because the browser window has no default preferred |
1670 // size. | 1681 // size. |
1671 return true; | 1682 return true; |
1672 } | 1683 } |
1673 | 1684 |
1674 bool BrowserView::GetSavedMaximizedState(bool* maximized) const { | 1685 bool BrowserView::GetSavedMaximizedState(bool* maximized) const { |
1675 *maximized = browser_->GetSavedMaximizedState(); | 1686 // TODO(dhollowa): Add support for session restore of minimized state. |
| 1687 // http://crbug.com/43274 |
| 1688 *maximized = browser_->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED; |
1676 return true; | 1689 return true; |
1677 } | 1690 } |
1678 | 1691 |
1679 views::View* BrowserView::GetContentsView() { | 1692 views::View* BrowserView::GetContentsView() { |
1680 return contents_container_; | 1693 return contents_container_; |
1681 } | 1694 } |
1682 | 1695 |
1683 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { | 1696 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { |
1684 return this; | 1697 return this; |
1685 } | 1698 } |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2664 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2677 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2665 // Create the view and the frame. The frame will attach itself via the view | 2678 // Create the view and the frame. The frame will attach itself via the view |
2666 // so we don't need to do anything with the pointer. | 2679 // so we don't need to do anything with the pointer. |
2667 BrowserView* view = new BrowserView(browser); | 2680 BrowserView* view = new BrowserView(browser); |
2668 (new BrowserFrame(view))->InitBrowserFrame(); | 2681 (new BrowserFrame(view))->InitBrowserFrame(); |
2669 view->GetWidget()->non_client_view()->SetAccessibleName( | 2682 view->GetWidget()->non_client_view()->SetAccessibleName( |
2670 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2683 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2671 return view; | 2684 return view; |
2672 } | 2685 } |
2673 #endif | 2686 #endif |
OLD | NEW |