| 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/panels/panel_browser_frame_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 GetCloseButtonResources().mask_image); | 779 GetCloseButtonResources().mask_image); |
| 780 } | 780 } |
| 781 | 781 |
| 782 void PanelBrowserFrameView::PaintFrameBorder(gfx::Canvas* canvas) { | 782 void PanelBrowserFrameView::PaintFrameBorder(gfx::Canvas* canvas) { |
| 783 // Paint the background. | 783 // Paint the background. |
| 784 if (paint_state_ == PAINT_FOR_ATTENTION || UsingDefaultTheme()) { | 784 if (paint_state_ == PAINT_FOR_ATTENTION || UsingDefaultTheme()) { |
| 785 const SkPaint& paint = GetDefaultFrameTheme(paint_state_); | 785 const SkPaint& paint = GetDefaultFrameTheme(paint_state_); |
| 786 canvas->DrawRect(gfx::Rect(0, 0, width(), kTitlebarHeight), paint); | 786 canvas->DrawRect(gfx::Rect(0, 0, width(), kTitlebarHeight), paint); |
| 787 } else { | 787 } else { |
| 788 SkBitmap* bitmap = GetFrameTheme(paint_state_); | 788 SkBitmap* bitmap = GetFrameTheme(paint_state_); |
| 789 canvas->TileImageInt(*bitmap, 0, 0, width(), kTitlebarHeight); | 789 canvas->TileImage(*bitmap, gfx::Rect(0, 0, width(), kTitlebarHeight)); |
| 790 } | 790 } |
| 791 | 791 |
| 792 #if defined(USE_AURA) | 792 #if defined(USE_AURA) |
| 793 // Aura recognizes aura::client::WINDOW_TYPE_PANEL and will draw the | 793 // Aura recognizes aura::client::WINDOW_TYPE_PANEL and will draw the |
| 794 // appropriate frame and shadow. See ash/wm/shadow_controller.h. | 794 // appropriate frame and shadow. See ash/wm/shadow_controller.h. |
| 795 | 795 |
| 796 // Draw the divider between the titlebar and the client area. | 796 // Draw the divider between the titlebar and the client area. |
| 797 if (height() > kTitlebarHeight) { | 797 if (height() > kTitlebarHeight) { |
| 798 canvas->DrawRect(gfx::Rect(0, kTitlebarHeight, width() - 1, 1), | 798 canvas->DrawRect(gfx::Rect(0, kTitlebarHeight, width() - 1, 1), |
| 799 kDividerColor); | 799 kDividerColor); |
| 800 } | 800 } |
| 801 #else | 801 #else |
| 802 // Draw the top border. | 802 // Draw the top border. |
| 803 const EdgeResources& frame_edges = GetFrameEdges(); | 803 const EdgeResources& frame_edges = GetFrameEdges(); |
| 804 canvas->DrawBitmapInt(*(frame_edges.top_left), 0, 0); | 804 canvas->DrawBitmapInt(*(frame_edges.top_left), 0, 0); |
| 805 canvas->TileImageInt( | 805 canvas->TileImageInt(*(frame_edges.top), |
| 806 *(frame_edges.top), frame_edges.top_left->width(), 0, | 806 gfx::Rect(frame_edges.top_left->width(), 0, |
| 807 width() - frame_edges.top_right->width(), frame_edges.top->height()); | 807 width() - frame_edges.top_left->width() - |
| 808 frame_edges.top_right->width(), |
| 809 frame_edges.top->height())); |
| 808 canvas->DrawBitmapInt( | 810 canvas->DrawBitmapInt( |
| 809 *(frame_edges.top_right), | 811 *(frame_edges.top_right), |
| 810 width() - frame_edges.top_right->width(), 0); | 812 width() - frame_edges.top_right->width(), 0); |
| 811 | 813 |
| 812 // Draw the right border. | 814 // Draw the right border. |
| 813 canvas->TileImageInt( | 815 canvas->TileImage(*(frame_edges.right), |
| 814 *(frame_edges.right), width() - frame_edges.right->width(), | 816 gfx::Rect(width() - frame_edges.right->width(), |
| 815 frame_edges.top_right->height(), frame_edges.right->width(), | 817 frame_edges.top_right->height(), frame_edges.right->width(), |
| 816 height() - frame_edges.top_right->height() - | 818 height() - frame_edges.top_right->height() - |
| 817 frame_edges.bottom_right->height()); | 819 frame_edges.bottom_right->height())); |
| 818 | 820 |
| 819 // Draw the bottom border. | 821 // Draw the bottom border. |
| 820 canvas->DrawBitmapInt( | 822 canvas->DrawBitmapInt( |
| 821 *(frame_edges.bottom_right), | 823 *(frame_edges.bottom_right), |
| 822 width() - frame_edges.bottom_right->width(), | 824 width() - frame_edges.bottom_right->width(), |
| 823 height() - frame_edges.bottom_right->height()); | 825 height() - frame_edges.bottom_right->height()); |
| 824 canvas->TileImageInt( | 826 canvas->TileImage(*(frame_edges.bottom), |
| 825 *(frame_edges.bottom), frame_edges.bottom_left->width(), | 827 gfx::Rect(frame_edges.bottom_left->width(), |
| 826 height() - frame_edges.bottom->height(), | 828 height() - frame_edges.bottom->height(), |
| 827 width() - frame_edges.bottom_left->width() - | 829 width() - frame_edges.bottom_left->width() - |
| 828 frame_edges.bottom_right->width(), | 830 frame_edges.bottom_right->width(), |
| 829 frame_edges.bottom->height()); | 831 frame_edges.bottom->height())); |
| 830 canvas->DrawBitmapInt( | 832 canvas->DrawBitmapInt( |
| 831 *(frame_edges.bottom_left), 0, | 833 *(frame_edges.bottom_left), 0, |
| 832 height() - frame_edges.bottom_left->height()); | 834 height() - frame_edges.bottom_left->height()); |
| 833 | 835 |
| 834 // Draw the left border. | 836 // Draw the left border. |
| 835 canvas->TileImageInt( | 837 canvas->TileImage(*(frame_edges.left), gfx::Rect(0, |
| 836 *(frame_edges.left), 0, frame_edges.top_left->height(), | 838 frame_edges.top_left->height(), |
| 837 frame_edges.left->width(), | 839 frame_edges.left->width(), |
| 838 height() - frame_edges.top_left->height() - | 840 height() - frame_edges.top_left->height() - |
| 839 frame_edges.bottom_left->height()); | 841 frame_edges.bottom_left->height())); |
| 840 | 842 |
| 841 // Draw the divider between the titlebar and the client area. | 843 // Draw the divider between the titlebar and the client area. |
| 842 if (height() > kTitlebarHeight) { | 844 if (height() > kTitlebarHeight) { |
| 843 canvas->DrawRect(gfx::Rect(kBorderThickness, kTitlebarHeight, | 845 canvas->DrawRect(gfx::Rect(kBorderThickness, kTitlebarHeight, |
| 844 width() - 1 - 2 * kBorderThickness, | 846 width() - 1 - 2 * kBorderThickness, |
| 845 kBorderThickness), kDividerColor); | 847 kBorderThickness), kDividerColor); |
| 846 } | 848 } |
| 847 #endif // !defined(USE_AURA) | 849 #endif // !defined(USE_AURA) |
| 848 } | 850 } |
| 849 | 851 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 917 |
| 916 settings_menu_model_.reset( | 918 settings_menu_model_.reset( |
| 917 new PanelSettingsMenuModel(panel_browser_view_->panel())); | 919 new PanelSettingsMenuModel(panel_browser_view_->panel())); |
| 918 settings_menu_adapter_.reset( | 920 settings_menu_adapter_.reset( |
| 919 new views::MenuModelAdapter(settings_menu_model_.get())); | 921 new views::MenuModelAdapter(settings_menu_model_.get())); |
| 920 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); | 922 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); |
| 921 settings_menu_adapter_->BuildMenu(settings_menu_); | 923 settings_menu_adapter_->BuildMenu(settings_menu_); |
| 922 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); | 924 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); |
| 923 return true; | 925 return true; |
| 924 } | 926 } |
| OLD | NEW |