| 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/frame/caption_buttons/frame_caption_button_container_view.h" | 7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 
| 8 #include "ash/frame/header_painter_util.h" | 8 #include "ash/frame/header_painter_util.h" | 
| 9 #include "base/logging.h"  // DCHECK | 9 #include "base/logging.h"  // DCHECK | 
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" | 
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 107 | 107 | 
| 108 /////////////////////////////////////////////////////////////////////////////// | 108 /////////////////////////////////////////////////////////////////////////////// | 
| 109 // BrowserHeaderPainterAsh, public: | 109 // BrowserHeaderPainterAsh, public: | 
| 110 | 110 | 
| 111 BrowserHeaderPainterAsh::BrowserHeaderPainterAsh() | 111 BrowserHeaderPainterAsh::BrowserHeaderPainterAsh() | 
| 112     : frame_(NULL), | 112     : frame_(NULL), | 
| 113       is_tabbed_(false), | 113       is_tabbed_(false), | 
| 114       is_incognito_(false), | 114       is_incognito_(false), | 
| 115       view_(NULL), | 115       view_(NULL), | 
| 116       window_icon_(NULL), | 116       window_icon_(NULL), | 
|  | 117       left_view_x_inset_(ash::HeaderPainterUtil::GetDefaultLeftViewXInset()), | 
| 117       caption_button_container_(NULL), | 118       caption_button_container_(NULL), | 
| 118       painted_height_(0), | 119       painted_height_(0), | 
| 119       initial_paint_(true), | 120       initial_paint_(true), | 
| 120       mode_(MODE_INACTIVE), | 121       mode_(MODE_INACTIVE), | 
| 121       activation_animation_(new gfx::SlideAnimation(this)) { | 122       activation_animation_(new gfx::SlideAnimation(this)) { | 
| 122 } | 123 } | 
| 123 | 124 | 
| 124 BrowserHeaderPainterAsh::~BrowserHeaderPainterAsh() { | 125 BrowserHeaderPainterAsh::~BrowserHeaderPainterAsh() { | 
| 125 } | 126 } | 
| 126 | 127 | 
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 238       caption_button_container_->GetPreferredSize(); | 239       caption_button_container_->GetPreferredSize(); | 
| 239   caption_button_container_->SetBounds( | 240   caption_button_container_->SetBounds( | 
| 240       view_->width() - caption_button_container_size.width(), | 241       view_->width() - caption_button_container_size.width(), | 
| 241       0, | 242       0, | 
| 242       caption_button_container_size.width(), | 243       caption_button_container_size.width(), | 
| 243       caption_button_container_size.height()); | 244       caption_button_container_size.height()); | 
| 244 | 245 | 
| 245   if (window_icon_) { | 246   if (window_icon_) { | 
| 246     // Vertically center the window icon with respect to the caption button | 247     // Vertically center the window icon with respect to the caption button | 
| 247     // container. | 248     // container. | 
| 248     int icon_size = ash::HeaderPainterUtil::GetDefaultIconSize(); | 249     gfx::Size icon_size(window_icon_->GetPreferredSize()); | 
| 249     int icon_offset_y = (caption_button_container_->height() - icon_size) / 2; | 250     int icon_offset_y = (caption_button_container_->height() - | 
| 250     window_icon_->SetBounds(ash::HeaderPainterUtil::GetIconXOffset(), | 251                          icon_size.height()) / 2; | 
| 251         icon_offset_y, icon_size, icon_size); | 252     window_icon_->SetBounds(left_view_x_inset_, | 
|  | 253                             icon_offset_y, | 
|  | 254                             icon_size.width(), | 
|  | 255                             icon_size.height()); | 
| 252   } | 256   } | 
| 253 } | 257 } | 
| 254 | 258 | 
| 255 int BrowserHeaderPainterAsh::GetHeaderHeightForPainting() const { | 259 int BrowserHeaderPainterAsh::GetHeaderHeightForPainting() const { | 
| 256   return painted_height_; | 260   return painted_height_; | 
| 257 } | 261 } | 
| 258 | 262 | 
| 259 void BrowserHeaderPainterAsh::SetHeaderHeightForPainting(int height) { | 263 void BrowserHeaderPainterAsh::SetHeaderHeightForPainting(int height) { | 
| 260   painted_height_ = height; | 264   painted_height_ = height; | 
| 261 } | 265 } | 
| 262 | 266 | 
| 263 void BrowserHeaderPainterAsh::SchedulePaintForTitle() { | 267 void BrowserHeaderPainterAsh::SchedulePaintForTitle() { | 
| 264   view_->SchedulePaintInRect(GetTitleBounds()); | 268   view_->SchedulePaintInRect(GetTitleBounds()); | 
| 265 } | 269 } | 
| 266 | 270 | 
|  | 271 void BrowserHeaderPainterAsh::UpdateLeftViewXInset(int left_view_x_inset) { | 
|  | 272   left_view_x_inset_ = left_view_x_inset; | 
|  | 273 } | 
|  | 274 | 
| 267 /////////////////////////////////////////////////////////////////////////////// | 275 /////////////////////////////////////////////////////////////////////////////// | 
| 268 // gfx::AnimationDelegate overrides: | 276 // gfx::AnimationDelegate overrides: | 
| 269 | 277 | 
| 270 void BrowserHeaderPainterAsh::AnimationProgressed( | 278 void BrowserHeaderPainterAsh::AnimationProgressed( | 
| 271     const gfx::Animation* animation) { | 279     const gfx::Animation* animation) { | 
| 272   view_->SchedulePaintInRect(GetPaintedBounds()); | 280   view_->SchedulePaintInRect(GetPaintedBounds()); | 
| 273 } | 281 } | 
| 274 | 282 | 
| 275 /////////////////////////////////////////////////////////////////////////////// | 283 /////////////////////////////////////////////////////////////////////////////// | 
| 276 // BrowserHeaderPainterAsh, private: | 284 // BrowserHeaderPainterAsh, private: | 
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 428 } | 436 } | 
| 429 | 437 | 
| 430 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 438 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 
| 431   return gfx::Rect(view_->width(), painted_height_); | 439   return gfx::Rect(view_->width(), painted_height_); | 
| 432 } | 440 } | 
| 433 | 441 | 
| 434 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 442 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 
| 435   return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 443   return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 
| 436       caption_button_container_, BrowserFrame::GetTitleFontList()); | 444       caption_button_container_, BrowserFrame::GetTitleFontList()); | 
| 437 } | 445 } | 
| OLD | NEW | 
|---|