| 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/widget/widget.h" | 5 #include "views/widget/widget.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "ui/gfx/compositor/compositor.h" | 9 #include "ui/gfx/compositor/compositor.h" |
| 10 #include "views/focus/view_storage.h" | 10 #include "views/focus/view_storage.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 bool Widget::HasFocusManager() const { | 314 bool Widget::HasFocusManager() const { |
| 315 return !!focus_manager_.get(); | 315 return !!focus_manager_.get(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { | 318 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { |
| 319 GetRootView()->Paint(canvas); | 319 GetRootView()->Paint(canvas); |
| 320 RefreshCompositeTree(); | 320 RefreshCompositeTree(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 bool Widget::OnKeyEvent(const KeyEvent& event) { |
| 324 return GetRootView()->OnKeyEvent(event); |
| 325 } |
| 326 |
| 323 bool Widget::OnMouseEvent(const MouseEvent& event) { | 327 bool Widget::OnMouseEvent(const MouseEvent& event) { |
| 324 switch (event.type()) { | 328 switch (event.type()) { |
| 325 case ui::ET_MOUSE_PRESSED: | 329 case ui::ET_MOUSE_PRESSED: |
| 326 last_mouse_event_was_move_ = false; | 330 last_mouse_event_was_move_ = false; |
| 327 if (GetRootView()->OnMousePressed(event)) { | 331 if (GetRootView()->OnMousePressed(event)) { |
| 328 is_mouse_button_pressed_ = true; | 332 is_mouse_button_pressed_ = true; |
| 329 if (!native_widget_->HasMouseCapture()) | 333 if (!native_widget_->HasMouseCapture()) |
| 330 native_widget_->SetMouseCapture(); | 334 native_widget_->SetMouseCapture(); |
| 331 return true; | 335 return true; |
| 332 } | 336 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 compositor_ = ui::Compositor::Create(widget); | 446 compositor_ = ui::Compositor::Create(widget); |
| 443 | 447 |
| 444 return compositor_.get() != NULL; | 448 return compositor_.get() != NULL; |
| 445 } | 449 } |
| 446 | 450 |
| 447 bool Widget::ShouldReleaseCaptureOnMouseReleased() const { | 451 bool Widget::ShouldReleaseCaptureOnMouseReleased() const { |
| 448 return true; | 452 return true; |
| 449 } | 453 } |
| 450 | 454 |
| 451 } // namespace views | 455 } // namespace views |
| OLD | NEW |