Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 8892025: Reland r113741: Move {Restore,Store}FocusedView to NativeWidgetAura::On{Activated,LostActive} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/widget/widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/drag_drop_client.h" 10 #include "ui/aura/client/drag_drop_client.h"
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 GetWidget()->widget_delegate()->OnWidgetMove(); 560 GetWidget()->widget_delegate()->OnWidgetMove();
561 if (old_bounds.size() != new_bounds.size()) 561 if (old_bounds.size() != new_bounds.size())
562 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); 562 delegate_->OnNativeWidgetSizeChanged(new_bounds.size());
563 } 563 }
564 564
565 void NativeWidgetAura::OnFocus() { 565 void NativeWidgetAura::OnFocus() {
566 Widget* widget = GetWidget(); 566 Widget* widget = GetWidget();
567 if (widget->is_top_level()) { 567 if (widget->is_top_level()) {
568 InputMethod* input_method = widget->GetInputMethod(); 568 InputMethod* input_method = widget->GetInputMethod();
569 input_method->OnFocus(); 569 input_method->OnFocus();
570 // See description of got_initial_focus_in_ for details on this.
571 // TODO(mazda): Investigate this is actually necessary.
572 // widget->GetFocusManager()->RestoreFocusedView();
573 } 570 }
574 delegate_->OnNativeFocus(window_); 571 delegate_->OnNativeFocus(window_);
575 } 572 }
576 573
577 void NativeWidgetAura::OnBlur() { 574 void NativeWidgetAura::OnBlur() {
578 Widget* widget = GetWidget(); 575 Widget* widget = GetWidget();
579 if (widget->is_top_level()) { 576 if (widget->is_top_level()) {
580 InputMethod* input_method = widget->GetInputMethod(); 577 InputMethod* input_method = widget->GetInputMethod();
581 input_method->OnBlur(); 578 input_method->OnBlur();
582 widget->GetFocusManager()->StoreFocusedView();
583 } 579 }
584 delegate_->OnNativeBlur(NULL); 580 delegate_->OnNativeBlur(NULL);
585 } 581 }
586 582
587 bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) { 583 bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) {
588 // TODO(beng): Need an InputMethodAura to properly handle character events. 584 // TODO(beng): Need an InputMethodAura to properly handle character events.
589 // Right now, we just skip these. 585 // Right now, we just skip these.
590 if (event->is_char()) 586 if (event->is_char())
591 return false; 587 return false;
592 588
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 623
628 bool NativeWidgetAura::CanFocus() { 624 bool NativeWidgetAura::CanFocus() {
629 return true; 625 return true;
630 } 626 }
631 627
632 bool NativeWidgetAura::ShouldActivate(aura::Event* event) { 628 bool NativeWidgetAura::ShouldActivate(aura::Event* event) {
633 return can_activate_; 629 return can_activate_;
634 } 630 }
635 631
636 void NativeWidgetAura::OnActivated() { 632 void NativeWidgetAura::OnActivated() {
633 GetWidget()->GetFocusManager()->RestoreFocusedView();
637 delegate_->OnNativeWidgetActivationChanged(true); 634 delegate_->OnNativeWidgetActivationChanged(true);
638 if (IsVisible() && GetWidget()->non_client_view()) 635 if (IsVisible() && GetWidget()->non_client_view())
639 GetWidget()->non_client_view()->SchedulePaint(); 636 GetWidget()->non_client_view()->SchedulePaint();
640 } 637 }
641 638
642 void NativeWidgetAura::OnLostActive() { 639 void NativeWidgetAura::OnLostActive() {
640 GetWidget()->GetFocusManager()->StoreFocusedView();
643 delegate_->OnNativeWidgetActivationChanged(false); 641 delegate_->OnNativeWidgetActivationChanged(false);
644 if (IsVisible() && GetWidget()->non_client_view()) 642 if (IsVisible() && GetWidget()->non_client_view())
645 GetWidget()->non_client_view()->SchedulePaint(); 643 GetWidget()->non_client_view()->SchedulePaint();
646 } 644 }
647 645
648 void NativeWidgetAura::OnCaptureLost() { 646 void NativeWidgetAura::OnCaptureLost() {
649 delegate_->OnMouseCaptureLost(); 647 delegate_->OnMouseCaptureLost();
650 } 648 }
651 649
652 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { 650 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 800 }
803 } 801 }
804 802
805 // static 803 // static
806 bool NativeWidgetPrivate::IsMouseButtonDown() { 804 bool NativeWidgetPrivate::IsMouseButtonDown() {
807 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); 805 return aura::RootWindow::GetInstance()->IsMouseButtonDown();
808 } 806 }
809 807
810 } // namespace internal 808 } // namespace internal
811 } // namespace views 809 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698