| 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/tabs/dragged_tab_controller.h" | 5 #include "chrome/browser/views/tabs/dragged_tab_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/animation.h" | 10 #include "app/animation.h" |
| 11 #include "app/gfx/chrome_canvas.h" | 11 #include "app/gfx/canvas.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "chrome/browser/browser_window.h" | 13 #include "chrome/browser/browser_window.h" |
| 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 15 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 16 #include "chrome/browser/metrics/user_metrics.h" | 16 #include "chrome/browser/metrics/user_metrics.h" |
| 17 #include "chrome/browser/views/frame/browser_view.h" | 17 #include "chrome/browser/views/frame/browser_view.h" |
| 18 #include "chrome/browser/views/tabs/dragged_tab_view.h" | 18 #include "chrome/browser/views/tabs/dragged_tab_view.h" |
| 19 #include "chrome/browser/views/tabs/hwnd_photobooth.h" | 19 #include "chrome/browser/views/tabs/hwnd_photobooth.h" |
| 20 #include "chrome/browser/views/tabs/tab.h" | 20 #include "chrome/browser/views/tabs/tab.h" |
| 21 #include "chrome/browser/views/tabs/tab_strip.h" | 21 #include "chrome/browser/views/tabs/tab_strip.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 44 // dock is going to occur. | 44 // dock is going to occur. |
| 45 | 45 |
| 46 class DockView : public views::View { | 46 class DockView : public views::View { |
| 47 public: | 47 public: |
| 48 explicit DockView(DockInfo::Type type) : type_(type) {} | 48 explicit DockView(DockInfo::Type type) : type_(type) {} |
| 49 | 49 |
| 50 virtual gfx::Size GetPreferredSize() { | 50 virtual gfx::Size GetPreferredSize() { |
| 51 return gfx::Size(DockInfo::popup_width(), DockInfo::popup_height()); | 51 return gfx::Size(DockInfo::popup_width(), DockInfo::popup_height()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void PaintBackground(ChromeCanvas* canvas) { | 54 virtual void PaintBackground(gfx::Canvas* canvas) { |
| 55 SkRect outer_rect = { SkIntToScalar(0), SkIntToScalar(0), | 55 SkRect outer_rect = { SkIntToScalar(0), SkIntToScalar(0), |
| 56 SkIntToScalar(width()), | 56 SkIntToScalar(width()), |
| 57 SkIntToScalar(height()) }; | 57 SkIntToScalar(height()) }; |
| 58 | 58 |
| 59 // Fill the background rect. | 59 // Fill the background rect. |
| 60 SkPaint paint; | 60 SkPaint paint; |
| 61 paint.setColor(SkColorSetRGB(108, 108, 108)); | 61 paint.setColor(SkColorSetRGB(108, 108, 108)); |
| 62 paint.setStyle(SkPaint::kFill_Style); | 62 paint.setStyle(SkPaint::kFill_Style); |
| 63 canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius), | 63 canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius), |
| 64 SkIntToScalar(kRoundedRectRadius), paint); | 64 SkIntToScalar(kRoundedRectRadius), paint); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (type_ == DockInfo::BOTTOM_OF_WINDOW) { | 111 if (type_ == DockInfo::BOTTOM_OF_WINDOW) { |
| 112 DrawBitmapWithAlpha(canvas, *wide_icon, | 112 DrawBitmapWithAlpha(canvas, *wide_icon, |
| 113 (width() - wide_icon->width()) / 2, | 113 (width() - wide_icon->width()) / 2, |
| 114 height() / 2 - kTabSpacing / 2 - wide_icon->height()); | 114 height() / 2 - kTabSpacing / 2 - wide_icon->height()); |
| 115 } | 115 } |
| 116 break; | 116 break; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 void DrawBitmapWithAlpha(ChromeCanvas* canvas, const SkBitmap& image, | 121 void DrawBitmapWithAlpha(gfx::Canvas* canvas, const SkBitmap& image, |
| 122 int x, int y) { | 122 int x, int y) { |
| 123 SkPaint paint; | 123 SkPaint paint; |
| 124 paint.setAlpha(128); | 124 paint.setAlpha(128); |
| 125 canvas->DrawBitmapInt(image, x, y, paint); | 125 canvas->DrawBitmapInt(image, x, y, paint); |
| 126 } | 126 } |
| 127 | 127 |
| 128 DockInfo::Type type_; | 128 DockInfo::Type type_; |
| 129 | 129 |
| 130 DISALLOW_COPY_AND_ASSIGN(DockView); | 130 DISALLOW_COPY_AND_ASSIGN(DockView); |
| 131 }; | 131 }; |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 // Move the window to the front. | 1156 // Move the window to the front. |
| 1157 SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, | 1157 SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, |
| 1158 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); | 1158 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
| 1159 | 1159 |
| 1160 // The previous call made the window appear on top of the dragged window, | 1160 // The previous call made the window appear on top of the dragged window, |
| 1161 // move the dragged window to the front. | 1161 // move the dragged window to the front. |
| 1162 SetWindowPos(view_->GetWidget()->GetNativeView(), HWND_TOP, 0, 0, 0, 0, | 1162 SetWindowPos(view_->GetWidget()->GetNativeView(), HWND_TOP, 0, 0, 0, 0, |
| 1163 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); | 1163 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
| 1164 } | 1164 } |
| 1165 } | 1165 } |
| OLD | NEW |