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/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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/views/tabs/base_tab.h" | 23 #include "chrome/browser/views/tabs/base_tab.h" |
24 #include "chrome/browser/views/tabs/base_tab_strip.h" | 24 #include "chrome/browser/views/tabs/base_tab_strip.h" |
25 #include "chrome/browser/views/tabs/browser_tab_strip_controller.h" | 25 #include "chrome/browser/views/tabs/browser_tab_strip_controller.h" |
26 #include "chrome/browser/views/tabs/dragged_tab_view.h" | 26 #include "chrome/browser/views/tabs/dragged_tab_view.h" |
27 #include "chrome/browser/views/tabs/native_view_photobooth.h" | 27 #include "chrome/browser/views/tabs/native_view_photobooth.h" |
28 #include "chrome/browser/views/tabs/side_tab.h" | 28 #include "chrome/browser/views/tabs/side_tab.h" |
29 #include "chrome/browser/views/tabs/side_tab_strip.h" | 29 #include "chrome/browser/views/tabs/side_tab_strip.h" |
30 #include "chrome/browser/views/tabs/tab.h" | 30 #include "chrome/browser/views/tabs/tab.h" |
31 #include "chrome/browser/views/tabs/tab_strip.h" | 31 #include "chrome/browser/views/tabs/tab_strip.h" |
32 #include "chrome/common/notification_service.h" | 32 #include "chrome/common/notification_service.h" |
33 #include "gfx/canvas_skia.h" | 33 #include "gfx/canvas.h" |
34 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
35 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
36 #include "views/event.h" | 36 #include "views/event.h" |
37 #include "views/widget/root_view.h" | 37 #include "views/widget/root_view.h" |
38 #include "views/widget/widget.h" | 38 #include "views/widget/widget.h" |
39 #include "views/window/window.h" | 39 #include "views/window/window.h" |
40 | 40 |
41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
42 #include "views/widget/widget_win.h" | 42 #include "views/widget/widget_win.h" |
43 #endif | 43 #endif |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 virtual void PaintBackground(gfx::Canvas* canvas) { | 79 virtual void PaintBackground(gfx::Canvas* canvas) { |
80 SkRect outer_rect = { SkIntToScalar(0), SkIntToScalar(0), | 80 SkRect outer_rect = { SkIntToScalar(0), SkIntToScalar(0), |
81 SkIntToScalar(width()), | 81 SkIntToScalar(width()), |
82 SkIntToScalar(height()) }; | 82 SkIntToScalar(height()) }; |
83 | 83 |
84 // Fill the background rect. | 84 // Fill the background rect. |
85 SkPaint paint; | 85 SkPaint paint; |
86 paint.setColor(SkColorSetRGB(108, 108, 108)); | 86 paint.setColor(SkColorSetRGB(108, 108, 108)); |
87 paint.setStyle(SkPaint::kFill_Style); | 87 paint.setStyle(SkPaint::kFill_Style); |
88 canvas->AsCanvasSkia()->drawRoundRect( | 88 canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius), |
89 outer_rect, SkIntToScalar(kRoundedRectRadius), | 89 SkIntToScalar(kRoundedRectRadius), paint); |
90 SkIntToScalar(kRoundedRectRadius), paint); | |
91 | 90 |
92 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 91 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
93 | 92 |
94 SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH); | 93 SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH); |
95 SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE); | 94 SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE); |
96 | 95 |
97 bool rtl_ui = base::i18n::IsRTL(); | 96 bool rtl_ui = base::i18n::IsRTL(); |
98 if (rtl_ui) { | 97 if (rtl_ui) { |
99 // Flip canvas to draw the mirrored tab images for RTL UI. | 98 // Flip canvas to draw the mirrored tab images for RTL UI. |
100 canvas->AsCanvasSkia()->save(); | 99 canvas->save(); |
101 canvas->TranslateInt(width(), 0); | 100 canvas->TranslateInt(width(), 0); |
102 canvas->ScaleInt(-1, 1); | 101 canvas->ScaleInt(-1, 1); |
103 } | 102 } |
104 int x_of_active_tab = -1; | 103 int x_of_active_tab = -1; |
105 int x_of_inactive_tab = -1; | 104 int x_of_inactive_tab = -1; |
106 switch (type_) { | 105 switch (type_) { |
107 case DockInfo::LEFT_OF_WINDOW: | 106 case DockInfo::LEFT_OF_WINDOW: |
108 case DockInfo::LEFT_HALF: | 107 case DockInfo::LEFT_HALF: |
109 if (!rtl_ui) { | 108 if (!rtl_ui) { |
110 x_of_active_tab = width() / 2 - high_icon->width() - kTabSpacing / 2; | 109 x_of_active_tab = width() / 2 - high_icon->width() - kTabSpacing / 2; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 (width() - wide_icon->width()) / 2, | 163 (width() - wide_icon->width()) / 2, |
165 height() / 2 - kTabSpacing / 2 - wide_icon->height()); | 164 height() / 2 - kTabSpacing / 2 - wide_icon->height()); |
166 } | 165 } |
167 break; | 166 break; |
168 | 167 |
169 default: | 168 default: |
170 NOTREACHED(); | 169 NOTREACHED(); |
171 break; | 170 break; |
172 } | 171 } |
173 if (rtl_ui) | 172 if (rtl_ui) |
174 canvas->AsCanvasSkia()->restore(); | 173 canvas->restore(); |
175 } | 174 } |
176 | 175 |
177 private: | 176 private: |
178 void DrawBitmapWithAlpha(gfx::Canvas* canvas, const SkBitmap& image, | 177 void DrawBitmapWithAlpha(gfx::Canvas* canvas, const SkBitmap& image, |
179 int x, int y) { | 178 int x, int y) { |
180 SkPaint paint; | 179 SkPaint paint; |
181 paint.setAlpha(128); | 180 paint.setAlpha(128); |
182 canvas->DrawBitmapInt(image, x, y, paint); | 181 canvas->DrawBitmapInt(image, x, y, paint); |
183 } | 182 } |
184 | 183 |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 #else | 1326 #else |
1328 NOTIMPLEMENTED(); | 1327 NOTIMPLEMENTED(); |
1329 #endif | 1328 #endif |
1330 } | 1329 } |
1331 } | 1330 } |
1332 | 1331 |
1333 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { | 1332 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { |
1334 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> | 1333 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> |
1335 model(); | 1334 model(); |
1336 } | 1335 } |
OLD | NEW |