OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/views/window/custom_frame_view.h" | 5 #include "ui/views/window/custom_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 "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
11 #include "grit/ui_strings.h" | 11 #include "grit/ui_strings.h" |
12 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/font.h" | 16 #include "ui/gfx/font.h" |
17 #include "ui/gfx/path.h" | 17 #include "ui/gfx/path.h" |
| 18 #include "ui/views/color_constants.h" |
18 #include "ui/views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
19 #include "ui/views/window/client_view.h" | 20 #include "ui/views/window/client_view.h" |
20 #include "ui/views/window/frame_background.h" | 21 #include "ui/views/window/frame_background.h" |
21 #include "ui/views/window/window_resources.h" | 22 #include "ui/views/window/window_resources.h" |
22 #include "ui/views/window/window_shape.h" | 23 #include "ui/views/window/window_shape.h" |
23 | 24 |
24 #if defined(USE_AURA) | 25 #if defined(USE_AURA) |
25 #include "ui/views/widget/native_widget_aura.h" | 26 #include "ui/views/widget/native_widget_aura.h" |
26 #elif defined(OS_WIN) | 27 #elif defined(OS_WIN) |
27 #include "ui/views/widget/native_widget_win.h" | 28 #include "ui/views/widget/native_widget_win.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 client_area_bottom); | 427 client_area_bottom); |
427 canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom, | 428 canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom, |
428 client_area_bounds.width(), bottom_right->height()); | 429 client_area_bounds.width(), bottom_right->height()); |
429 canvas->DrawBitmapInt(*bottom_left, | 430 canvas->DrawBitmapInt(*bottom_left, |
430 client_area_bounds.x() - bottom_left->width(), client_area_bottom); | 431 client_area_bounds.x() - bottom_left->width(), client_area_bottom); |
431 | 432 |
432 // Left. | 433 // Left. |
433 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), | 434 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), |
434 client_area_top, left->width(), client_area_height); | 435 client_area_top, left->width(), client_area_height); |
435 | 436 |
436 // Draw the toolbar color to fill in the edges. | 437 // Draw the color to fill in the edges. |
437 canvas->DrawRect(gfx::Rect(client_area_bounds.x() - 1, client_area_top - 1, | 438 canvas->DrawRect(gfx::Rect(client_area_bounds.x() - 1, client_area_top - 1, |
438 client_area_bounds.width() + 1, client_area_bottom - client_area_top + 1), | 439 client_area_bounds.width() + 1, client_area_bottom - client_area_top + 1), |
439 ui::ResourceBundle::toolbar_color); | 440 kClientEdgeColor); |
440 } | 441 } |
441 | 442 |
442 SkColor CustomFrameView::GetFrameColor() const { | 443 SkColor CustomFrameView::GetFrameColor() const { |
443 return frame_->IsActive() ? kDefaultColorFrame : kDefaultColorFrameInactive; | 444 return frame_->IsActive() ? kDefaultColorFrame : kDefaultColorFrameInactive; |
444 } | 445 } |
445 | 446 |
446 SkBitmap* CustomFrameView::GetFrameBitmap() const { | 447 SkBitmap* CustomFrameView::GetFrameBitmap() const { |
447 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 448 return ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( |
448 frame_->IsActive() ? IDR_FRAME : IDR_FRAME_INACTIVE); | 449 frame_->IsActive() ? IDR_FRAME : IDR_FRAME_INACTIVE); |
449 } | 450 } |
450 | 451 |
451 void CustomFrameView::LayoutWindowControls() { | 452 void CustomFrameView::LayoutWindowControls() { |
452 close_button_->SetImageAlignment(ImageButton::ALIGN_LEFT, | 453 close_button_->SetImageAlignment(ImageButton::ALIGN_LEFT, |
453 ImageButton::ALIGN_BOTTOM); | 454 ImageButton::ALIGN_BOTTOM); |
454 int caption_y = CaptionButtonY(); | 455 int caption_y = CaptionButtonY(); |
455 bool is_maximized = frame_->IsMaximized(); | 456 bool is_maximized = frame_->IsMaximized(); |
456 // There should always be the same number of non-shadow pixels visible to the | 457 // There should always be the same number of non-shadow pixels visible to the |
457 // side of the caption buttons. In maximized mode we extend the rightmost | 458 // side of the caption buttons. In maximized mode we extend the rightmost |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont()); | 556 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont()); |
556 #elif defined(OS_LINUX) | 557 #elif defined(OS_LINUX) |
557 // TODO(ben): need to resolve what font this is. | 558 // TODO(ben): need to resolve what font this is. |
558 title_font_ = new gfx::Font(); | 559 title_font_ = new gfx::Font(); |
559 #endif | 560 #endif |
560 initialized = true; | 561 initialized = true; |
561 } | 562 } |
562 } | 563 } |
563 | 564 |
564 } // namespace views | 565 } // namespace views |
OLD | NEW |