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 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1629 | 1629 |
1630 std::wstring BrowserView::GetWindowName() const { | 1630 std::wstring BrowserView::GetWindowName() const { |
1631 return UTF8ToWide(browser_->GetWindowPlacementKey()); | 1631 return UTF8ToWide(browser_->GetWindowPlacementKey()); |
1632 } | 1632 } |
1633 | 1633 |
1634 void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, | 1634 void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, |
1635 ui::WindowShowState show_state) { | 1635 ui::WindowShowState show_state) { |
1636 // 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 |
1637 // we're catching the going-into-fullscreen sizing and positioning calls, | 1637 // we're catching the going-into-fullscreen sizing and positioning calls, |
1638 // which we want to ignore. | 1638 // which we want to ignore. |
1639 if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) { | 1639 if (!IsFullscreen() && |
1640 (browser_->ShouldSaveWindowPlacement() || browser_->is_app())) { | |
Ben Goodger (Google)
2011/11/07 20:47:21
BTW, upon further consideration I realize this is
| |
1640 WidgetDelegate::SaveWindowPlacement(bounds, show_state); | 1641 WidgetDelegate::SaveWindowPlacement(bounds, show_state); |
1641 browser_->SaveWindowPlacement(bounds, show_state); | 1642 browser_->SaveWindowPlacement(bounds, show_state); |
1642 } | 1643 } |
1643 } | 1644 } |
1644 | 1645 |
1645 bool BrowserView::GetSavedWindowPlacement( | 1646 bool BrowserView::GetSavedWindowPlacement( |
1646 gfx::Rect* bounds, | 1647 gfx::Rect* bounds, |
1647 ui::WindowShowState* show_state) const { | 1648 ui::WindowShowState* show_state) const { |
1648 *bounds = browser_->GetSavedWindowBounds(); | 1649 *bounds = browser_->GetSavedWindowBounds(); |
1649 *show_state = browser_->GetSavedWindowShowState(); | 1650 *show_state = browser_->GetSavedWindowShowState(); |
1650 | 1651 |
1651 if ((browser_->is_type_popup() || browser_->is_type_panel()) | 1652 if ((browser_->is_type_popup() || browser_->is_type_panel()) |
1652 && !browser_->is_devtools()) { | 1653 && !browser_->is_devtools() && !browser_->is_app()) { |
1653 // We are a popup window. The value passed in |bounds| represents two | 1654 // We are a popup window. The value passed in |bounds| represents two |
1654 // pieces of information: | 1655 // pieces of information: |
1655 // - the position of the window, in screen coordinates (outer position). | 1656 // - the position of the window, in screen coordinates (outer position). |
1656 // - the size of the content area (inner size). | 1657 // - the size of the content area (inner size). |
1657 // We need to use these values to determine the appropriate size and | 1658 // We need to use these values to determine the appropriate size and |
1658 // position of the resulting window. | 1659 // position of the resulting window. |
1659 if (IsToolbarVisible()) { | 1660 if (IsToolbarVisible()) { |
1660 // If we're showing the toolbar, we need to adjust |*bounds| to include | 1661 // If we're showing the toolbar, we need to adjust |*bounds| to include |
1661 // its desired height, since the toolbar is considered part of the | 1662 // its desired height, since the toolbar is considered part of the |
1662 // window's client area as far as GetWindowBoundsForClientBounds is | 1663 // window's client area as far as GetWindowBoundsForClientBounds is |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2674 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2675 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2675 // 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 |
2676 // so we don't need to do anything with the pointer. | 2677 // so we don't need to do anything with the pointer. |
2677 BrowserView* view = new BrowserView(browser); | 2678 BrowserView* view = new BrowserView(browser); |
2678 (new BrowserFrame(view))->InitBrowserFrame(); | 2679 (new BrowserFrame(view))->InitBrowserFrame(); |
2679 view->GetWidget()->non_client_view()->SetAccessibleName( | 2680 view->GetWidget()->non_client_view()->SetAccessibleName( |
2680 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2681 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2681 return view; | 2682 return view; |
2682 } | 2683 } |
2683 #endif | 2684 #endif |
OLD | NEW |