OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "views/desktop/desktop_window_root_view.h" | |
6 | |
7 #include "views/desktop/desktop_window_view.h" | |
8 #include "views/widget/native_widget_view.h" | |
9 #include "views/widget/widget.h" | |
10 | |
11 namespace views { | |
12 namespace desktop { | |
13 | |
14 //////////////////////////////////////////////////////////////////////////////// | |
15 // DesktopWindowRootView, public: | |
16 | |
17 DesktopWindowRootView::DesktopWindowRootView( | |
18 DesktopWindowView* desktop_window_view, | |
19 Widget* window) | |
20 : internal::RootView(window), | |
21 desktop_window_view_(desktop_window_view) { | |
22 } | |
23 | |
24 DesktopWindowRootView::~DesktopWindowRootView() { | |
25 } | |
26 | |
27 //////////////////////////////////////////////////////////////////////////////// | |
28 // DesktopWindowRootView, internal::RootView overrides: | |
29 | |
30 bool DesktopWindowRootView::OnMousePressed(const MouseEvent& event) { | |
31 ActivateWidgetAtLocation(event.location()); | |
32 return RootView::OnMousePressed(event); | |
33 } | |
34 | |
35 ui::TouchStatus DesktopWindowRootView::OnTouchEvent(const TouchEvent& event) { | |
36 ActivateWidgetAtLocation(event.location()); | |
37 return RootView::OnTouchEvent(event); | |
38 } | |
39 | |
40 //////////////////////////////////////////////////////////////////////////////// | |
41 // DesktopWindowRootView, private | |
42 | |
43 void DesktopWindowRootView::ActivateWidgetAtLocation(const gfx::Point& point) { | |
44 View* target = GetEventHandlerForPoint(point); | |
45 if (target->GetClassName() == internal::NativeWidgetView::kViewClassName) { | |
46 internal::NativeWidgetView* native_widget_view = | |
47 static_cast<internal::NativeWidgetView*>(target); | |
48 desktop_window_view_->ActivateWidget( | |
49 native_widget_view->GetAssociatedWidget()); | |
50 } else { | |
51 desktop_window_view_->ActivateWidget(NULL); | |
52 } | |
53 } | |
54 | |
55 } // namespace desktop | |
56 } // namespace views | |
OLD | NEW |