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

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 1936823002: mus: Don't activate non-activatable widgets on Show() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/mus/native_widget_mus_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/window.h" 10 #include "components/mus/public/cpp/window.h"
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 const gfx::Rect& restored_bounds) { 702 const gfx::Rect& restored_bounds) {
703 // NOTIMPLEMENTED(); 703 // NOTIMPLEMENTED();
704 } 704 }
705 705
706 void NativeWidgetMus::ShowWithWindowState(ui::WindowShowState state) { 706 void NativeWidgetMus::ShowWithWindowState(ui::WindowShowState state) {
707 if (!window_tree_host_) 707 if (!window_tree_host_)
708 return; 708 return;
709 709
710 window_tree_host_->Show(); 710 window_tree_host_->Show();
711 GetNativeWindow()->Show(); 711 GetNativeWindow()->Show();
712 if (state != ui::SHOW_STATE_INACTIVE) 712 if (native_widget_delegate_->CanActivate()) {
713 Activate(); 713 if (state != ui::SHOW_STATE_INACTIVE)
714 GetWidget()->SetInitialFocus(state); 714 Activate();
715 GetWidget()->SetInitialFocus(state);
716 }
715 } 717 }
716 718
717 bool NativeWidgetMus::IsVisible() const { 719 bool NativeWidgetMus::IsVisible() const {
718 // TODO(beng): this should probably be wired thru PlatformWindow. 720 // TODO(beng): this should probably be wired thru PlatformWindow.
719 return window_ && window_->visible(); 721 return window_ && window_->visible();
720 } 722 }
721 723
722 void NativeWidgetMus::Activate() { 724 void NativeWidgetMus::Activate() {
723 if (window_tree_host_) 725 if (window_tree_host_)
724 window_tree_host_->platform_window()->Activate(); 726 window_tree_host_->platform_window()->Activate();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 window_tree_host_->Show(); 1047 window_tree_host_->Show();
1046 GetNativeWindow()->Show(); 1048 GetNativeWindow()->Show();
1047 } else { 1049 } else {
1048 window_tree_host_->Hide(); 1050 window_tree_host_->Hide();
1049 GetNativeWindow()->Hide(); 1051 GetNativeWindow()->Hide();
1050 } 1052 }
1051 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); 1053 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible());
1052 } 1054 }
1053 1055
1054 } // namespace views 1056 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/native_widget_mus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698