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

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

Issue 1753473003: A window should not get activated or get input focus if it's behind the lock screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify the test to use NativeWidgetAura when initializing widget. Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « ui/views/test/widget_test.cc ('k') | ui/views/widget/native_widget_aura_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "third_party/skia/include/core/SkRegion.h" 10 #include "third_party/skia/include/core/SkRegion.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 state == ui::SHOW_STATE_DOCKED) { 488 state == ui::SHOW_STATE_DOCKED) {
489 window_->SetProperty(aura::client::kShowStateKey, state); 489 window_->SetProperty(aura::client::kShowStateKey, state);
490 } 490 }
491 window_->Show(); 491 window_->Show();
492 if (delegate_->CanActivate()) { 492 if (delegate_->CanActivate()) {
493 if (state != ui::SHOW_STATE_INACTIVE) 493 if (state != ui::SHOW_STATE_INACTIVE)
494 Activate(); 494 Activate();
495 // SetInitialFocus() should be always be called, even for 495 // SetInitialFocus() should be always be called, even for
496 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will 496 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will
497 // do the right thing. 497 // do the right thing.
498 SetInitialFocus(state); 498 // Activate() might fail if the window is non-activatable. In this case, we
499 // should pass SHOW_STATE_INACTIVE to SetInitialFocus() to stop the initial
500 // focused view from getting focused. See crbug.com/515594 for example.
501 SetInitialFocus(IsActive() ? state : ui::SHOW_STATE_INACTIVE);
499 } 502 }
500 503
501 // On desktop aura, a window is activated first even when it is shown as 504 // On desktop aura, a window is activated first even when it is shown as
502 // minimized. Do the same for consistency. 505 // minimized. Do the same for consistency.
503 if (state == ui::SHOW_STATE_MINIMIZED) 506 if (state == ui::SHOW_STATE_MINIMIZED)
504 Minimize(); 507 Minimize();
505 } 508 }
506 509
507 bool NativeWidgetAura::IsVisible() const { 510 bool NativeWidgetAura::IsVisible() const {
508 return window_ && window_->IsVisible(); 511 return window_ && window_->IsVisible();
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1170 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1168 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1171 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1169 return gfx::FontList(gfx::Font(caption_font.get())); 1172 return gfx::FontList(gfx::Font(caption_font.get()));
1170 #else 1173 #else
1171 return gfx::FontList(); 1174 return gfx::FontList();
1172 #endif 1175 #endif
1173 } 1176 }
1174 1177
1175 } // namespace internal 1178 } // namespace internal
1176 } // namespace views 1179 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/widget_test.cc ('k') | ui/views/widget/native_widget_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698