| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
| 6 | 6 |
| 7 #include <algorithm> | |
| 8 | |
| 9 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 11 #include "ash/frame/default_header_painter.h" | 9 #include "ash/frame/default_header_painter.h" |
| 12 #include "ash/frame/frame_border_hit_test_controller.h" | 10 #include "ash/frame/frame_border_hit_test_controller.h" |
| 13 #include "ash/frame/header_painter_util.h" | 11 #include "ash/frame/header_painter_util.h" |
| 14 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 15 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 16 #include "chrome/browser/themes/theme_properties.h" | 14 #include "chrome/browser/themes/theme_properties.h" |
| 17 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_frame.h" | 16 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } | 370 } |
| 373 | 371 |
| 374 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() { | 372 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() { |
| 375 views::WidgetDelegate* delegate = frame()->widget_delegate(); | 373 views::WidgetDelegate* delegate = frame()->widget_delegate(); |
| 376 if (!delegate) | 374 if (!delegate) |
| 377 return gfx::ImageSkia(); | 375 return gfx::ImageSkia(); |
| 378 return delegate->GetWindowIcon(); | 376 return delegate->GetWindowIcon(); |
| 379 } | 377 } |
| 380 | 378 |
| 381 /////////////////////////////////////////////////////////////////////////////// | 379 /////////////////////////////////////////////////////////////////////////////// |
| 382 // views::View: | |
| 383 | |
| 384 void BrowserNonClientFrameViewAsh:: | |
| 385 ChildPreferredSizeChanged(views::View* child) { | |
| 386 // FrameCaptionButtonContainerView animates the visibility changes in | |
| 387 // UpdateSizeButtonVisibility(false). Due to this a new size is not available | |
| 388 // until the completion of the animation. Layout in response to the preferred | |
| 389 // size changes. | |
| 390 if (child != caption_button_container_) | |
| 391 return; | |
| 392 frame()->GetRootView()->Layout(); | |
| 393 } | |
| 394 | |
| 395 /////////////////////////////////////////////////////////////////////////////// | |
| 396 // BrowserNonClientFrameViewAsh, private: | 380 // BrowserNonClientFrameViewAsh, private: |
| 397 | 381 |
| 398 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { | 382 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { |
| 399 return avatar_button() ? kAvatarSideSpacing + | 383 return avatar_button() ? kAvatarSideSpacing + |
| 400 browser_view()->GetOTRAvatarIcon().width() + kAvatarSideSpacing : | 384 browser_view()->GetOTRAvatarIcon().width() + kAvatarSideSpacing : |
| 401 kTabstripLeftSpacing; | 385 kTabstripLeftSpacing; |
| 402 } | 386 } |
| 403 | 387 |
| 404 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { | 388 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { |
| 405 return caption_button_container_->GetPreferredSize().width() + | 389 return caption_button_container_->GetPreferredSize().width() + |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 533 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 550 } | 534 } |
| 551 | 535 |
| 552 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 536 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 553 DCHECK(!UsePackagedAppHeaderStyle()); | 537 DCHECK(!UsePackagedAppHeaderStyle()); |
| 554 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), | 538 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), |
| 555 width(), kClientEdgeThickness), | 539 width(), kClientEdgeThickness), |
| 556 ThemeProperties::GetDefaultColor( | 540 ThemeProperties::GetDefaultColor( |
| 557 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 541 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 558 } | 542 } |
| OLD | NEW |