| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_header_painter_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
| 6 | 6 |
| 7 #include "ash/ash_layout_constants.h" | 7 #include "ash/ash_layout_constants.h" |
| 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 9 #include "ash/frame/header_painter_util.h" | 9 #include "ash/frame/header_painter_util.h" |
| 10 #include "base/logging.h" // DCHECK | 10 #include "base/logging.h" // DCHECK |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // window_icon may be null. | 141 // window_icon may be null. |
| 142 DCHECK(caption_button_container); | 142 DCHECK(caption_button_container); |
| 143 frame_ = frame; | 143 frame_ = frame; |
| 144 | 144 |
| 145 is_tabbed_ = browser_view->browser()->is_type_tabbed(); | 145 is_tabbed_ = browser_view->browser()->is_type_tabbed(); |
| 146 is_incognito_ = !browser_view->IsRegularOrGuestSession(); | 146 is_incognito_ = !browser_view->IsRegularOrGuestSession(); |
| 147 | 147 |
| 148 view_ = header_view; | 148 view_ = header_view; |
| 149 window_icon_ = window_icon; | 149 window_icon_ = window_icon; |
| 150 caption_button_container_ = caption_button_container; | 150 caption_button_container_ = caption_button_container; |
| 151 // Use light images in otr, even when a custom theme is installed. The |
| 152 // otr window with a custom theme is still darker than a normal window. |
| 153 caption_button_container_->SetUseLightImages(is_incognito_); |
| 151 } | 154 } |
| 152 | 155 |
| 153 int BrowserHeaderPainterAsh::GetMinimumHeaderWidth() const { | 156 int BrowserHeaderPainterAsh::GetMinimumHeaderWidth() const { |
| 154 // Ensure we have enough space for the window icon and buttons. We allow | 157 // Ensure we have enough space for the window icon and buttons. We allow |
| 155 // the title string to collapse to zero width. | 158 // the title string to collapse to zero width. |
| 156 return GetTitleBounds().x() + | 159 return GetTitleBounds().x() + |
| 157 caption_button_container_->GetMinimumSize().width(); | 160 caption_button_container_->GetMinimumSize().width(); |
| 158 } | 161 } |
| 159 | 162 |
| 160 void BrowserHeaderPainterAsh::PaintHeader(gfx::Canvas* canvas, Mode mode) { | 163 void BrowserHeaderPainterAsh::PaintHeader(gfx::Canvas* canvas, Mode mode) { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 432 } |
| 430 | 433 |
| 431 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 434 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { |
| 432 return gfx::Rect(view_->width(), painted_height_); | 435 return gfx::Rect(view_->width(), painted_height_); |
| 433 } | 436 } |
| 434 | 437 |
| 435 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 438 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { |
| 436 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 439 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, |
| 437 caption_button_container_, BrowserFrame::GetTitleFontList()); | 440 caption_button_container_, BrowserFrame::GetTitleFontList()); |
| 438 } | 441 } |
| OLD | NEW |