| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/browser_theme_provider.h" | 11 #include "chrome/browser/browser_theme_provider.h" |
| 12 #include "chrome/browser/tab_contents/tab_contents.h" | 12 #include "chrome/browser/tab_contents/tab_contents.h" |
| 13 #include "chrome/browser/views/frame/browser_extender.h" | 13 #include "chrome/browser/views/frame/browser_extender.h" |
| 14 #include "chrome/browser/views/frame/browser_frame.h" | 14 #include "chrome/browser/views/frame/browser_frame.h" |
| 15 #include "chrome/browser/views/frame/browser_view.h" | 15 #include "chrome/browser/views/frame/browser_view.h" |
| 16 #include "chrome/browser/views/tabs/tab_strip.h" | 16 #include "chrome/browser/views/tabs/tab_strip.h" |
| 17 #include "chrome/browser/views/toolbar_view.h" | 17 #include "chrome/browser/views/toolbar_view.h" |
| 18 #include "gfx/canvas.h" | 18 #include "gfx/canvas_skia.h" |
| 19 #include "gfx/font.h" | 19 #include "gfx/font.h" |
| 20 #include "gfx/path.h" | 20 #include "gfx/path.h" |
| 21 #include "grit/app_resources.h" | 21 #include "grit/app_resources.h" |
| 22 #include "grit/chromium_strings.h" | 22 #include "grit/chromium_strings.h" |
| 23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 24 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 25 #include "views/controls/button/image_button.h" | 25 #include "views/controls/button/image_button.h" |
| 26 #include "views/controls/image_view.h" | 26 #include "views/controls/image_view.h" |
| 27 #include "views/widget/root_view.h" | 27 #include "views/widget/root_view.h" |
| 28 #include "views/window/window.h" | 28 #include "views/window/window.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 | 376 |
| 377 // The otr icon is clipped for side tabs. | 377 // The otr icon is clipped for side tabs. |
| 378 for (int i = 0, count = GetChildViewCount(); i < count; ++i) { | 378 for (int i = 0, count = GetChildViewCount(); i < count; ++i) { |
| 379 View* child = GetChildViewAt(i); | 379 View* child = GetChildViewAt(i); |
| 380 if (!child) { | 380 if (!child) { |
| 381 NOTREACHED() << "Should not have a NULL child View for index in bounds"; | 381 NOTREACHED() << "Should not have a NULL child View for index in bounds"; |
| 382 continue; | 382 continue; |
| 383 } | 383 } |
| 384 if (child == otr_avatar_icon_) { | 384 if (child == otr_avatar_icon_) { |
| 385 canvas->save(); | 385 canvas->AsCanvasSkia()->save(); |
| 386 canvas->ClipRectInt(0, 2, width(), otr_avatar_icon_->height() - 10); | 386 canvas->ClipRectInt(0, 2, width(), otr_avatar_icon_->height() - 10); |
| 387 child->ProcessPaint(canvas); | 387 child->ProcessPaint(canvas); |
| 388 canvas->restore(); | 388 canvas->AsCanvasSkia()->restore(); |
| 389 } else { | 389 } else { |
| 390 child->ProcessPaint(canvas); | 390 child->ProcessPaint(canvas); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 | 394 |
| 395 void OpaqueBrowserFrameView::Layout() { | 395 void OpaqueBrowserFrameView::Layout() { |
| 396 LayoutWindowControls(); | 396 LayoutWindowControls(); |
| 397 LayoutTitleBar(); | 397 LayoutTitleBar(); |
| 398 LayoutOTRAvatar(); | 398 LayoutOTRAvatar(); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 int bottom_y = y + split_point; | 778 int bottom_y = y + split_point; |
| 779 SkBitmap* toolbar_left = tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER); | 779 SkBitmap* toolbar_left = tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER); |
| 780 int bottom_edge_height = std::min(toolbar_left->height(), h) - split_point; | 780 int bottom_edge_height = std::min(toolbar_left->height(), h) - split_point; |
| 781 | 781 |
| 782 // Split our canvas out so we can mask out the corners of the toolbar | 782 // Split our canvas out so we can mask out the corners of the toolbar |
| 783 // without masking out the frame. | 783 // without masking out the frame. |
| 784 SkRect bounds; | 784 SkRect bounds; |
| 785 bounds.set(SkIntToScalar(x - kClientEdgeThickness), SkIntToScalar(y), | 785 bounds.set(SkIntToScalar(x - kClientEdgeThickness), SkIntToScalar(y), |
| 786 SkIntToScalar(x + w + kClientEdgeThickness * 2), | 786 SkIntToScalar(x + w + kClientEdgeThickness * 2), |
| 787 SkIntToScalar(y + h)); | 787 SkIntToScalar(y + h)); |
| 788 canvas->saveLayerAlpha(&bounds, 255); | 788 canvas->AsCanvasSkia()->saveLayerAlpha(&bounds, 255); |
| 789 canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | 789 canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); |
| 790 | 790 |
| 791 SkColor theme_toolbar_color = | 791 SkColor theme_toolbar_color = |
| 792 tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); | 792 tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); |
| 793 canvas->FillRectInt(theme_toolbar_color, x, bottom_y, w, bottom_edge_height); | 793 canvas->FillRectInt(theme_toolbar_color, x, bottom_y, w, bottom_edge_height); |
| 794 | 794 |
| 795 int strip_height = browser_view_->GetTabStripHeight(); | 795 int strip_height = browser_view_->GetTabStripHeight(); |
| 796 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); | 796 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); |
| 797 | 797 |
| 798 canvas->TileImageInt(*theme_toolbar, | 798 canvas->TileImageInt(*theme_toolbar, |
| 799 x - kClientEdgeThickness, | 799 x - kClientEdgeThickness, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 829 // Mask the right edge. | 829 // Mask the right edge. |
| 830 int right_x = x + w - toolbar_right_mask->width() + kClientEdgeThickness + | 830 int right_x = x + w - toolbar_right_mask->width() + kClientEdgeThickness + |
| 831 kContentEdgeShadowThickness; | 831 kContentEdgeShadowThickness; |
| 832 canvas->DrawBitmapInt(*toolbar_right_mask, 0, 0, | 832 canvas->DrawBitmapInt(*toolbar_right_mask, 0, 0, |
| 833 toolbar_right_mask->width(), split_point, right_x, y, | 833 toolbar_right_mask->width(), split_point, right_x, y, |
| 834 toolbar_right_mask->width(), split_point, false, paint); | 834 toolbar_right_mask->width(), split_point, false, paint); |
| 835 canvas->DrawBitmapInt(*toolbar_right_mask, 0, | 835 canvas->DrawBitmapInt(*toolbar_right_mask, 0, |
| 836 toolbar_right_mask->height() - bottom_edge_height, | 836 toolbar_right_mask->height() - bottom_edge_height, |
| 837 toolbar_right_mask->width(), bottom_edge_height, right_x, bottom_y, | 837 toolbar_right_mask->width(), bottom_edge_height, right_x, bottom_y, |
| 838 toolbar_right_mask->width(), bottom_edge_height, false, paint); | 838 toolbar_right_mask->width(), bottom_edge_height, false, paint); |
| 839 canvas->restore(); | 839 canvas->AsCanvasSkia()->restore(); |
| 840 | 840 |
| 841 canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point, | 841 canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point, |
| 842 left_x, y, | 842 left_x, y, |
| 843 toolbar_left->width(), split_point, false); | 843 toolbar_left->width(), split_point, false); |
| 844 canvas->DrawBitmapInt(*toolbar_left, 0, | 844 canvas->DrawBitmapInt(*toolbar_left, 0, |
| 845 toolbar_left->height() - bottom_edge_height, toolbar_left->width(), | 845 toolbar_left->height() - bottom_edge_height, toolbar_left->width(), |
| 846 bottom_edge_height, left_x, bottom_y, | 846 bottom_edge_height, left_x, bottom_y, |
| 847 toolbar_left->width(), bottom_edge_height, false); | 847 toolbar_left->width(), bottom_edge_height, false); |
| 848 | 848 |
| 849 SkBitmap* toolbar_center = | 849 SkBitmap* toolbar_center = |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 // static | 1080 // static |
| 1081 gfx::Rect OpaqueBrowserFrameView::GetViewBounds(views::View* src, | 1081 gfx::Rect OpaqueBrowserFrameView::GetViewBounds(views::View* src, |
| 1082 views::View* dst) { | 1082 views::View* dst) { |
| 1083 gfx::Rect bounds(src->bounds()); | 1083 gfx::Rect bounds(src->bounds()); |
| 1084 | 1084 |
| 1085 gfx::Point origin_in_dst(bounds.origin()); | 1085 gfx::Point origin_in_dst(bounds.origin()); |
| 1086 View::ConvertPointToView(src->GetParent(), dst, &origin_in_dst); | 1086 View::ConvertPointToView(src->GetParent(), dst, &origin_in_dst); |
| 1087 bounds.set_origin(origin_in_dst); | 1087 bounds.set_origin(origin_in_dst); |
| 1088 return bounds; | 1088 return bounds; |
| 1089 } | 1089 } |
| OLD | NEW |