diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-11 01:04:29 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-11 01:04:29 +0000 |
commit | c14f804a0a96cbf54f5fb4eda9e791baf0c74116 (patch) | |
tree | 94a43581ee4bf8cb4e43c0636a9bc2f2723e5e6a /chrome | |
parent | 2255ea5ac77019d393c7776b387385565a9d3087 (diff) | |
download | chromium_src-c14f804a0a96cbf54f5fb4eda9e791baf0c74116.zip chromium_src-c14f804a0a96cbf54f5fb4eda9e791baf0c74116.tar.gz chromium_src-c14f804a0a96cbf54f5fb4eda9e791baf0c74116.tar.bz2 |
Add incognito icon to vista frame windows that are incognito.
http://crbug.com/2471
Review URL: http://codereview.chromium.org/7250
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3264 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/frame/aero_glass_non_client_view.cc | 46 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_non_client_view.h | 5 |
2 files changed, 48 insertions, 3 deletions
diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index 932be79..f120a6d 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -110,6 +110,17 @@ static const int kPixel = 1; static const int kWindowSizingBorderSize = 8; // The size (width/height) of the window icon. static const int kWindowIconSize = 16; +// The distance from the left of the window of the OTR avatar icon. +static const int kOTRAvatarIconMargin = 9; +// The distance from the right edge of the OTR avatar icon to the left edge of +// the TabStrip. +static const int kOTRAvatarIconTabStripSpacing = 6; +// The distance from the top of the window of the OTR avatar icon when the +// window is maximized. +static const int kNoTitleOTRTopSpacing = 23; +// The distance from the top of the window of the OTR avatar icon when the +// window is maximized. +static const int kNoTitleOTRZoomedTopSpacing = 3; /////////////////////////////////////////////////////////////////////////////// // AeroGlassNonClientView, public: @@ -127,7 +138,8 @@ AeroGlassNonClientView::~AeroGlassNonClientView() { gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { // If we are maximized, the tab strip will be in line with the window // controls, so we need to make sure they don't overlap. - int tabstrip_width = browser_view_->width(); + int tabstrip_width = browser_view_->width() - otr_avatar_bounds_.width() - + kOTRAvatarIconTabStripSpacing; if(frame_->IsMaximized()) { TITLEBARINFOEX titlebar_info; titlebar_info.cbSize = sizeof(TITLEBARINFOEX); @@ -138,8 +150,9 @@ gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { tabstrip_width -= (tabstrip_width - titlebar_info.rgrect[2].left); } int tabstrip_height = tabstrip->GetPreferredHeight(); + int tabstrip_x = otr_avatar_bounds_.width() + kOTRAvatarIconTabStripSpacing; int tabstrip_y = frame_->IsMaximized() ? 0 : kTabStripY; - return gfx::Rect(0, tabstrip_y, tabstrip_width, tabstrip_height); + return gfx::Rect(tabstrip_x, tabstrip_y, tabstrip_width, tabstrip_height); } /////////////////////////////////////////////////////////////////////////////// @@ -215,6 +228,7 @@ void AeroGlassNonClientView::EnableClose(bool enable) { // AeroGlassNonClientView, ChromeViews::View overrides: void AeroGlassNonClientView::Paint(ChromeCanvas* canvas) { + PaintOTRAvatar(canvas); PaintDistributorLogo(canvas); if (browser_view_->IsToolbarVisible()) { PaintToolbarBackground(canvas); @@ -223,6 +237,7 @@ void AeroGlassNonClientView::Paint(ChromeCanvas* canvas) { } void AeroGlassNonClientView::Layout() { + LayoutOTRAvatar(); LayoutDistributorLogo(); LayoutClientView(); } @@ -254,10 +269,18 @@ void AeroGlassNonClientView::ViewHierarchyChanged(bool is_add, int AeroGlassNonClientView::CalculateNonClientTopHeight() const { if (frame_->window_delegate()->ShouldShowWindowTitle()) - return browser_view_->IsToolbarVisible() ? 2 : 0; + return browser_view_->IsToolbarVisible() ? 0 : 0; return kNoTitleTopSpacing; } +void AeroGlassNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) { + if (browser_view_->ShouldShowOffTheRecordAvatar()) { + int icon_x = MirroredLeftPointForRect(otr_avatar_bounds_); + canvas->DrawBitmapInt(browser_view_->GetOTRAvatarIcon(), icon_x, + otr_avatar_bounds_.y()); + } +} + void AeroGlassNonClientView::PaintDistributorLogo(ChromeCanvas* canvas) { // The distributor logo is only painted when the frame is not maximized and // when we actually have a logo. @@ -356,6 +379,23 @@ void AeroGlassNonClientView::PaintClientEdge(ChromeCanvas* canvas) { kPixel - fudge); } +void AeroGlassNonClientView::LayoutOTRAvatar() { + int otr_x = 0; + int top_spacing = frame_->IsMaximized() ? kNoTitleOTRZoomedTopSpacing + : kNoTitleOTRTopSpacing; + int otr_y = browser_view_->GetTabStripHeight() + top_spacing; + int otr_width = 0; + int otr_height = 0; + if (browser_view_->ShouldShowOffTheRecordAvatar()) { + SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon(); + otr_width = otr_avatar_icon.width(); + otr_height = otr_avatar_icon.height(); + otr_x = kOTRAvatarIconMargin; + otr_y -= otr_avatar_icon.height() + 2; + } + otr_avatar_bounds_.SetRect(otr_x, otr_y, otr_width, otr_height); +} + void AeroGlassNonClientView::LayoutDistributorLogo() { if (distributor_logo_.empty()) return; diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.h b/chrome/browser/views/frame/aero_glass_non_client_view.h index cb39fae..530b3c1 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.h +++ b/chrome/browser/views/frame/aero_glass_non_client_view.h @@ -45,17 +45,22 @@ class AeroGlassNonClientView : public ChromeViews::NonClientView { int CalculateNonClientTopHeight() const; // Paint various sub-components of this view. + void PaintOTRAvatar(ChromeCanvas* canvas); void PaintDistributorLogo(ChromeCanvas* canvas); void PaintToolbarBackground(ChromeCanvas* canvas); void PaintClientEdge(ChromeCanvas* canvas); // Layout various sub-components of this view. + void LayoutOTRAvatar(); void LayoutDistributorLogo(); void LayoutClientView(); // The layout rect of the distributor logo, if visible. gfx::Rect logo_bounds_; + // The layout rect of the OTR avatar. + gfx::Rect otr_avatar_bounds_; + // The frame that hosts this view. AeroGlassFrame* frame_; |