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/native_widget_aura.h" | 5 #include "views/widget/native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/desktop.h" | 8 #include "ui/aura/desktop.h" |
9 #include "ui/aura/event.h" | 9 #include "ui/aura/event.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if (window_) | 412 if (window_) |
413 window_->SchedulePaintInRect(rect); | 413 window_->SchedulePaintInRect(rect); |
414 } | 414 } |
415 | 415 |
416 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { | 416 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { |
417 cursor_ = cursor; | 417 cursor_ = cursor; |
418 aura::Desktop::GetInstance()->SetCursor(cursor); | 418 aura::Desktop::GetInstance()->SetCursor(cursor); |
419 } | 419 } |
420 | 420 |
421 void NativeWidgetAura::ClearNativeFocus() { | 421 void NativeWidgetAura::ClearNativeFocus() { |
422 NOTIMPLEMENTED(); | 422 if (window_ && window_->GetFocusManager()) |
| 423 window_->GetFocusManager()->SetFocusedWindow(window_); |
423 } | 424 } |
424 | 425 |
425 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { | 426 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { |
426 NOTIMPLEMENTED(); | 427 NOTIMPLEMENTED(); |
427 } | 428 } |
428 | 429 |
429 bool NativeWidgetAura::ConvertPointFromAncestor(const Widget* ancestor, | 430 bool NativeWidgetAura::ConvertPointFromAncestor(const Widget* ancestor, |
430 gfx::Point* point) const { | 431 gfx::Point* point) const { |
431 NOTIMPLEMENTED(); | 432 NOTIMPLEMENTED(); |
432 return false; | 433 return false; |
433 } | 434 } |
434 | 435 |
435 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { | 436 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { |
436 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); | 437 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); |
437 } | 438 } |
438 | 439 |
439 //////////////////////////////////////////////////////////////////////////////// | 440 //////////////////////////////////////////////////////////////////////////////// |
440 // NativeWidgetAura, views::InputMethodDelegate implementation: | 441 // NativeWidgetAura, views::InputMethodDelegate implementation: |
441 | 442 |
442 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { | 443 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { |
443 delegate_->OnKeyEvent(key); | 444 if (delegate_->OnKeyEvent(key)) |
| 445 return; |
| 446 if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager()) |
| 447 GetWidget()->GetFocusManager()->OnKeyEvent(key); |
444 } | 448 } |
445 | 449 |
446 //////////////////////////////////////////////////////////////////////////////// | 450 //////////////////////////////////////////////////////////////////////////////// |
447 // NativeWidgetAura, aura::WindowDelegate implementation: | 451 // NativeWidgetAura, aura::WindowDelegate implementation: |
448 | 452 |
449 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 453 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
450 const gfx::Rect& new_bounds) { | 454 const gfx::Rect& new_bounds) { |
451 if (old_bounds.size() != new_bounds.size()) | 455 if (old_bounds.size() != new_bounds.size()) |
452 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); | 456 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); |
453 } | 457 } |
454 | 458 |
455 void NativeWidgetAura::OnFocus() { | 459 void NativeWidgetAura::OnFocus() { |
456 Widget* widget = GetWidget(); | 460 Widget* widget = GetWidget(); |
457 if (widget->is_top_level()) { | 461 if (widget->is_top_level()) { |
458 InputMethod* input_method = widget->GetInputMethod(); | 462 InputMethod* input_method = widget->GetInputMethod(); |
459 input_method->OnFocus(); | 463 input_method->OnFocus(); |
460 // See description of got_initial_focus_in_ for details on this. | 464 // See description of got_initial_focus_in_ for details on this. |
461 widget->GetFocusManager()->RestoreFocusedView(); | 465 // TODO(mazda): Investigate this is actually necessary. |
| 466 // widget->GetFocusManager()->RestoreFocusedView(); |
462 } | 467 } |
463 delegate_->OnNativeFocus(window_); | 468 delegate_->OnNativeFocus(window_); |
464 } | 469 } |
465 | 470 |
466 void NativeWidgetAura::OnBlur() { | 471 void NativeWidgetAura::OnBlur() { |
467 Widget* widget = GetWidget(); | 472 Widget* widget = GetWidget(); |
468 if (widget->is_top_level()) { | 473 if (widget->is_top_level()) { |
469 InputMethod* input_method = widget->GetInputMethod(); | 474 InputMethod* input_method = widget->GetInputMethod(); |
470 input_method->OnBlur(); | 475 input_method->OnBlur(); |
471 widget->GetFocusManager()->StoreFocusedView(); | 476 widget->GetFocusManager()->StoreFocusedView(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 642 } |
638 | 643 |
639 // static | 644 // static |
640 bool NativeWidgetPrivate::IsMouseButtonDown() { | 645 bool NativeWidgetPrivate::IsMouseButtonDown() { |
641 NOTIMPLEMENTED(); | 646 NOTIMPLEMENTED(); |
642 return false; | 647 return false; |
643 } | 648 } |
644 | 649 |
645 } // namespace internal | 650 } // namespace internal |
646 } // namespace views | 651 } // namespace views |
OLD | NEW |