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; | |
sky
2011/08/19 16:59:54
You should be able to call into frame_->IsMinimize
dhollowa
2011/08/19 17:58:53
Yes, I'd like to wait until I have both save/resto
| |
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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) { |
1626 // If IsFullscreen() is true, we've just changed into fullscreen mode, and | 1632 // If IsFullscreen() is true, we've just changed into fullscreen mode, and |
1627 // we're catching the going-into-fullscreen sizing and positioning calls, | 1633 // we're catching the going-into-fullscreen sizing and positioning calls, |
1628 // which we want to ignore. | 1634 // which we want to ignore. |
1629 if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) { | 1635 if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) { |
1630 WidgetDelegate::SaveWindowPlacement(bounds, maximized); | 1636 WidgetDelegate::SaveWindowPlacement(bounds, maximized); |
1631 browser_->SaveWindowPlacement(bounds, maximized); | 1637 browser_->SaveWindowPlacement(bounds, |
sky
2011/08/19 16:59:54
Can you add a TODO to update this as well.
dhollowa
2011/08/19 17:58:53
Done.
| |
1638 maximized ? ui::SHOW_STATE_MAXIMIZED : | |
1639 ui::SHOW_STATE_NORMAL); | |
1632 } | 1640 } |
1633 } | 1641 } |
1634 | 1642 |
1635 bool BrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { | 1643 bool BrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { |
1636 *bounds = browser_->GetSavedWindowBounds(); | 1644 *bounds = browser_->GetSavedWindowBounds(); |
1637 if (browser_->is_type_popup() || browser_->is_type_panel()) { | 1645 if (browser_->is_type_popup() || browser_->is_type_panel()) { |
1638 // We are a popup window. The value passed in |bounds| represents two | 1646 // We are a popup window. The value passed in |bounds| represents two |
1639 // pieces of information: | 1647 // pieces of information: |
1640 // - the position of the window, in screen coordinates (outer position). | 1648 // - the position of the window, in screen coordinates (outer position). |
1641 // - the size of the content area (inner size). | 1649 // - the size of the content area (inner size). |
(...skipping 23 matching lines...) Expand all Loading... | |
1665 } | 1673 } |
1666 | 1674 |
1667 // We return true because we can _always_ locate reasonable bounds using the | 1675 // 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 | 1676 // 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 | 1677 // default" handling because the browser window has no default preferred |
1670 // size. | 1678 // size. |
1671 return true; | 1679 return true; |
1672 } | 1680 } |
1673 | 1681 |
1674 bool BrowserView::GetSavedMaximizedState(bool* maximized) const { | 1682 bool BrowserView::GetSavedMaximizedState(bool* maximized) const { |
1675 *maximized = browser_->GetSavedMaximizedState(); | 1683 *maximized = browser_->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED; |
sky
2011/08/19 16:59:54
And a TODO here too.
dhollowa
2011/08/19 17:58:53
Done.
| |
1676 return true; | 1684 return true; |
1677 } | 1685 } |
1678 | 1686 |
1679 views::View* BrowserView::GetContentsView() { | 1687 views::View* BrowserView::GetContentsView() { |
1680 return contents_container_; | 1688 return contents_container_; |
1681 } | 1689 } |
1682 | 1690 |
1683 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { | 1691 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { |
1684 return this; | 1692 return this; |
1685 } | 1693 } |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2664 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2672 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2665 // Create the view and the frame. The frame will attach itself via the view | 2673 // 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. | 2674 // so we don't need to do anything with the pointer. |
2667 BrowserView* view = new BrowserView(browser); | 2675 BrowserView* view = new BrowserView(browser); |
2668 (new BrowserFrame(view))->InitBrowserFrame(); | 2676 (new BrowserFrame(view))->InitBrowserFrame(); |
2669 view->GetWidget()->non_client_view()->SetAccessibleName( | 2677 view->GetWidget()->non_client_view()->SetAccessibleName( |
2670 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2678 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2671 return view; | 2679 return view; |
2672 } | 2680 } |
2673 #endif | 2681 #endif |
OLD | NEW |