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

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

Issue 8821004: Move {Restore,Store}FocusedView to NativeWidgetAura::On{Activated,LostActive} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move {Restore,Store}FocusedView to On{Activated,LostActive} 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 | no next file » | 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 GetWidget()->widget_delegate()->OnWidgetMove(); 548 GetWidget()->widget_delegate()->OnWidgetMove();
549 if (old_bounds.size() != new_bounds.size()) 549 if (old_bounds.size() != new_bounds.size())
550 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); 550 delegate_->OnNativeWidgetSizeChanged(new_bounds.size());
551 } 551 }
552 552
553 void NativeWidgetAura::OnFocus() { 553 void NativeWidgetAura::OnFocus() {
554 Widget* widget = GetWidget(); 554 Widget* widget = GetWidget();
555 if (widget->is_top_level()) { 555 if (widget->is_top_level()) {
556 InputMethod* input_method = widget->GetInputMethod(); 556 InputMethod* input_method = widget->GetInputMethod();
557 input_method->OnFocus(); 557 input_method->OnFocus();
558 // See description of got_initial_focus_in_ for details on this.
559 // TODO(mazda): Investigate this is actually necessary.
560 // widget->GetFocusManager()->RestoreFocusedView();
561 } 558 }
562 delegate_->OnNativeFocus(window_); 559 delegate_->OnNativeFocus(window_);
563 } 560 }
564 561
565 void NativeWidgetAura::OnBlur() { 562 void NativeWidgetAura::OnBlur() {
566 Widget* widget = GetWidget(); 563 Widget* widget = GetWidget();
567 if (widget->is_top_level()) { 564 if (widget->is_top_level()) {
568 InputMethod* input_method = widget->GetInputMethod(); 565 InputMethod* input_method = widget->GetInputMethod();
569 input_method->OnBlur(); 566 input_method->OnBlur();
570 widget->GetFocusManager()->StoreFocusedView();
571 } 567 }
572 delegate_->OnNativeBlur(NULL); 568 delegate_->OnNativeBlur(NULL);
573 } 569 }
574 570
575 bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) { 571 bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) {
576 // TODO(beng): Need an InputMethodAura to properly handle character events. 572 // TODO(beng): Need an InputMethodAura to properly handle character events.
577 // Right now, we just skip these. 573 // Right now, we just skip these.
578 if (event->is_char()) 574 if (event->is_char())
579 return false; 575 return false;
580 576
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 611
616 bool NativeWidgetAura::CanFocus() { 612 bool NativeWidgetAura::CanFocus() {
617 return true; 613 return true;
618 } 614 }
619 615
620 bool NativeWidgetAura::ShouldActivate(aura::Event* event) { 616 bool NativeWidgetAura::ShouldActivate(aura::Event* event) {
621 return can_activate_; 617 return can_activate_;
622 } 618 }
623 619
624 void NativeWidgetAura::OnActivated() { 620 void NativeWidgetAura::OnActivated() {
621 GetWidget()->GetFocusManager()->RestoreFocusedView();
625 delegate_->OnNativeWidgetActivationChanged(true); 622 delegate_->OnNativeWidgetActivationChanged(true);
626 if (IsVisible() && GetWidget()->non_client_view()) 623 if (IsVisible() && GetWidget()->non_client_view())
627 GetWidget()->non_client_view()->SchedulePaint(); 624 GetWidget()->non_client_view()->SchedulePaint();
628 } 625 }
629 626
630 void NativeWidgetAura::OnLostActive() { 627 void NativeWidgetAura::OnLostActive() {
628 GetWidget()->GetFocusManager()->StoreFocusedView();
631 delegate_->OnNativeWidgetActivationChanged(false); 629 delegate_->OnNativeWidgetActivationChanged(false);
632 if (IsVisible() && GetWidget()->non_client_view()) 630 if (IsVisible() && GetWidget()->non_client_view())
633 GetWidget()->non_client_view()->SchedulePaint(); 631 GetWidget()->non_client_view()->SchedulePaint();
634 } 632 }
635 633
636 void NativeWidgetAura::OnCaptureLost() { 634 void NativeWidgetAura::OnCaptureLost() {
637 delegate_->OnMouseCaptureLost(); 635 delegate_->OnMouseCaptureLost();
638 } 636 }
639 637
640 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { 638 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 } 789 }
792 } 790 }
793 791
794 // static 792 // static
795 bool NativeWidgetPrivate::IsMouseButtonDown() { 793 bool NativeWidgetPrivate::IsMouseButtonDown() {
796 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); 794 return aura::RootWindow::GetInstance()->IsMouseButtonDown();
797 } 795 }
798 796
799 } // namespace internal 797 } // namespace internal
800 } // namespace views 798 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698