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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 using web_modal::WebContentsModalDialogHost; | 169 using web_modal::WebContentsModalDialogHost; |
| 170 | 170 |
| 171 namespace { | 171 namespace { |
| 172 // The name of a key to store on the window handle so that other code can | 172 // The name of a key to store on the window handle so that other code can |
| 173 // locate this object using just the handle. | 173 // locate this object using just the handle. |
| 174 const char* const kBrowserViewKey = "__BROWSER_VIEW__"; | 174 const char* const kBrowserViewKey = "__BROWSER_VIEW__"; |
| 175 | 175 |
| 176 // The number of milliseconds between loading animation frames. | 176 // The number of milliseconds between loading animation frames. |
| 177 const int kLoadingAnimationFrameTimeMs = 30; | 177 const int kLoadingAnimationFrameTimeMs = 30; |
| 178 | 178 |
| 179 // The size of the window icon in pixels. | |
|
tapted
2013/11/11 08:52:57
Are these device-independent pixels? (ImageFamily
calamity
2013/11/13 06:37:14
Removed.
| |
| 180 const int kWindowIconSize = 32; | |
|
tapted
2013/11/11 08:52:57
I wonder if this should be IconUtil::kMediumIconSi
calamity
2013/11/13 06:37:14
Done.
| |
| 181 | |
| 179 // TODO(kuan): These functions are temporarily for the bookmark bar while its | 182 // TODO(kuan): These functions are temporarily for the bookmark bar while its |
| 180 // detached state is at the top of the page; it'll be moved to float on the | 183 // detached state is at the top of the page; it'll be moved to float on the |
| 181 // content page in the very near future, at which time, these local functions | 184 // content page in the very near future, at which time, these local functions |
| 182 // will be removed. | 185 // will be removed. |
| 183 void PaintDetachedBookmarkBar(gfx::Canvas* canvas, | 186 void PaintDetachedBookmarkBar(gfx::Canvas* canvas, |
| 184 DetachableToolbarView* view, | 187 DetachableToolbarView* view, |
| 185 ThemeService* theme_service) { | 188 ThemeService* theme_service) { |
| 186 // Paint background for detached state; if animating, this is fade in/out. | 189 // Paint background for detached state; if animating, this is fade in/out. |
| 187 canvas->DrawColor( | 190 canvas->DrawColor( |
| 188 chrome::GetDetachedBookmarkBarBackgroundColor(theme_service)); | 191 chrome::GetDetachedBookmarkBarBackgroundColor(theme_service)); |
| (...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1560 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) | 1563 if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon()) |
| 1561 return gfx::ImageSkia::CreateFrom1xBitmap( | 1564 return gfx::ImageSkia::CreateFrom1xBitmap( |
| 1562 *extensions_tab_helper->GetExtensionAppIcon()); | 1565 *extensions_tab_helper->GetExtensionAppIcon()); |
| 1563 } | 1566 } |
| 1564 | 1567 |
| 1565 return GetWindowIcon(); | 1568 return GetWindowIcon(); |
| 1566 } | 1569 } |
| 1567 | 1570 |
| 1568 gfx::ImageSkia BrowserView::GetWindowIcon() { | 1571 gfx::ImageSkia BrowserView::GetWindowIcon() { |
| 1569 if (browser_->is_app() || browser_->is_type_popup()) | 1572 if (browser_->is_app() || browser_->is_type_popup()) |
| 1570 return browser_->GetCurrentPageIcon().AsImageSkia(); | 1573 return browser_->GetCurrentPageIcon(kWindowIconSize).AsImageSkia(); |
|
tapted
2013/11/11 08:52:57
Looks like c/b/ui/gtk/browser_titlebar.cc might us
calamity
2013/11/13 06:37:14
Fixed it just in case.
| |
| 1571 return gfx::ImageSkia(); | 1574 return gfx::ImageSkia(); |
| 1572 } | 1575 } |
| 1573 | 1576 |
| 1574 bool BrowserView::ShouldShowWindowIcon() const { | 1577 bool BrowserView::ShouldShowWindowIcon() const { |
| 1575 // 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. |
| 1576 // Child windows (i.e. popups) do show an icon. | 1579 // Child windows (i.e. popups) do show an icon. |
| 1577 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1580 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
| 1578 browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1581 browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) |
| 1579 return false; | 1582 return false; |
| 1580 | 1583 |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2706 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2709 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2707 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2710 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2708 LocationBarView::kIconInternalPadding + 1); | 2711 LocationBarView::kIconInternalPadding + 1); |
| 2709 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2712 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2710 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2713 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2711 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2714 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2712 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2715 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2713 } | 2716 } |
| 2714 return top_arrow_height; | 2717 return top_arrow_height; |
| 2715 } | 2718 } |
| OLD | NEW |