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 "ash/wm/common/workspace/multi_window_resize_controller.h" | 5 #include "ash/wm/common/workspace/multi_window_resize_controller.h" |
6 | 6 |
7 #include "ash/wm/common/wm_lookup.h" | 7 #include "ash/wm/common/wm_lookup.h" |
8 #include "ash/wm/common/wm_root_window_controller.h" | 8 #include "ash/wm/common/wm_root_window_controller.h" |
9 #include "ash/wm/common/wm_shell_window_ids.h" | 9 #include "ash/wm/common/wm_shell_window_ids.h" |
10 #include "ash/wm/common/wm_window.h" | 10 #include "ash/wm/common/wm_window.h" |
11 #include "ash/wm/common/workspace/workspace_window_resizer.h" | 11 #include "ash/wm/common/workspace/workspace_window_resizer.h" |
12 #include "grit/ash_wm_common_resources.h" | 12 #include "grit/ash_resources.h" |
13 #include "ui/base/cursor/cursor.h" | 13 #include "ui/base/cursor/cursor.h" |
14 #include "ui/base/hit_test.h" | 14 #include "ui/base/hit_test.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
17 #include "ui/gfx/canvas.h" | 17 #include "ui/gfx/canvas.h" |
18 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
21 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
22 #include "ui/wm/core/compound_event_filter.h" | 22 #include "ui/wm/core/compound_event_filter.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 // View contained in the widget. Passes along mouse events to the | 62 // View contained in the widget. Passes along mouse events to the |
63 // MultiWindowResizeController so that it can start/stop the resize loop. | 63 // MultiWindowResizeController so that it can start/stop the resize loop. |
64 class MultiWindowResizeController::ResizeView : public views::View { | 64 class MultiWindowResizeController::ResizeView : public views::View { |
65 public: | 65 public: |
66 explicit ResizeView(MultiWindowResizeController* controller, | 66 explicit ResizeView(MultiWindowResizeController* controller, |
67 Direction direction) | 67 Direction direction) |
68 : controller_(controller), direction_(direction), image_(NULL) { | 68 : controller_(controller), direction_(direction), image_(NULL) { |
69 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 69 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
70 int image_id = direction == TOP_BOTTOM | 70 int image_id = direction == TOP_BOTTOM ? IDR_AURA_MULTI_WINDOW_RESIZE_H |
71 ? IDR_ASH_WM_COMMON_MULTI_WINDOW_RESIZE_H | 71 : IDR_AURA_MULTI_WINDOW_RESIZE_V; |
72 : IDR_ASH_WM_COMMON_MULTI_WINDOW_RESIZE_V; | |
73 image_ = rb.GetImageNamed(image_id).ToImageSkia(); | 72 image_ = rb.GetImageNamed(image_id).ToImageSkia(); |
74 } | 73 } |
75 | 74 |
76 // views::View overrides: | 75 // views::View overrides: |
77 gfx::Size GetPreferredSize() const override { | 76 gfx::Size GetPreferredSize() const override { |
78 return gfx::Size(image_->width(), image_->height()); | 77 return gfx::Size(image_->width(), image_->height()); |
79 } | 78 } |
80 void OnPaint(gfx::Canvas* canvas) override { | 79 void OnPaint(gfx::Canvas* canvas) override { |
81 canvas->DrawImageInt(*image_, 0, 0); | 80 canvas->DrawImageInt(*image_, 0, 0); |
82 } | 81 } |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 533 |
535 bool MultiWindowResizeController::IsOverComponent( | 534 bool MultiWindowResizeController::IsOverComponent( |
536 wm::WmWindow* window, | 535 wm::WmWindow* window, |
537 const gfx::Point& location_in_screen, | 536 const gfx::Point& location_in_screen, |
538 int component) const { | 537 int component) const { |
539 gfx::Point window_loc = window->ConvertPointFromScreen(location_in_screen); | 538 gfx::Point window_loc = window->ConvertPointFromScreen(location_in_screen); |
540 return window->GetNonClientComponent(window_loc) == component; | 539 return window->GetNonClientComponent(window_loc) == component; |
541 } | 540 } |
542 | 541 |
543 } // namespace ash | 542 } // namespace ash |
OLD | NEW |