Chromium Code Reviews| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 } | 439 } |
| 440 | 440 |
| 441 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { | 441 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { |
| 442 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); | 442 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); |
| 443 } | 443 } |
| 444 | 444 |
| 445 //////////////////////////////////////////////////////////////////////////////// | 445 //////////////////////////////////////////////////////////////////////////////// |
| 446 // NativeWidgetAura, views::InputMethodDelegate implementation: | 446 // NativeWidgetAura, views::InputMethodDelegate implementation: |
| 447 | 447 |
| 448 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { | 448 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { |
| 449 delegate_->OnKeyEvent(key); | 449 if (delegate_->OnKeyEvent(key)) |
| 450 return; | |
| 451 if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager()) | |
|
Ben Goodger (Google)
2011/10/26 19:06:04
Is it standard practice to dispatch accelerators/t
mazda
2011/10/27 13:05:05
I think so.
While users compose text with IME, the
| |
| 452 GetWidget()->GetFocusManager()->OnKeyEvent(key); | |
| 450 } | 453 } |
| 451 | 454 |
| 452 //////////////////////////////////////////////////////////////////////////////// | 455 //////////////////////////////////////////////////////////////////////////////// |
| 453 // NativeWidgetAura, aura::WindowDelegate implementation: | 456 // NativeWidgetAura, aura::WindowDelegate implementation: |
| 454 | 457 |
| 455 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 458 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
| 456 const gfx::Rect& new_bounds) { | 459 const gfx::Rect& new_bounds) { |
| 457 if (old_bounds.size() != new_bounds.size()) | 460 if (old_bounds.size() != new_bounds.size()) |
| 458 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); | 461 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); |
| 459 } | 462 } |
| 460 | 463 |
| 461 void NativeWidgetAura::OnFocus() { | 464 void NativeWidgetAura::OnFocus() { |
| 462 Widget* widget = GetWidget(); | 465 Widget* widget = GetWidget(); |
| 463 if (widget->is_top_level()) { | 466 if (widget->is_top_level()) { |
| 464 InputMethod* input_method = widget->GetInputMethod(); | 467 InputMethod* input_method = widget->GetInputMethod(); |
| 465 input_method->OnFocus(); | 468 input_method->OnFocus(); |
| 466 // See description of got_initial_focus_in_ for details on this. | 469 // See description of got_initial_focus_in_ for details on this. |
| 467 widget->GetFocusManager()->RestoreFocusedView(); | 470 // TODO(mazda): Investigate this is actually necessary. |
| 471 // widget->GetFocusManager()->RestoreFocusedView(); | |
| 468 } | 472 } |
| 469 delegate_->OnNativeFocus(window_); | 473 delegate_->OnNativeFocus(window_); |
| 470 } | 474 } |
| 471 | 475 |
| 472 void NativeWidgetAura::OnBlur() { | 476 void NativeWidgetAura::OnBlur() { |
| 473 Widget* widget = GetWidget(); | 477 Widget* widget = GetWidget(); |
| 474 if (widget->is_top_level()) { | 478 if (widget->is_top_level()) { |
| 475 InputMethod* input_method = widget->GetInputMethod(); | 479 InputMethod* input_method = widget->GetInputMethod(); |
| 476 input_method->OnBlur(); | 480 input_method->OnBlur(); |
| 477 widget->GetFocusManager()->StoreFocusedView(); | 481 widget->GetFocusManager()->StoreFocusedView(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 } | 648 } |
| 645 | 649 |
| 646 // static | 650 // static |
| 647 bool NativeWidgetPrivate::IsMouseButtonDown() { | 651 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 648 NOTIMPLEMENTED(); | 652 NOTIMPLEMENTED(); |
| 649 return false; | 653 return false; |
| 650 } | 654 } |
| 651 | 655 |
| 652 } // namespace internal | 656 } // namespace internal |
| 653 } // namespace views | 657 } // namespace views |
| OLD | NEW |