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" |
11 #include "app/slide_animation.h" | 11 #include "app/slide_animation.h" |
12 #include "app/gfx/canvas.h" | 12 #include "app/gfx/canvas.h" |
13 #include "app/l10n_util.h" | 13 #include "app/l10n_util.h" |
14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/i18n/rtl.h" |
16 #include "base/keyboard_codes.h" | 17 #include "base/keyboard_codes.h" |
17 #include "chrome/browser/browser_window.h" | 18 #include "chrome/browser/browser_window.h" |
18 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 19 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
19 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" |
20 #include "chrome/browser/metrics/user_metrics.h" | 21 #include "chrome/browser/metrics/user_metrics.h" |
21 #include "chrome/browser/views/frame/browser_view.h" | 22 #include "chrome/browser/views/frame/browser_view.h" |
22 #include "chrome/browser/views/tabs/dragged_tab_view.h" | 23 #include "chrome/browser/views/tabs/dragged_tab_view.h" |
23 #include "chrome/browser/views/tabs/native_view_photobooth.h" | 24 #include "chrome/browser/views/tabs/native_view_photobooth.h" |
24 #include "chrome/browser/views/tabs/tab.h" | 25 #include "chrome/browser/views/tabs/tab.h" |
25 #include "chrome/browser/views/tabs/tab_strip.h" | 26 #include "chrome/browser/views/tabs/tab_strip.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 paint.setColor(SkColorSetRGB(108, 108, 108)); | 77 paint.setColor(SkColorSetRGB(108, 108, 108)); |
77 paint.setStyle(SkPaint::kFill_Style); | 78 paint.setStyle(SkPaint::kFill_Style); |
78 canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius), | 79 canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius), |
79 SkIntToScalar(kRoundedRectRadius), paint); | 80 SkIntToScalar(kRoundedRectRadius), paint); |
80 | 81 |
81 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 82 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
82 | 83 |
83 SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH); | 84 SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH); |
84 SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE); | 85 SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE); |
85 | 86 |
86 bool rtl_ui = l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT; | 87 bool rtl_ui = base::i18n::IsRTL(); |
87 if (rtl_ui) { | 88 if (rtl_ui) { |
88 // Flip canvas to draw the mirrored tab images for RTL UI. | 89 // Flip canvas to draw the mirrored tab images for RTL UI. |
89 canvas->save(); | 90 canvas->save(); |
90 canvas->TranslateInt(width(), 0); | 91 canvas->TranslateInt(width(), 0); |
91 canvas->ScaleInt(-1, 1); | 92 canvas->ScaleInt(-1, 1); |
92 } | 93 } |
93 int x_of_active_tab = -1; | 94 int x_of_active_tab = -1; |
94 int x_of_inactive_tab = -1; | 95 int x_of_inactive_tab = -1; |
95 switch (type_) { | 96 switch (type_) { |
96 case DockInfo::LEFT_OF_WINDOW: | 97 case DockInfo::LEFT_OF_WINDOW: |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 break; | 1130 break; |
1130 } | 1131 } |
1131 } | 1132 } |
1132 // Compel the model to construct a new window for the detached TabContents. | 1133 // Compel the model to construct a new window for the detached TabContents. |
1133 gfx::Rect browser_rect = source_tabstrip_->GetWindow()->GetBounds(); | 1134 gfx::Rect browser_rect = source_tabstrip_->GetWindow()->GetBounds(); |
1134 gfx::Rect window_bounds( | 1135 gfx::Rect window_bounds( |
1135 GetWindowCreatePoint(), | 1136 GetWindowCreatePoint(), |
1136 gfx::Size(browser_rect.width(), browser_rect.height())); | 1137 gfx::Size(browser_rect.width(), browser_rect.height())); |
1137 // When modifying the following if statement, please make sure not to | 1138 // When modifying the following if statement, please make sure not to |
1138 // introduce issue listed in http://crbug.com/6223 comment #11. | 1139 // introduce issue listed in http://crbug.com/6223 comment #11. |
1139 bool rtl_ui = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); | 1140 bool rtl_ui = base::i18n::IsRTL(); |
1140 bool has_dock_position = (dock_info_.type() != DockInfo::NONE); | 1141 bool has_dock_position = (dock_info_.type() != DockInfo::NONE); |
1141 if (rtl_ui && has_dock_position) { | 1142 if (rtl_ui && has_dock_position) { |
1142 // Mirror X axis so the docked tab is aligned using the mouse click as | 1143 // Mirror X axis so the docked tab is aligned using the mouse click as |
1143 // the top-right corner. | 1144 // the top-right corner. |
1144 window_bounds.set_x(window_bounds.x() - window_bounds.width()); | 1145 window_bounds.set_x(window_bounds.x() - window_bounds.width()); |
1145 } | 1146 } |
1146 Browser* new_browser = | 1147 Browser* new_browser = |
1147 source_tabstrip_->model()->delegate()->CreateNewStripWithContents( | 1148 source_tabstrip_->model()->delegate()->CreateNewStripWithContents( |
1148 dragged_contents_, window_bounds, dock_info_); | 1149 dragged_contents_, window_bounds, dock_info_); |
1149 TabStripModel* new_model = new_browser->tabstrip_model(); | 1150 TabStripModel* new_model = new_browser->tabstrip_model(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 | 1284 |
1284 // The previous call made the window appear on top of the dragged window, | 1285 // The previous call made the window appear on top of the dragged window, |
1285 // move the dragged window to the front. | 1286 // move the dragged window to the front. |
1286 SetWindowPos(view_->GetWidget()->GetNativeView(), HWND_TOP, 0, 0, 0, 0, | 1287 SetWindowPos(view_->GetWidget()->GetNativeView(), HWND_TOP, 0, 0, 0, 0, |
1287 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); | 1288 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
1288 #else | 1289 #else |
1289 NOTIMPLEMENTED(); | 1290 NOTIMPLEMENTED(); |
1290 #endif | 1291 #endif |
1291 } | 1292 } |
1292 } | 1293 } |
OLD | NEW |