OLD | NEW |
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 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 } | 1571 } |
1572 | 1572 |
1573 views::View* BrowserView::GetInitiallyFocusedView() { | 1573 views::View* BrowserView::GetInitiallyFocusedView() { |
1574 return NULL; | 1574 return NULL; |
1575 } | 1575 } |
1576 | 1576 |
1577 bool BrowserView::ShouldShowWindowTitle() const { | 1577 bool BrowserView::ShouldShowWindowTitle() const { |
1578 // For Ash only, app host windows do not show an icon, crbug.com/119411. | 1578 // For Ash only, app host windows do not show an icon, crbug.com/119411. |
1579 // Child windows (i.e. popups) do show an icon. | 1579 // Child windows (i.e. popups) do show an icon. |
1580 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1580 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
1581 browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1581 browser_->is_app() && |
| 1582 browser_->type() == Browser::TYPE_TRUSTED_POPUP) |
1582 return false; | 1583 return false; |
1583 | 1584 |
1584 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1585 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
1585 } | 1586 } |
1586 | 1587 |
1587 gfx::ImageSkia BrowserView::GetWindowAppIcon() { | 1588 gfx::ImageSkia BrowserView::GetWindowAppIcon() { |
1588 if (browser_->is_app()) { | 1589 if (browser_->is_app()) { |
1589 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); | 1590 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); |
1590 extensions::TabHelper* extensions_tab_helper = | 1591 extensions::TabHelper* extensions_tab_helper = |
1591 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; | 1592 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; |
1592 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) | 1593 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) |
1593 return gfx::ImageSkia::CreateFrom1xBitmap( | 1594 return gfx::ImageSkia::CreateFrom1xBitmap( |
1594 *extensions_tab_helper->GetExtensionAppIcon()); | 1595 *extensions_tab_helper->GetExtensionAppIcon()); |
1595 } | 1596 } |
1596 | 1597 |
1597 return GetWindowIcon(); | 1598 return GetWindowIcon(); |
1598 } | 1599 } |
1599 | 1600 |
1600 gfx::ImageSkia BrowserView::GetWindowIcon() { | 1601 gfx::ImageSkia BrowserView::GetWindowIcon() { |
1601 if (browser_->is_app() || browser_->is_type_popup()) | 1602 if (browser_->is_app() || browser_->is_type_popup()) |
1602 return browser_->GetCurrentPageIcon().AsImageSkia(); | 1603 return browser_->GetCurrentPageIcon().AsImageSkia(); |
1603 return gfx::ImageSkia(); | 1604 return gfx::ImageSkia(); |
1604 } | 1605 } |
1605 | 1606 |
1606 bool BrowserView::ShouldShowWindowIcon() const { | 1607 bool BrowserView::ShouldShowWindowIcon() const { |
1607 // For Ash only, app host windows do not show an icon, crbug.com/119411. | 1608 // For Ash only, app host windows do not show an icon, crbug.com/119411. |
1608 // Child windows (i.e. popups) do show an icon. | 1609 // Child windows (i.e. popups) do show an icon. |
1609 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1610 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
1610 browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1611 browser_->is_app() && |
| 1612 browser_->type() == Browser::TYPE_TRUSTED_POPUP) |
1611 return false; | 1613 return false; |
1612 | 1614 |
1613 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1615 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
1614 } | 1616 } |
1615 | 1617 |
1616 bool BrowserView::ExecuteWindowsCommand(int command_id) { | 1618 bool BrowserView::ExecuteWindowsCommand(int command_id) { |
1617 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. | 1619 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. |
1618 #if defined(OS_WIN) | 1620 #if defined(OS_WIN) |
1619 if (command_id == IDC_DEBUG_FRAME_TOGGLE) | 1621 if (command_id == IDC_DEBUG_FRAME_TOGGLE) |
1620 GetWidget()->DebugToggleFrameType(); | 1622 GetWidget()->DebugToggleFrameType(); |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2587 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2586 gfx::Point icon_bottom( | 2588 gfx::Point icon_bottom( |
2587 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2589 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2588 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2590 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2589 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2591 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2590 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2592 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2591 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2593 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2592 } | 2594 } |
2593 return top_arrow_height; | 2595 return top_arrow_height; |
2594 } | 2596 } |
OLD | NEW |