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