| 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 "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
| 9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 SkBitmap* bottom_edge = tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER); | 577 SkBitmap* bottom_edge = tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER); |
| 578 | 578 |
| 579 | 579 |
| 580 // Window frame mode and color | 580 // Window frame mode and color |
| 581 SkBitmap* theme_frame; | 581 SkBitmap* theme_frame; |
| 582 SkColor frame_color; | 582 SkColor frame_color; |
| 583 | 583 |
| 584 // Never theme app and popup windows. | 584 // Never theme app and popup windows. |
| 585 if (!browser_view_->IsBrowserTypeNormal()) { | 585 if (!browser_view_->IsBrowserTypeNormal()) { |
| 586 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 586 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 587 if (frame_->GetWindow()->IsActive()) { | 587 if (ShouldPaintAsActive()) { |
| 588 theme_frame = rb.GetBitmapNamed(IDR_FRAME); | 588 theme_frame = rb.GetBitmapNamed(IDR_FRAME); |
| 589 frame_color = browser_view_->IsOffTheRecord() ? | 589 frame_color = browser_view_->IsOffTheRecord() ? |
| 590 ResourceBundle::frame_color_incognito : | 590 ResourceBundle::frame_color_incognito : |
| 591 ResourceBundle::frame_color; | 591 ResourceBundle::frame_color; |
| 592 } else { | 592 } else { |
| 593 theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); | 593 theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); |
| 594 frame_color = browser_view_->IsOffTheRecord() ? | 594 frame_color = browser_view_->IsOffTheRecord() ? |
| 595 ResourceBundle::frame_color_incognito_inactive : | 595 ResourceBundle::frame_color_incognito_inactive : |
| 596 ResourceBundle::frame_color_inactive; | 596 ResourceBundle::frame_color_inactive; |
| 597 } | 597 } |
| 598 } else if (!browser_view_->IsOffTheRecord()) { | 598 } else if (!browser_view_->IsOffTheRecord()) { |
| 599 if (frame_->GetWindow()->IsActive()) { | 599 if (ShouldPaintAsActive()) { |
| 600 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME); | 600 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME); |
| 601 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME); | 601 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME); |
| 602 } else { | 602 } else { |
| 603 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); | 603 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); |
| 604 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME_INACTIVE); | 604 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME_INACTIVE); |
| 605 } | 605 } |
| 606 } else { | 606 } else { |
| 607 if (frame_->GetWindow()->IsActive()) { | 607 if (ShouldPaintAsActive()) { |
| 608 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO); | 608 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO); |
| 609 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME_INCOGNITO); | 609 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME_INCOGNITO); |
| 610 } else { | 610 } else { |
| 611 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE); | 611 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE); |
| 612 frame_color = tp->GetColor( | 612 frame_color = tp->GetColor( |
| 613 BrowserThemeProvider::COLOR_FRAME_INCOGNITO_INACTIVE); | 613 BrowserThemeProvider::COLOR_FRAME_INCOGNITO_INACTIVE); |
| 614 } | 614 } |
| 615 } | 615 } |
| 616 | 616 |
| 617 // Fill with the frame color first so we have a constant background for | 617 // Fill with the frame color first so we have a constant background for |
| (...skipping 12 matching lines...) Expand all Loading... |
| 630 width() - left_edge->width() - right_edge->width(), | 630 width() - left_edge->width() - right_edge->width(), |
| 631 bottom_edge->height()); | 631 bottom_edge->height()); |
| 632 | 632 |
| 633 // Draw the theme frame. | 633 // Draw the theme frame. |
| 634 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); | 634 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); |
| 635 | 635 |
| 636 // Draw the theme frame overlay | 636 // Draw the theme frame overlay |
| 637 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 637 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
| 638 browser_view_->IsBrowserTypeNormal()) { | 638 browser_view_->IsBrowserTypeNormal()) { |
| 639 SkBitmap* theme_overlay; | 639 SkBitmap* theme_overlay; |
| 640 if (frame_->GetWindow()->IsActive()) | 640 if (ShouldPaintAsActive()) |
| 641 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY); | 641 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY); |
| 642 else | 642 else |
| 643 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE); | 643 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE); |
| 644 canvas->DrawBitmapInt(*theme_overlay, 0, 0); | 644 canvas->DrawBitmapInt(*theme_overlay, 0, 0); |
| 645 } | 645 } |
| 646 | 646 |
| 647 // Top. | 647 // Top. |
| 648 int top_left_height = std::min(top_left_corner->height(), | 648 int top_left_height = std::min(top_left_corner->height(), |
| 649 height() - bottom_left_corner->height()); | 649 height() - bottom_left_corner->height()); |
| 650 canvas->DrawBitmapInt(*top_left_corner, 0, 0, top_left_corner->width(), | 650 canvas->DrawBitmapInt(*top_left_corner, 0, 0, top_left_corner->width(), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { | 687 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { |
| 688 ThemeProvider* tp = GetThemeProvider(); | 688 ThemeProvider* tp = GetThemeProvider(); |
| 689 views::Window* window = frame_->GetWindow(); | 689 views::Window* window = frame_->GetWindow(); |
| 690 | 690 |
| 691 // Window frame mode and color | 691 // Window frame mode and color |
| 692 SkBitmap* theme_frame; | 692 SkBitmap* theme_frame; |
| 693 | 693 |
| 694 // Never theme app and popup windows. | 694 // Never theme app and popup windows. |
| 695 if (!browser_view_->IsBrowserTypeNormal()) { | 695 if (!browser_view_->IsBrowserTypeNormal()) { |
| 696 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 696 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 697 if (frame_->GetWindow()->IsActive()) | 697 if (ShouldPaintAsActive()) |
| 698 theme_frame = rb.GetBitmapNamed(IDR_FRAME); | 698 theme_frame = rb.GetBitmapNamed(IDR_FRAME); |
| 699 else | 699 else |
| 700 theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); | 700 theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); |
| 701 } else if (!browser_view_->IsOffTheRecord()) { | 701 } else if (!browser_view_->IsOffTheRecord()) { |
| 702 theme_frame = window->IsActive() ? | 702 theme_frame = ShouldPaintAsActive() ? |
| 703 tp->GetBitmapNamed(IDR_THEME_FRAME) : | 703 tp->GetBitmapNamed(IDR_THEME_FRAME) : |
| 704 tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); | 704 tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); |
| 705 } else { | 705 } else { |
| 706 theme_frame = window->IsActive() ? | 706 theme_frame = ShouldPaintAsActive() ? |
| 707 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO) : | 707 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO) : |
| 708 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE); | 708 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE); |
| 709 } | 709 } |
| 710 | 710 |
| 711 // Draw the theme frame. | 711 // Draw the theme frame. |
| 712 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); | 712 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); |
| 713 | 713 |
| 714 // Draw the theme frame overlay | 714 // Draw the theme frame overlay |
| 715 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 715 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
| 716 browser_view_->IsBrowserTypeNormal()) { | 716 browser_view_->IsBrowserTypeNormal()) { |
| 717 SkBitmap* theme_overlay = frame_->GetWindow()->IsActive() ? | 717 SkBitmap* theme_overlay = ShouldPaintAsActive() ? |
| 718 tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY) : | 718 tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY) : |
| 719 tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE); | 719 tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE); |
| 720 canvas->DrawBitmapInt(*theme_overlay, 0, 0); | 720 canvas->DrawBitmapInt(*theme_overlay, 0, 0); |
| 721 } | 721 } |
| 722 | 722 |
| 723 if (!browser_view_->IsToolbarVisible()) { | 723 if (!browser_view_->IsToolbarVisible()) { |
| 724 // There's no toolbar to edge the frame border, so we need to draw a bottom | 724 // There's no toolbar to edge the frame border, so we need to draw a bottom |
| 725 // edge. The graphic we use for this has a built in client edge, so we clip | 725 // edge. The graphic we use for this has a built in client edge, so we clip |
| 726 // it off the bottom. | 726 // it off the bottom. |
| 727 SkBitmap* top_center = | 727 SkBitmap* top_center = |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 static bool initialized = false; | 1078 static bool initialized = false; |
| 1079 if (!initialized) { | 1079 if (!initialized) { |
| 1080 #if defined(OS_WIN) | 1080 #if defined(OS_WIN) |
| 1081 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); | 1081 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); |
| 1082 #else | 1082 #else |
| 1083 title_font_ = new gfx::Font(); | 1083 title_font_ = new gfx::Font(); |
| 1084 #endif | 1084 #endif |
| 1085 initialized = true; | 1085 initialized = true; |
| 1086 } | 1086 } |
| 1087 } | 1087 } |
| OLD | NEW |