| 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/panels/panel_frame_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_frame_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/panels/panel.h" | 7 #include "chrome/browser/ui/panels/panel.h" |
| 8 #include "chrome/browser/ui/panels/panel_constants.h" | 8 #include "chrome/browser/ui/panels/panel_constants.h" |
| 9 #include "chrome/browser/ui/views/panels/panel_view.h" | 9 #include "chrome/browser/ui/views/panels/panel_view.h" |
| 10 #include "chrome/browser/ui/views/tab_icon_view.h" | 10 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 14 #include "grit/ui_resources.h" | 14 #include "grit/ui_resources.h" |
| 15 #include "ui/aura/window.h" |
| 15 #include "ui/base/hit_test.h" | 16 #include "ui/base/hit_test.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 19 #include "ui/gfx/font_list.h" | 20 #include "ui/gfx/font_list.h" |
| 20 #include "ui/gfx/path.h" | 21 #include "ui/gfx/path.h" |
| 21 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 22 #include "ui/views/controls/button/image_button.h" | 23 #include "ui/views/controls/button/image_button.h" |
| 23 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 24 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 25 #include "ui/views/widget/widget_delegate.h" | 26 #include "ui/views/widget/widget_delegate.h" |
| 26 | 27 |
| 27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 28 #include "base/win/scoped_gdi_object.h" | 29 #include "base/win/scoped_gdi_object.h" |
| 29 #include "ui/base/win/shell.h" | 30 #include "ui/base/win/shell.h" |
| 30 #include "ui/gfx/path_win.h" | 31 #include "ui/gfx/path_win.h" |
| 31 #include "ui/views/win/hwnd_util.h" | 32 #include "ui/views/win/hwnd_util.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 #if defined(USE_AURA) | |
| 35 #include "ui/aura/window.h" | |
| 36 #endif | |
| 37 | |
| 38 namespace { | 35 namespace { |
| 39 | 36 |
| 40 // The thickness of the border when Aero is not enabled. In this case, the | 37 // The thickness of the border when Aero is not enabled. In this case, the |
| 41 // shadow around the window will not be painted by the system and we need to | 38 // shadow around the window will not be painted by the system and we need to |
| 42 // paint a frame in order to differentiate the client area from the background. | 39 // paint a frame in order to differentiate the client area from the background. |
| 43 const int kNonAeroBorderThickness = 1; | 40 const int kNonAeroBorderThickness = 1; |
| 44 | 41 |
| 45 // The height and width in pixels of the icon. | 42 // The height and width in pixels of the icon. |
| 46 const int kIconSize = 16; | 43 const int kIconSize = 16; |
| 47 | 44 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 AddChildView(title_icon_); | 302 AddChildView(title_icon_); |
| 306 title_icon_->Update(); | 303 title_icon_->Update(); |
| 307 | 304 |
| 308 title_label_ = new views::Label( | 305 title_label_ = new views::Label( |
| 309 panel_view_->panel()->GetWindowTitle(), | 306 panel_view_->panel()->GetWindowTitle(), |
| 310 rb.GetFontList(ui::ResourceBundle::BoldFont)); | 307 rb.GetFontList(ui::ResourceBundle::BoldFont)); |
| 311 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 308 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 312 title_label_->SetAutoColorReadabilityEnabled(false); | 309 title_label_->SetAutoColorReadabilityEnabled(false); |
| 313 AddChildView(title_label_); | 310 AddChildView(title_label_); |
| 314 | 311 |
| 315 #if defined(USE_AURA) | |
| 316 // Compute the thickness of the client area that needs to be counted towards | 312 // Compute the thickness of the client area that needs to be counted towards |
| 317 // mouse resizing. | 313 // mouse resizing. |
| 318 // TODO(tdanderson): Remove this if possible (crbug.com/344924). | 314 // TODO(tdanderson): Remove this if possible (crbug.com/344924). |
| 319 int thickness_for_mouse_resizing = | 315 int thickness_for_mouse_resizing = |
| 320 PanelView::kResizeInsideBoundsSize - BorderThickness(); | 316 PanelView::kResizeInsideBoundsSize - BorderThickness(); |
| 321 aura::Window* window = panel_view_->GetNativePanelWindow(); | 317 aura::Window* window = panel_view_->GetNativePanelWindow(); |
| 322 window->set_hit_test_bounds_override_inner( | 318 window->set_hit_test_bounds_override_inner( |
| 323 gfx::Insets(thickness_for_mouse_resizing, thickness_for_mouse_resizing, | 319 gfx::Insets(thickness_for_mouse_resizing, thickness_for_mouse_resizing, |
| 324 thickness_for_mouse_resizing, thickness_for_mouse_resizing)); | 320 thickness_for_mouse_resizing, thickness_for_mouse_resizing)); |
| 325 #endif | |
| 326 } | 321 } |
| 327 | 322 |
| 328 void PanelFrameView::UpdateTitle() { | 323 void PanelFrameView::UpdateTitle() { |
| 329 UpdateWindowTitle(); | 324 UpdateWindowTitle(); |
| 330 } | 325 } |
| 331 | 326 |
| 332 void PanelFrameView::UpdateIcon() { | 327 void PanelFrameView::UpdateIcon() { |
| 333 UpdateWindowIcon(); | 328 UpdateWindowIcon(); |
| 334 } | 329 } |
| 335 | 330 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 759 |
| 765 // Draw the left border. | 760 // Draw the left border. |
| 766 canvas->TileImageInt(left_image, | 761 canvas->TileImageInt(left_image, |
| 767 0, | 762 0, |
| 768 top_left_image.height(), | 763 top_left_image.height(), |
| 769 left_image.width(), | 764 left_image.width(), |
| 770 height() - top_left_image.height() - | 765 height() - top_left_image.height() - |
| 771 bottom_left_image.height()); | 766 bottom_left_image.height()); |
| 772 #endif | 767 #endif |
| 773 } | 768 } |
| OLD | NEW |