| 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/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "chrome/browser/themes/theme_service_factory.h" | 9 #include "chrome/browser/themes/theme_service_factory.h" |
| 10 #include "chrome/browser/ui/layout_constants.h" | 10 #include "chrome/browser/ui/layout_constants.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 IsMaximized()); | 500 IsMaximized()); |
| 501 } | 501 } |
| 502 | 502 |
| 503 int OpaqueBrowserFrameView::GetTopAreaHeight() const { | 503 int OpaqueBrowserFrameView::GetTopAreaHeight() const { |
| 504 // The top area height in dp (only used when there's no frame image). | 504 // The top area height in dp (only used when there's no frame image). |
| 505 // TODO(pkasting): investigate removing this constant. See crbug.com/590301 | 505 // TODO(pkasting): investigate removing this constant. See crbug.com/590301 |
| 506 const int kHeight = 64; | 506 const int kHeight = 64; |
| 507 const gfx::ImageSkia frame_image = GetFrameImage(); | 507 const gfx::ImageSkia frame_image = GetFrameImage(); |
| 508 int top_area_height = frame_image.isNull() ? kHeight : frame_image.height(); | 508 int top_area_height = frame_image.isNull() ? kHeight : frame_image.height(); |
| 509 if (browser_view()->IsTabStripVisible()) { | 509 if (browser_view()->IsTabStripVisible()) { |
| 510 top_area_height = | 510 // TODO(thomasanderson): Figure out what this should be. Do no land as is. |
| 511 std::max(top_area_height, | 511 top_area_height = GetBoundsForTabStrip(browser_view()->tabstrip()).bottom(); |
| 512 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); | |
| 513 } | 512 } |
| 514 return top_area_height; | 513 return top_area_height; |
| 515 } | 514 } |
| 516 | 515 |
| 517 void OpaqueBrowserFrameView::PaintRestoredFrameBorder( | 516 void OpaqueBrowserFrameView::PaintRestoredFrameBorder( |
| 518 gfx::Canvas* canvas) const { | 517 gfx::Canvas* canvas) const { |
| 519 frame_background_->set_frame_color(GetFrameColor()); | 518 frame_background_->set_frame_color(GetFrameColor()); |
| 519 frame_background_->set_is_active(ShouldPaintAsActive()); |
| 520 frame_background_->set_theme_image(GetFrameImage()); | 520 frame_background_->set_theme_image(GetFrameImage()); |
| 521 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); | 521 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); |
| 522 frame_background_->set_top_area_height(GetTopAreaHeight()); | 522 frame_background_->set_top_area_height(GetTopAreaHeight()); |
| 523 | 523 |
| 524 const ui::ThemeProvider* tp = GetThemeProvider(); | 524 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 525 frame_background_->SetSideImages( | 525 frame_background_->SetSideImages( |
| 526 tp->GetImageSkiaNamed(IDR_WINDOW_LEFT_SIDE), | 526 tp->GetImageSkiaNamed(IDR_WINDOW_LEFT_SIDE), |
| 527 tp->GetImageSkiaNamed(IDR_WINDOW_TOP_CENTER), | 527 tp->GetImageSkiaNamed(IDR_WINDOW_TOP_CENTER), |
| 528 tp->GetImageSkiaNamed(IDR_WINDOW_RIGHT_SIDE), | 528 tp->GetImageSkiaNamed(IDR_WINDOW_RIGHT_SIDE), |
| 529 tp->GetImageSkiaNamed(IDR_WINDOW_BOTTOM_CENTER)); | 529 tp->GetImageSkiaNamed(IDR_WINDOW_BOTTOM_CENTER)); |
| 530 frame_background_->SetCornerImages( | 530 frame_background_->SetCornerImages( |
| 531 tp->GetImageSkiaNamed(IDR_WINDOW_TOP_LEFT_CORNER), | 531 tp->GetImageSkiaNamed(IDR_WINDOW_TOP_LEFT_CORNER), |
| 532 tp->GetImageSkiaNamed(IDR_WINDOW_TOP_RIGHT_CORNER), | 532 tp->GetImageSkiaNamed(IDR_WINDOW_TOP_RIGHT_CORNER), |
| 533 tp->GetImageSkiaNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER), | 533 tp->GetImageSkiaNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER), |
| 534 tp->GetImageSkiaNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER)); | 534 tp->GetImageSkiaNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER)); |
| 535 frame_background_->PaintRestored(canvas, this); | 535 frame_background_->PaintRestored(canvas, this); |
| 536 | 536 |
| 537 // Note: When we don't have a toolbar, we need to draw some kind of bottom | 537 // Note: When we don't have a toolbar, we need to draw some kind of bottom |
| 538 // edge here. Because the App Window graphics we use for this have an | 538 // edge here. Because the App Window graphics we use for this have an |
| 539 // attached client edge and their sizing algorithm is a little involved, we do | 539 // attached client edge and their sizing algorithm is a little involved, we do |
| 540 // all this in PaintRestoredClientEdge(). | 540 // all this in PaintRestoredClientEdge(). |
| 541 } | 541 } |
| 542 | 542 |
| 543 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder( | 543 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder( |
| 544 gfx::Canvas* canvas) const { | 544 gfx::Canvas* canvas) const { |
| 545 frame_background_->set_frame_color(GetFrameColor()); | 545 frame_background_->set_frame_color(GetFrameColor()); |
| 546 frame_background_->set_is_active(ShouldPaintAsActive()); |
| 546 frame_background_->set_theme_image(GetFrameImage()); | 547 frame_background_->set_theme_image(GetFrameImage()); |
| 547 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); | 548 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); |
| 548 frame_background_->set_top_area_height(GetTopAreaHeight()); | 549 frame_background_->set_top_area_height(GetTopAreaHeight()); |
| 549 frame_background_->set_maximized_top_inset( | 550 frame_background_->set_maximized_top_inset( |
| 550 GetTopInset(true) - GetTopInset(false)); | 551 GetTopInset(true) - GetTopInset(false)); |
| 551 frame_background_->PaintMaximized(canvas, this); | 552 frame_background_->PaintMaximized(canvas, this); |
| 552 } | 553 } |
| 553 | 554 |
| 554 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { | 555 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { |
| 555 // TODO(estade): can this be shared with OpaqueBrowserFrameView? | 556 // TODO(estade): can this be shared with OpaqueBrowserFrameView? |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 gfx::Rect side(x, y, kClientEdgeThickness, h); | 667 gfx::Rect side(x, y, kClientEdgeThickness, h); |
| 667 canvas->FillRect(side, color); | 668 canvas->FillRect(side, color); |
| 668 if (draw_bottom) { | 669 if (draw_bottom) { |
| 669 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), | 670 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), |
| 670 kClientEdgeThickness), | 671 kClientEdgeThickness), |
| 671 color); | 672 color); |
| 672 } | 673 } |
| 673 side.Offset(w + kClientEdgeThickness, 0); | 674 side.Offset(w + kClientEdgeThickness, 0); |
| 674 canvas->FillRect(side, color); | 675 canvas->FillRect(side, color); |
| 675 } | 676 } |
| OLD | NEW |