| 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 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 views::View* BrowserView::GetInitiallyFocusedView() { | 1537 views::View* BrowserView::GetInitiallyFocusedView() { |
| 1538 return NULL; | 1538 return NULL; |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 bool BrowserView::ShouldShowWindowTitle() const { | 1541 bool BrowserView::ShouldShowWindowTitle() const { |
| 1542 // For Ash only, trusted windows (apps and settings) do not show an icon, | 1542 // For Ash only, trusted windows (apps and settings) do not show an icon, |
| 1543 // crbug.com/119411. Child windows (i.e. popups) do show an icon. | 1543 // crbug.com/119411. Child windows (i.e. popups) do show an icon. |
| 1544 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1544 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
| 1545 browser_->is_trusted_source()) | 1545 browser_->is_trusted_source() && |
| 1546 !(browser_->is_app() && |
| 1547 CommandLine::ForCurrentProcess()->HasSwitch( |
| 1548 switches::kEnableStreamlinedHostedApps))) |
| 1546 return false; | 1549 return false; |
| 1547 | 1550 |
| 1548 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1551 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
| 1549 } | 1552 } |
| 1550 | 1553 |
| 1551 gfx::ImageSkia BrowserView::GetWindowAppIcon() { | 1554 gfx::ImageSkia BrowserView::GetWindowAppIcon() { |
| 1552 if (browser_->is_app()) { | 1555 if (browser_->is_app()) { |
| 1553 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); | 1556 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); |
| 1554 extensions::TabHelper* extensions_tab_helper = | 1557 extensions::TabHelper* extensions_tab_helper = |
| 1555 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; | 1558 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; |
| 1556 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) | 1559 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) |
| 1557 return gfx::ImageSkia::CreateFrom1xBitmap( | 1560 return gfx::ImageSkia::CreateFrom1xBitmap( |
| 1558 *extensions_tab_helper->GetExtensionAppIcon()); | 1561 *extensions_tab_helper->GetExtensionAppIcon()); |
| 1559 } | 1562 } |
| 1560 | 1563 |
| 1561 return GetWindowIcon(); | 1564 return GetWindowIcon(); |
| 1562 } | 1565 } |
| 1563 | 1566 |
| 1564 gfx::ImageSkia BrowserView::GetWindowIcon() { | 1567 gfx::ImageSkia BrowserView::GetWindowIcon() { |
| 1565 if (browser_->is_app() || browser_->is_type_popup()) | 1568 if (browser_->is_app() || browser_->is_type_popup()) |
| 1566 return browser_->GetCurrentPageIcon().AsImageSkia(); | 1569 return browser_->GetCurrentPageIcon().AsImageSkia(); |
| 1567 return gfx::ImageSkia(); | 1570 return gfx::ImageSkia(); |
| 1568 } | 1571 } |
| 1569 | 1572 |
| 1570 bool BrowserView::ShouldShowWindowIcon() const { | 1573 bool BrowserView::ShouldShowWindowIcon() const { |
| 1571 // For Ash only, trusted windows (apps and settings) do not show an icon, | 1574 // For Ash only, trusted windows (apps and settings) do not show an icon, |
| 1572 // crbug.com/119411. Child windows (i.e. popups) do show an icon. | 1575 // crbug.com/119411. Child windows (i.e. popups) do show an icon. |
| 1573 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1576 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
| 1574 browser_->is_trusted_source()) | 1577 browser_->is_trusted_source() && |
| 1578 !(browser_->is_app() && |
| 1579 CommandLine::ForCurrentProcess()->HasSwitch( |
| 1580 switches::kEnableStreamlinedHostedApps))) |
| 1575 return false; | 1581 return false; |
| 1576 | 1582 |
| 1577 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1583 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
| 1578 } | 1584 } |
| 1579 | 1585 |
| 1580 bool BrowserView::ExecuteWindowsCommand(int command_id) { | 1586 bool BrowserView::ExecuteWindowsCommand(int command_id) { |
| 1581 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. | 1587 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. |
| 1582 #if defined(OS_WIN) | 1588 #if defined(OS_WIN) |
| 1583 if (command_id == IDC_DEBUG_FRAME_TOGGLE) | 1589 if (command_id == IDC_DEBUG_FRAME_TOGGLE) |
| 1584 GetWidget()->DebugToggleFrameType(); | 1590 GetWidget()->DebugToggleFrameType(); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2541 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2536 gfx::Point icon_bottom( | 2542 gfx::Point icon_bottom( |
| 2537 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2543 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2538 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2544 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2539 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2545 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2540 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2546 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2541 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2547 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2542 } | 2548 } |
| 2543 return top_arrow_height; | 2549 return top_arrow_height; |
| 2544 } | 2550 } |
| OLD | NEW |