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

Unified Diff: ui/views/widget/native_widget_aura.cc

Issue 286733002: [Refactor] Consolidate the logic for whether a widget can be activated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_aura_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 2e564fa5a8adff1bee71a001e83c5405ad073619..a45b6816593694530946280d0758db2d7dd17a88 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -76,7 +76,6 @@ NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate)
window_(new aura::Window(this)),
ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
close_widget_factory_(this),
- can_activate_(true),
destroying_(false),
cursor_(gfx::kNullCursor),
saved_window_state_(ui::SHOW_STATE_DEFAULT) {
@@ -161,9 +160,6 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
else
SetBounds(window_bounds);
window_->set_ignore_events(!params.accept_events);
- can_activate_ = params.can_activate &&
- params.type != Widget::InitParams::TYPE_CONTROL &&
- params.type != Widget::InitParams::TYPE_TOOLTIP;
DCHECK(GetWidget()->GetRootView());
if (params.type != Widget::InitParams::TYPE_TOOLTIP)
tooltip_manager_.reset(new views::TooltipManagerAura(GetWidget()));
@@ -487,7 +483,7 @@ void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) {
if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN)
window_->SetProperty(aura::client::kShowStateKey, state);
window_->Show();
- if (can_activate_) {
+ if (delegate_->CanActivate()) {
if (state != ui::SHOW_STATE_INACTIVE)
Activate();
// SetInitialFocus() should be always be called, even for
@@ -773,7 +769,7 @@ bool NativeWidgetAura::ShouldDescendIntoChildForEventHandling(
}
bool NativeWidgetAura::CanFocus() {
- return can_activate_;
+ return ShouldActivate();
}
void NativeWidgetAura::OnCaptureLost() {
@@ -870,7 +866,7 @@ void NativeWidgetAura::OnGestureEvent(ui::GestureEvent* event) {
// NativeWidgetAura, aura::client::ActivationDelegate implementation:
bool NativeWidgetAura::ShouldActivate() const {
- return can_activate_ && delegate_->CanActivate();
+ return delegate_->CanActivate();
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698