| 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 |
| 7 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 9 #include "ash/frame/default_header_painter.h" | 11 #include "ash/frame/default_header_painter.h" |
| 10 #include "ash/frame/frame_border_hit_test_controller.h" | 12 #include "ash/frame/frame_border_hit_test_controller.h" |
| 11 #include "ash/frame/header_painter_util.h" | 13 #include "ash/frame/header_painter_util.h" |
| 12 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 13 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 14 #include "chrome/browser/themes/theme_properties.h" | 16 #include "chrome/browser/themes/theme_properties.h" |
| 15 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/views/frame/browser_frame.h" | 18 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 372 } |
| 371 | 373 |
| 372 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() { | 374 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() { |
| 373 views::WidgetDelegate* delegate = frame()->widget_delegate(); | 375 views::WidgetDelegate* delegate = frame()->widget_delegate(); |
| 374 if (!delegate) | 376 if (!delegate) |
| 375 return gfx::ImageSkia(); | 377 return gfx::ImageSkia(); |
| 376 return delegate->GetWindowIcon(); | 378 return delegate->GetWindowIcon(); |
| 377 } | 379 } |
| 378 | 380 |
| 379 /////////////////////////////////////////////////////////////////////////////// | 381 /////////////////////////////////////////////////////////////////////////////// |
| 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 /////////////////////////////////////////////////////////////////////////////// |
| 380 // BrowserNonClientFrameViewAsh, private: | 396 // BrowserNonClientFrameViewAsh, private: |
| 381 | 397 |
| 382 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { | 398 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { |
| 383 return avatar_button() ? kAvatarSideSpacing + | 399 return avatar_button() ? kAvatarSideSpacing + |
| 384 browser_view()->GetOTRAvatarIcon().width() + kAvatarSideSpacing : | 400 browser_view()->GetOTRAvatarIcon().width() + kAvatarSideSpacing : |
| 385 kTabstripLeftSpacing; | 401 kTabstripLeftSpacing; |
| 386 } | 402 } |
| 387 | 403 |
| 388 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { | 404 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { |
| 389 return caption_button_container_->GetPreferredSize().width() + | 405 return caption_button_container_->GetPreferredSize().width() + |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 549 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 534 } | 550 } |
| 535 | 551 |
| 536 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 552 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 537 DCHECK(!UsePackagedAppHeaderStyle()); | 553 DCHECK(!UsePackagedAppHeaderStyle()); |
| 538 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), | 554 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), |
| 539 width(), kClientEdgeThickness), | 555 width(), kClientEdgeThickness), |
| 540 ThemeProperties::GetDefaultColor( | 556 ThemeProperties::GetDefaultColor( |
| 541 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 557 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 542 } | 558 } |
| OLD | NEW |