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