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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 13139004: Deprecate Browser::TYPE_PANEL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 1186
1187 gfx::Rect client_rect = contents_split_->bounds(); 1187 gfx::Rect client_rect = contents_split_->bounds();
1188 gfx::Size resize_corner_size = ResizeCorner::GetSize(); 1188 gfx::Size resize_corner_size = ResizeCorner::GetSize();
1189 int x = client_rect.width() - resize_corner_size.width(); 1189 int x = client_rect.width() - resize_corner_size.width();
1190 if (base::i18n::IsRTL()) 1190 if (base::i18n::IsRTL())
1191 x = 0; 1191 x = 0;
1192 return gfx::Rect(x, client_rect.height() - resize_corner_size.height(), 1192 return gfx::Rect(x, client_rect.height() - resize_corner_size.height(),
1193 resize_corner_size.width(), resize_corner_size.height()); 1193 resize_corner_size.width(), resize_corner_size.height());
1194 } 1194 }
1195 1195
1196 bool BrowserView::IsPanel() const {
1197 return false;
1198 }
1199
1200 void BrowserView::DisableInactiveFrame() { 1196 void BrowserView::DisableInactiveFrame() {
1201 #if defined(OS_WIN) && !defined(USE_AURA) 1197 #if defined(OS_WIN) && !defined(USE_AURA)
1202 frame_->DisableInactiveRendering(); 1198 frame_->DisableInactiveRendering();
1203 #endif // No tricks are needed to get the right behavior on Linux. 1199 #endif // No tricks are needed to get the right behavior on Linux.
1204 } 1200 }
1205 1201
1206 void BrowserView::ConfirmAddSearchProvider(TemplateURL* template_url, 1202 void BrowserView::ConfirmAddSearchProvider(TemplateURL* template_url,
1207 Profile* profile) { 1203 Profile* profile) {
1208 chrome::EditSearchEngine(GetWidget()->GetNativeWindow(), template_url, NULL, 1204 chrome::EditSearchEngine(GetWidget()->GetNativeWindow(), template_url, NULL,
1209 profile); 1205 profile);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 1621
1626 views::View* BrowserView::GetInitiallyFocusedView() { 1622 views::View* BrowserView::GetInitiallyFocusedView() {
1627 // We set the frame not focus on creation so this should never be called. 1623 // We set the frame not focus on creation so this should never be called.
1628 NOTREACHED(); 1624 NOTREACHED();
1629 return NULL; 1625 return NULL;
1630 } 1626 }
1631 1627
1632 bool BrowserView::ShouldShowWindowTitle() const { 1628 bool BrowserView::ShouldShowWindowTitle() const {
1633 #if defined(USE_ASH) 1629 #if defined(USE_ASH)
1634 // For Ash only, app host windows do not show an icon, crbug.com/119411. 1630 // For Ash only, app host windows do not show an icon, crbug.com/119411.
1635 // Child windows (e.g. extension panels, popups) do show an icon. 1631 // Child windows (i.e. popups) do show an icon.
1636 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) 1632 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST)
1637 return false; 1633 return false;
1638 #endif 1634 #endif
1639 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); 1635 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
1640 } 1636 }
1641 1637
1642 gfx::ImageSkia BrowserView::GetWindowAppIcon() { 1638 gfx::ImageSkia BrowserView::GetWindowAppIcon() {
1643 if (browser_->is_app()) { 1639 if (browser_->is_app()) {
1644 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); 1640 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents();
1645 extensions::TabHelper* extensions_tab_helper = 1641 extensions::TabHelper* extensions_tab_helper =
1646 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; 1642 contents ? extensions::TabHelper::FromWebContents(contents) : NULL;
1647 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) 1643 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon())
1648 return gfx::ImageSkia::CreateFrom1xBitmap( 1644 return gfx::ImageSkia::CreateFrom1xBitmap(
1649 *extensions_tab_helper->GetExtensionAppIcon()); 1645 *extensions_tab_helper->GetExtensionAppIcon());
1650 } 1646 }
1651 1647
1652 return GetWindowIcon(); 1648 return GetWindowIcon();
1653 } 1649 }
1654 1650
1655 gfx::ImageSkia BrowserView::GetWindowIcon() { 1651 gfx::ImageSkia BrowserView::GetWindowIcon() {
1656 if (browser_->is_app()) 1652 if (browser_->is_app())
1657 return browser_->GetCurrentPageIcon().AsImageSkia(); 1653 return browser_->GetCurrentPageIcon().AsImageSkia();
1658 return gfx::ImageSkia(); 1654 return gfx::ImageSkia();
1659 } 1655 }
1660 1656
1661 bool BrowserView::ShouldShowWindowIcon() const { 1657 bool BrowserView::ShouldShowWindowIcon() const {
1662 #if defined(USE_ASH) 1658 #if defined(USE_ASH)
1663 // For Ash only, app host windows do not show an icon, crbug.com/119411. 1659 // For Ash only, app host windows do not show an icon, crbug.com/119411.
1664 // Child windows (e.g. extension panels, popups) do show an icon. 1660 // Child windows (i.e. popups) do show an icon.
1665 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) 1661 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST)
1666 return false; 1662 return false;
1667 #endif 1663 #endif
1668 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); 1664 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
1669 } 1665 }
1670 1666
1671 bool BrowserView::ExecuteWindowsCommand(int command_id) { 1667 bool BrowserView::ExecuteWindowsCommand(int command_id) {
1672 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. 1668 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND.
1673 #if defined(OS_WIN) 1669 #if defined(OS_WIN)
1674 if (command_id == IDC_DEBUG_FRAME_TOGGLE) 1670 if (command_id == IDC_DEBUG_FRAME_TOGGLE)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 bool BrowserView::GetSavedWindowPlacement( 1711 bool BrowserView::GetSavedWindowPlacement(
1716 gfx::Rect* bounds, 1712 gfx::Rect* bounds,
1717 ui::WindowShowState* show_state) const { 1713 ui::WindowShowState* show_state) const {
1718 if (!ShouldSaveOrRestoreWindowPos()) 1714 if (!ShouldSaveOrRestoreWindowPos())
1719 return false; 1715 return false;
1720 chrome::GetSavedWindowBoundsAndShowState(browser_.get(), bounds, show_state); 1716 chrome::GetSavedWindowBoundsAndShowState(browser_.get(), bounds, show_state);
1721 1717
1722 #if defined(USE_ASH) 1718 #if defined(USE_ASH)
1723 if (chrome::IsNativeWindowInAsh( 1719 if (chrome::IsNativeWindowInAsh(
1724 const_cast<BrowserView*>(this)->GetNativeWindow())) { 1720 const_cast<BrowserView*>(this)->GetNativeWindow())) {
1725 if (browser_->is_type_popup() || browser_->is_type_panel()) { 1721 if (browser_->is_type_popup()) {
1726 // In case of a popup or panel with an 'unspecified' location we are 1722 // In case of a popup with an 'unspecified' location we are
1727 // looking for a good screen location. We are interpreting (0,0) as an 1723 // looking for a good screen location. We are interpreting (0,0) as an
1728 // unspecified location. 1724 // unspecified location.
1729 if (bounds->x() == 0 && bounds->y() == 0) { 1725 if (bounds->x() == 0 && bounds->y() == 0) {
1730 *bounds = ChromeShellDelegate::instance()->window_positioner()-> 1726 *bounds = ChromeShellDelegate::instance()->window_positioner()->
1731 GetPopupPosition(*bounds); 1727 GetPopupPosition(*bounds);
1728 }
1732 } 1729 }
1733 } 1730 }
1734 }
1735 #endif 1731 #endif
1736 1732
1737 if ((browser_->is_type_popup() || browser_->is_type_panel()) && 1733 if (browser_->is_type_popup() &&
1738 bounds->width() == browser_->override_bounds().width() && 1734 bounds->width() == browser_->override_bounds().width() &&
1739 bounds->height() == browser_->override_bounds().height() && 1735 bounds->height() == browser_->override_bounds().height() &&
1740 !(browser_->is_app() && browser_->is_session_restore()) && 1736 !browser_->is_session_restore() &&
1737 !browser_->is_app() &&
1741 !browser_->is_devtools()) { 1738 !browser_->is_devtools()) {
1742 // This is neither a popup window that has not been resized nor it is not an 1739 // This is neither a popup window that has not been resized nor it is not an
1743 // application window in the session restore phase. The value passed in 1740 // application window in the session restore phase. The value passed in
1744 // |bounds| represents two pieces of information: 1741 // |bounds| represents two pieces of information:
1745 // - the position of the window, in screen coordinates (outer position). 1742 // - the position of the window, in screen coordinates (outer position).
1746 // - the size of the content area (inner size). 1743 // - the size of the content area (inner size).
1747 // We need to use these values to determine the appropriate size and 1744 // We need to use these values to determine the appropriate size and
1748 // position of the resulting window. 1745 // position of the resulting window.
1749 if (IsToolbarVisible()) { 1746 if (IsToolbarVisible()) {
1750 // If we're showing the toolbar, we need to adjust |*bounds| to include 1747 // If we're showing the toolbar, we need to adjust |*bounds| to include
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 2711
2715 Browser* modal_browser = 2712 Browser* modal_browser =
2716 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); 2713 chrome::FindBrowserWithWebContents(active_dialog->web_contents());
2717 if (modal_browser && (browser_ != modal_browser)) { 2714 if (modal_browser && (browser_ != modal_browser)) {
2718 modal_browser->window()->FlashFrame(true); 2715 modal_browser->window()->FlashFrame(true);
2719 modal_browser->window()->Activate(); 2716 modal_browser->window()->Activate();
2720 } 2717 }
2721 2718
2722 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 2719 AppModalDialogQueue::GetInstance()->ActivateModalDialog();
2723 } 2720 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698