Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 #include "grit/webkit_resources.h" | 109 #include "grit/webkit_resources.h" |
| 110 #include "ui/base/accelerators/accelerator.h" | 110 #include "ui/base/accelerators/accelerator.h" |
| 111 #include "ui/base/accessibility/accessible_view_state.h" | 111 #include "ui/base/accessibility/accessible_view_state.h" |
| 112 #include "ui/base/hit_test.h" | 112 #include "ui/base/hit_test.h" |
| 113 #include "ui/base/l10n/l10n_util.h" | 113 #include "ui/base/l10n/l10n_util.h" |
| 114 #include "ui/base/resource/resource_bundle.h" | 114 #include "ui/base/resource/resource_bundle.h" |
| 115 #include "ui/base/theme_provider.h" | 115 #include "ui/base/theme_provider.h" |
| 116 #include "ui/events/event_utils.h" | 116 #include "ui/events/event_utils.h" |
| 117 #include "ui/gfx/canvas.h" | 117 #include "ui/gfx/canvas.h" |
| 118 #include "ui/gfx/color_utils.h" | 118 #include "ui/gfx/color_utils.h" |
| 119 #include "ui/gfx/icon_util.h" | |
| 119 #include "ui/gfx/sys_color_change_listener.h" | 120 #include "ui/gfx/sys_color_change_listener.h" |
| 120 #include "ui/views/controls/button/menu_button.h" | 121 #include "ui/views/controls/button/menu_button.h" |
| 121 #include "ui/views/controls/single_split_view.h" | 122 #include "ui/views/controls/single_split_view.h" |
| 122 #include "ui/views/controls/textfield/textfield.h" | 123 #include "ui/views/controls/textfield/textfield.h" |
| 123 #include "ui/views/controls/webview/webview.h" | 124 #include "ui/views/controls/webview/webview.h" |
| 124 #include "ui/views/focus/external_focus_tracker.h" | 125 #include "ui/views/focus/external_focus_tracker.h" |
| 125 #include "ui/views/focus/view_storage.h" | 126 #include "ui/views/focus/view_storage.h" |
| 126 #include "ui/views/layout/grid_layout.h" | 127 #include "ui/views/layout/grid_layout.h" |
| 127 #include "ui/views/widget/native_widget.h" | 128 #include "ui/views/widget/native_widget.h" |
| 128 #include "ui/views/widget/root_view.h" | 129 #include "ui/views/widget/root_view.h" |
| (...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1566 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; | 1567 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; |
| 1567 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) | 1568 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) |
| 1568 return gfx::ImageSkia::CreateFrom1xBitmap( | 1569 return gfx::ImageSkia::CreateFrom1xBitmap( |
| 1569 *extensions_tab_helper->GetExtensionAppIcon()); | 1570 *extensions_tab_helper->GetExtensionAppIcon()); |
| 1570 } | 1571 } |
| 1571 | 1572 |
| 1572 return GetWindowIcon(); | 1573 return GetWindowIcon(); |
| 1573 } | 1574 } |
| 1574 | 1575 |
| 1575 gfx::ImageSkia BrowserView::GetWindowIcon() { | 1576 gfx::ImageSkia BrowserView::GetWindowIcon() { |
| 1576 if (browser_->is_app() || browser_->is_type_popup()) | 1577 if (browser_->is_app() || browser_->is_type_popup()) { |
|
benwells
2013/11/13 21:55:17
It seems strange that the hosted app tab helper is
calamity
2013/11/15 04:25:50
According to https://code.google.com/p/chromium/is
| |
| 1577 return browser_->GetCurrentPageIcon().AsImageSkia(); | 1578 // Use IconUtil::kMediumIconSize as it is the size used for the Alt+Tab |
| 1579 // icon. | |
| 1580 const gfx::Image* icon = | |
| 1581 browser_->GetCurrentPageIcon(IconUtil::kMediumIconSize); | |
| 1582 if (icon) | |
| 1583 return icon->AsImageSkia(); | |
| 1584 } | |
| 1578 return gfx::ImageSkia(); | 1585 return gfx::ImageSkia(); |
| 1579 } | 1586 } |
| 1580 | 1587 |
| 1581 bool BrowserView::ShouldShowWindowIcon() const { | 1588 bool BrowserView::ShouldShowWindowIcon() const { |
| 1582 // For Ash only, app host windows do not show an icon, crbug.com/119411. | 1589 // For Ash only, app host windows do not show an icon, crbug.com/119411. |
| 1583 // Child windows (i.e. popups) do show an icon. | 1590 // Child windows (i.e. popups) do show an icon. |
| 1584 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1591 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
| 1585 browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1592 browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) |
| 1586 return false; | 1593 return false; |
| 1587 | 1594 |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2699 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2706 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2700 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2707 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2701 LocationBarView::kIconInternalPadding + 1); | 2708 LocationBarView::kIconInternalPadding + 1); |
| 2702 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2709 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2703 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2710 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2704 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2711 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2705 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2712 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2706 } | 2713 } |
| 2707 return top_arrow_height; | 2714 return top_arrow_height; |
| 2708 } | 2715 } |
| OLD | NEW |