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

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: Address sky@'s comment. 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (!window_) 484 if (!window_)
485 return; 485 return;
486 486
487 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN || 487 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN ||
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();
sky 2016/03/04 16:32:55 I was thinking that in this branch you would see i
xdai1 2016/03/04 22:27:28 I see your point now. So in order to make this cha
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 SetInitialFocus(wm::CanActivateWindow(window_) ? state
499 : ui::SHOW_STATE_INACTIVE);
499 } 500 }
500 501
501 // On desktop aura, a window is activated first even when it is shown as 502 // On desktop aura, a window is activated first even when it is shown as
502 // minimized. Do the same for consistency. 503 // minimized. Do the same for consistency.
503 if (state == ui::SHOW_STATE_MINIMIZED) 504 if (state == ui::SHOW_STATE_MINIMIZED)
504 Minimize(); 505 Minimize();
505 } 506 }
506 507
507 bool NativeWidgetAura::IsVisible() const { 508 bool NativeWidgetAura::IsVisible() const {
508 return window_ && window_->IsVisible(); 509 return window_ && window_->IsVisible();
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1168 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1168 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1169 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1169 return gfx::FontList(gfx::Font(caption_font.get())); 1170 return gfx::FontList(gfx::Font(caption_font.get()));
1170 #else 1171 #else
1171 return gfx::FontList(); 1172 return gfx::FontList();
1172 #endif 1173 #endif
1173 } 1174 }
1174 1175
1175 } // namespace internal 1176 } // namespace internal
1176 } // namespace views 1177 } // 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