| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "views/desktop/desktop_window_root_view.h" | 5 #include "views/desktop/desktop_window_root_view.h" |
| 6 | 6 |
| 7 #include "views/desktop/desktop_window_view.h" | 7 #include "views/desktop/desktop_window_view.h" |
| 8 #include "views/widget/native_widget_view.h" | 8 #include "views/widget/native_widget_view.h" |
| 9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 desktop_window_view_(desktop_window_view) { | 21 desktop_window_view_(desktop_window_view) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 DesktopWindowRootView::~DesktopWindowRootView() { | 24 DesktopWindowRootView::~DesktopWindowRootView() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 28 // DesktopWindowRootView, internal::RootView overrides: | 28 // DesktopWindowRootView, internal::RootView overrides: |
| 29 | 29 |
| 30 bool DesktopWindowRootView::OnMousePressed(const MouseEvent& event) { | 30 bool DesktopWindowRootView::OnMousePressed(const MouseEvent& event) { |
| 31 View* target = GetEventHandlerForPoint(event.location()); | 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); |
| 32 if (target->GetClassName() == internal::NativeWidgetView::kViewClassName) { | 45 if (target->GetClassName() == internal::NativeWidgetView::kViewClassName) { |
| 33 internal::NativeWidgetView* native_widget_view = | 46 internal::NativeWidgetView* native_widget_view = |
| 34 static_cast<internal::NativeWidgetView*>(target); | 47 static_cast<internal::NativeWidgetView*>(target); |
| 35 desktop_window_view_->ActivateWidget( | 48 desktop_window_view_->ActivateWidget( |
| 36 native_widget_view->GetAssociatedWidget()); | 49 native_widget_view->GetAssociatedWidget()); |
| 37 } else { | 50 } else { |
| 38 desktop_window_view_->ActivateWidget(NULL); | 51 desktop_window_view_->ActivateWidget(NULL); |
| 39 } | 52 } |
| 40 return RootView::OnMousePressed(event); | |
| 41 } | 53 } |
| 42 | 54 |
| 43 } // namespace desktop | 55 } // namespace desktop |
| 44 } // namespace views | 56 } // namespace views |
| OLD | NEW |