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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 if (window_) | 406 if (window_) |
| 407 window_->SchedulePaintInRect(rect); | 407 window_->SchedulePaintInRect(rect); |
| 408 } | 408 } |
| 409 | 409 |
| 410 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { | 410 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { |
| 411 cursor_ = cursor; | 411 cursor_ = cursor; |
| 412 aura::Desktop::GetInstance()->SetCursor(cursor); | 412 aura::Desktop::GetInstance()->SetCursor(cursor); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void NativeWidgetAura::ClearNativeFocus() { | 415 void NativeWidgetAura::ClearNativeFocus() { |
| 416 NOTIMPLEMENTED(); | 416 if (window_ && window_->GetFocusManager()) |
| 417 window_->GetFocusManager()->SetFocusedWindow(window_); | |
| 417 } | 418 } |
| 418 | 419 |
| 419 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { | 420 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { |
| 420 NOTIMPLEMENTED(); | 421 NOTIMPLEMENTED(); |
| 421 } | 422 } |
| 422 | 423 |
| 423 bool NativeWidgetAura::ConvertPointFromAncestor(const Widget* ancestor, | 424 bool NativeWidgetAura::ConvertPointFromAncestor(const Widget* ancestor, |
| 424 gfx::Point* point) const { | 425 gfx::Point* point) const { |
| 425 NOTIMPLEMENTED(); | 426 NOTIMPLEMENTED(); |
| 426 return false; | 427 return false; |
| 427 } | 428 } |
| 428 | 429 |
| 429 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { | 430 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { |
| 430 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); | 431 return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); |
| 431 } | 432 } |
| 432 | 433 |
| 433 //////////////////////////////////////////////////////////////////////////////// | 434 //////////////////////////////////////////////////////////////////////////////// |
| 434 // NativeWidgetAura, views::InputMethodDelegate implementation: | 435 // NativeWidgetAura, views::InputMethodDelegate implementation: |
| 435 | 436 |
| 436 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { | 437 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { |
| 437 delegate_->OnKeyEvent(key); | 438 if (delegate_->OnKeyEvent(key)) |
| 439 return; | |
| 440 if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager()) | |
| 441 GetWidget()->GetFocusManager()->OnKeyEvent(key); | |
|
Ben Goodger (Google)
2011/10/27 15:33:01
OK... so does this handle browser key events (e.g.
mazda
2011/10/28 14:44:33
Yes, shortcut keys are handled when web content ar
| |
| 438 } | 442 } |
| 439 | 443 |
| 440 //////////////////////////////////////////////////////////////////////////////// | 444 //////////////////////////////////////////////////////////////////////////////// |
| 441 // NativeWidgetAura, aura::WindowDelegate implementation: | 445 // NativeWidgetAura, aura::WindowDelegate implementation: |
| 442 | 446 |
| 443 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 447 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
| 444 const gfx::Rect& new_bounds) { | 448 const gfx::Rect& new_bounds) { |
| 445 if (old_bounds.size() != new_bounds.size()) | 449 if (old_bounds.size() != new_bounds.size()) |
| 446 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); | 450 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); |
| 447 } | 451 } |
| 448 | 452 |
| 449 void NativeWidgetAura::OnFocus() { | 453 void NativeWidgetAura::OnFocus() { |
| 450 Widget* widget = GetWidget(); | 454 Widget* widget = GetWidget(); |
| 451 if (widget->is_top_level()) { | 455 if (widget->is_top_level()) { |
| 452 InputMethod* input_method = widget->GetInputMethod(); | 456 InputMethod* input_method = widget->GetInputMethod(); |
| 453 input_method->OnFocus(); | 457 input_method->OnFocus(); |
| 454 // See description of got_initial_focus_in_ for details on this. | 458 // See description of got_initial_focus_in_ for details on this. |
| 455 widget->GetFocusManager()->RestoreFocusedView(); | 459 // TODO(mazda): Investigate this is actually necessary. |
| 460 // widget->GetFocusManager()->RestoreFocusedView(); | |
| 456 } | 461 } |
| 457 delegate_->OnNativeFocus(window_); | 462 delegate_->OnNativeFocus(window_); |
| 458 } | 463 } |
| 459 | 464 |
| 460 void NativeWidgetAura::OnBlur() { | 465 void NativeWidgetAura::OnBlur() { |
| 461 Widget* widget = GetWidget(); | 466 Widget* widget = GetWidget(); |
| 462 if (widget->is_top_level()) { | 467 if (widget->is_top_level()) { |
| 463 InputMethod* input_method = widget->GetInputMethod(); | 468 InputMethod* input_method = widget->GetInputMethod(); |
| 464 input_method->OnBlur(); | 469 input_method->OnBlur(); |
| 465 widget->GetFocusManager()->StoreFocusedView(); | 470 widget->GetFocusManager()->StoreFocusedView(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 } | 636 } |
| 632 | 637 |
| 633 // static | 638 // static |
| 634 bool NativeWidgetPrivate::IsMouseButtonDown() { | 639 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 635 NOTIMPLEMENTED(); | 640 NOTIMPLEMENTED(); |
| 636 return false; | 641 return false; |
| 637 } | 642 } |
| 638 | 643 |
| 639 } // namespace internal | 644 } // namespace internal |
| 640 } // namespace views | 645 } // namespace views |
| OLD | NEW |