| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/frame/opaque_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/views/frame/browser_frame.h" | 7 #include "chrome/browser/views/frame/browser_frame.h" |
| 8 #include "chrome/browser/views/frame/browser_view.h" | 8 #include "chrome/browser/views/frame/browser_view.h" |
| 9 #include "chrome/browser/views/tabs/tab_strip.h" | 9 #include "chrome/browser/views/tabs/tab_strip.h" |
| 10 #include "chrome/common/gfx/chrome_canvas.h" | 10 #include "chrome/common/gfx/chrome_canvas.h" |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 resources()->GetPartBitmap(FRAME_NO_TOOLBAR_TOP_CENTER); | 770 resources()->GetPartBitmap(FRAME_NO_TOOLBAR_TOP_CENTER); |
| 771 int edge_height = top_center->height() - kClientEdgeThickness; | 771 int edge_height = top_center->height() - kClientEdgeThickness; |
| 772 canvas->TileImageInt(*top_center, 0, | 772 canvas->TileImageInt(*top_center, 0, |
| 773 frame_->GetClientView()->y() - edge_height, width(), edge_height); | 773 frame_->GetClientView()->y() - edge_height, width(), edge_height); |
| 774 } | 774 } |
| 775 } | 775 } |
| 776 | 776 |
| 777 void OpaqueBrowserFrameView::PaintDistributorLogo(ChromeCanvas* canvas) { | 777 void OpaqueBrowserFrameView::PaintDistributorLogo(ChromeCanvas* canvas) { |
| 778 // The distributor logo is only painted when the frame is not maximized and | 778 // The distributor logo is only painted when the frame is not maximized and |
| 779 // when we actually have a logo. | 779 // when we actually have a logo. |
| 780 if (!frame_->IsMaximized() && distributor_logo_) { | 780 if (!frame_->IsMaximized() && distributor_logo_ && |
| 781 browser_view_->ShouldShowDistributorLogo()) { |
| 781 canvas->DrawBitmapInt(*distributor_logo_, | 782 canvas->DrawBitmapInt(*distributor_logo_, |
| 782 MirroredLeftPointForRect(logo_bounds_), logo_bounds_.y()); | 783 MirroredLeftPointForRect(logo_bounds_), logo_bounds_.y()); |
| 783 } | 784 } |
| 784 } | 785 } |
| 785 | 786 |
| 786 void OpaqueBrowserFrameView::PaintTitleBar(ChromeCanvas* canvas) { | 787 void OpaqueBrowserFrameView::PaintTitleBar(ChromeCanvas* canvas) { |
| 787 // The window icon is painted by the TabIconView. | 788 // The window icon is painted by the TabIconView. |
| 788 views::WindowDelegate* d = frame_->GetDelegate(); | 789 views::WindowDelegate* d = frame_->GetDelegate(); |
| 789 if (d->ShouldShowWindowTitle()) { | 790 if (d->ShouldShowWindowTitle()) { |
| 790 canvas->DrawStringInt(d->GetWindowTitle(), title_font_, SK_ColorWHITE, | 791 canvas->DrawStringInt(d->GetWindowTitle(), title_font_, SK_ColorWHITE, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 gfx::Size minimize_button_size = minimize_button_->GetPreferredSize(); | 945 gfx::Size minimize_button_size = minimize_button_->GetPreferredSize(); |
| 945 minimize_button_->SetBounds( | 946 minimize_button_->SetBounds( |
| 946 visible_button->x() - minimize_button_size.width(), caption_y, | 947 visible_button->x() - minimize_button_size.width(), caption_y, |
| 947 minimize_button_size.width(), | 948 minimize_button_size.width(), |
| 948 minimize_button_size.height() + top_extra_height); | 949 minimize_button_size.height() + top_extra_height); |
| 949 } | 950 } |
| 950 | 951 |
| 951 void OpaqueBrowserFrameView::LayoutDistributorLogo() { | 952 void OpaqueBrowserFrameView::LayoutDistributorLogo() { |
| 952 // Always lay out the logo, even when it's not present, so we can lay out the | 953 // Always lay out the logo, even when it's not present, so we can lay out the |
| 953 // window title based on its position. | 954 // window title based on its position. |
| 954 if (distributor_logo_) { | 955 if (distributor_logo_ && browser_view_->ShouldShowDistributorLogo()) { |
| 955 logo_bounds_.SetRect(minimize_button_->x() - distributor_logo_->width() - | 956 logo_bounds_.SetRect(minimize_button_->x() - distributor_logo_->width() - |
| 956 kLogoCaptionSpacing, TopResizeHeight(), distributor_logo_->width(), | 957 kLogoCaptionSpacing, TopResizeHeight(), distributor_logo_->width(), |
| 957 distributor_logo_->height()); | 958 distributor_logo_->height()); |
| 958 } else { | 959 } else { |
| 959 logo_bounds_.SetRect(minimize_button_->x(), TopResizeHeight(), 0, 0); | 960 logo_bounds_.SetRect(minimize_button_->x(), TopResizeHeight(), 0, 0); |
| 960 } | 961 } |
| 961 } | 962 } |
| 962 | 963 |
| 963 void OpaqueBrowserFrameView::LayoutTitleBar() { | 964 void OpaqueBrowserFrameView::LayoutTitleBar() { |
| 964 // Always lay out the icon, even when it's not present, so we can lay out the | 965 // Always lay out the icon, even when it's not present, so we can lay out the |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 } | 1054 } |
| 1054 | 1055 |
| 1055 // static | 1056 // static |
| 1056 void OpaqueBrowserFrameView::InitAppWindowResources() { | 1057 void OpaqueBrowserFrameView::InitAppWindowResources() { |
| 1057 static bool initialized = false; | 1058 static bool initialized = false; |
| 1058 if (!initialized) { | 1059 if (!initialized) { |
| 1059 title_font_ = win_util::GetWindowTitleFont(); | 1060 title_font_ = win_util::GetWindowTitleFont(); |
| 1060 initialized = true; | 1061 initialized = true; |
| 1061 } | 1062 } |
| 1062 } | 1063 } |
| OLD | NEW |