| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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::GetSavedWindowBounds(gfx::Rect* bounds) const { |
| 1653 *bounds = browser_->GetSavedWindowBounds(); | 1646 *bounds = browser_->GetSavedWindowBounds(); |
| 1654 if (browser_->is_type_popup() || browser_->is_type_panel()) { | 1647 if (browser_->is_type_popup() || browser_->is_type_panel()) { |
| 1655 // We are a popup window. The value passed in |bounds| represents two | 1648 // We are a popup window. The value passed in |bounds| represents two |
| 1656 // pieces of information: | 1649 // pieces of information: |
| 1657 // - the position of the window, in screen coordinates (outer position). | 1650 // - the position of the window, in screen coordinates (outer position). |
| 1658 // - the size of the content area (inner size). | 1651 // - the size of the content area (inner size). |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1681 *bounds = window_rect; | 1674 *bounds = window_rect; |
| 1682 } | 1675 } |
| 1683 | 1676 |
| 1684 // We return true because we can _always_ locate reasonable bounds using the | 1677 // 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 | 1678 // 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 | 1679 // default" handling because the browser window has no default preferred |
| 1687 // size. | 1680 // size. |
| 1688 return true; | 1681 return true; |
| 1689 } | 1682 } |
| 1690 | 1683 |
| 1691 bool BrowserView::GetSavedMaximizedState(bool* maximized) const { | 1684 bool BrowserView::GetSavedWindowShowState( |
| 1692 // TODO(dhollowa): Add support for session restore of minimized state. | 1685 ui::WindowShowState* show_state) const { |
| 1693 // http://crbug.com/43274 | 1686 *show_state = browser_->GetSavedWindowShowState(); |
| 1694 *maximized = browser_->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED; | |
| 1695 return true; | 1687 return true; |
| 1696 } | 1688 } |
| 1697 | 1689 |
| 1698 views::View* BrowserView::GetContentsView() { | 1690 views::View* BrowserView::GetContentsView() { |
| 1699 return contents_container_; | 1691 return contents_container_; |
| 1700 } | 1692 } |
| 1701 | 1693 |
| 1702 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { | 1694 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { |
| 1703 return this; | 1695 return this; |
| 1704 } | 1696 } |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2675 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2684 // Create the view and the frame. The frame will attach itself via the view | 2676 // 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. | 2677 // so we don't need to do anything with the pointer. |
| 2686 BrowserView* view = new BrowserView(browser); | 2678 BrowserView* view = new BrowserView(browser); |
| 2687 (new BrowserFrame(view))->InitBrowserFrame(); | 2679 (new BrowserFrame(view))->InitBrowserFrame(); |
| 2688 view->GetWidget()->non_client_view()->SetAccessibleName( | 2680 view->GetWidget()->non_client_view()->SetAccessibleName( |
| 2689 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2681 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2690 return view; | 2682 return view; |
| 2691 } | 2683 } |
| 2692 #endif | 2684 #endif |
| OLD | NEW |