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/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "third_party/skia/include/pathops/SkPathOps.h" | 42 #include "third_party/skia/include/pathops/SkPathOps.h" |
43 #include "ui/accessibility/ax_view_state.h" | 43 #include "ui/accessibility/ax_view_state.h" |
44 #include "ui/base/default_theme_provider.h" | 44 #include "ui/base/default_theme_provider.h" |
45 #include "ui/base/dragdrop/drag_drop_types.h" | 45 #include "ui/base/dragdrop/drag_drop_types.h" |
46 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
47 #include "ui/base/material_design/material_design_controller.h" | 47 #include "ui/base/material_design/material_design_controller.h" |
48 #include "ui/base/models/list_selection_model.h" | 48 #include "ui/base/models/list_selection_model.h" |
49 #include "ui/base/resource/resource_bundle.h" | 49 #include "ui/base/resource/resource_bundle.h" |
50 #include "ui/compositor/compositing_recorder.h" | 50 #include "ui/compositor/compositing_recorder.h" |
51 #include "ui/compositor/paint_recorder.h" | 51 #include "ui/compositor/paint_recorder.h" |
| 52 #include "ui/display/display.h" |
| 53 #include "ui/display/screen.h" |
52 #include "ui/gfx/animation/animation_container.h" | 54 #include "ui/gfx/animation/animation_container.h" |
53 #include "ui/gfx/animation/throb_animation.h" | 55 #include "ui/gfx/animation/throb_animation.h" |
54 #include "ui/gfx/canvas.h" | 56 #include "ui/gfx/canvas.h" |
55 #include "ui/gfx/display.h" | |
56 #include "ui/gfx/geometry/rect_conversions.h" | 57 #include "ui/gfx/geometry/rect_conversions.h" |
57 #include "ui/gfx/geometry/size.h" | 58 #include "ui/gfx/geometry/size.h" |
58 #include "ui/gfx/image/image_skia.h" | 59 #include "ui/gfx/image/image_skia.h" |
59 #include "ui/gfx/image/image_skia_operations.h" | 60 #include "ui/gfx/image/image_skia_operations.h" |
60 #include "ui/gfx/path.h" | 61 #include "ui/gfx/path.h" |
61 #include "ui/gfx/scoped_canvas.h" | 62 #include "ui/gfx/scoped_canvas.h" |
62 #include "ui/gfx/screen.h" | |
63 #include "ui/gfx/skia_util.h" | 63 #include "ui/gfx/skia_util.h" |
64 #include "ui/views/controls/image_view.h" | 64 #include "ui/views/controls/image_view.h" |
65 #include "ui/views/masked_targeter_delegate.h" | 65 #include "ui/views/masked_targeter_delegate.h" |
66 #include "ui/views/mouse_watcher_view_host.h" | 66 #include "ui/views/mouse_watcher_view_host.h" |
67 #include "ui/views/rect_based_targeting_utils.h" | 67 #include "ui/views/rect_based_targeting_utils.h" |
68 #include "ui/views/view_model_utils.h" | 68 #include "ui/views/view_model_utils.h" |
69 #include "ui/views/view_targeter.h" | 69 #include "ui/views/view_targeter.h" |
70 #include "ui/views/widget/root_view.h" | 70 #include "ui/views/widget/root_view.h" |
71 #include "ui/views/widget/widget.h" | 71 #include "ui/views/widget/widget.h" |
72 #include "ui/views/window/non_client_view.h" | 72 #include "ui/views/window/non_client_view.h" |
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 center_x = GetMirroredXInView(center_x); | 2358 center_x = GetMirroredXInView(center_x); |
2359 | 2359 |
2360 // Determine the screen bounds. | 2360 // Determine the screen bounds. |
2361 gfx::Point drop_loc(center_x - drop_indicator_width / 2, | 2361 gfx::Point drop_loc(center_x - drop_indicator_width / 2, |
2362 -drop_indicator_height); | 2362 -drop_indicator_height); |
2363 ConvertPointToScreen(this, &drop_loc); | 2363 ConvertPointToScreen(this, &drop_loc); |
2364 gfx::Rect drop_bounds(drop_loc.x(), drop_loc.y(), drop_indicator_width, | 2364 gfx::Rect drop_bounds(drop_loc.x(), drop_loc.y(), drop_indicator_width, |
2365 drop_indicator_height); | 2365 drop_indicator_height); |
2366 | 2366 |
2367 // If the rect doesn't fit on the monitor, push the arrow to the bottom. | 2367 // If the rect doesn't fit on the monitor, push the arrow to the bottom. |
2368 gfx::Screen* screen = gfx::Screen::GetScreen(); | 2368 display::Screen* screen = display::Screen::GetScreen(); |
2369 gfx::Display display = screen->GetDisplayMatching(drop_bounds); | 2369 display::Display display = screen->GetDisplayMatching(drop_bounds); |
2370 *is_beneath = !display.bounds().Contains(drop_bounds); | 2370 *is_beneath = !display.bounds().Contains(drop_bounds); |
2371 if (*is_beneath) | 2371 if (*is_beneath) |
2372 drop_bounds.Offset(0, drop_bounds.height() + height()); | 2372 drop_bounds.Offset(0, drop_bounds.height() + height()); |
2373 | 2373 |
2374 return drop_bounds; | 2374 return drop_bounds; |
2375 } | 2375 } |
2376 | 2376 |
2377 void TabStrip::UpdateDropIndex(const DropTargetEvent& event) { | 2377 void TabStrip::UpdateDropIndex(const DropTargetEvent& event) { |
2378 // If the UI layout is right-to-left, we need to mirror the mouse | 2378 // If the UI layout is right-to-left, we need to mirror the mouse |
2379 // coordinates since we calculate the drop index based on the | 2379 // coordinates since we calculate the drop index based on the |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2891 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2891 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2892 if (view) | 2892 if (view) |
2893 return view; | 2893 return view; |
2894 } | 2894 } |
2895 Tab* tab = FindTabForEvent(point); | 2895 Tab* tab = FindTabForEvent(point); |
2896 if (tab) | 2896 if (tab) |
2897 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2897 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2898 } | 2898 } |
2899 return this; | 2899 return this; |
2900 } | 2900 } |
OLD | NEW |