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

Side by Side Diff: services/window_manager/focus_controller.cc

Issue 805123003: Adds capture to the mojo window_manager. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Cleanup Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/window_manager/focus_controller.h" 5 #include "services/window_manager/focus_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "mojo/services/view_manager/public/cpp/view_property.h" 8 #include "mojo/services/view_manager/public/cpp/view_property.h"
9 #include "mojo/services/view_manager/public/cpp/view_tracker.h" 9 #include "mojo/services/view_manager/public/cpp/view_tracker.h"
10 #include "services/window_manager/capture_controller.h"
10 #include "services/window_manager/focus_controller_observer.h" 11 #include "services/window_manager/focus_controller_observer.h"
11 #include "services/window_manager/focus_rules.h" 12 #include "services/window_manager/focus_rules.h"
12 #include "services/window_manager/view_target.h" 13 #include "services/window_manager/view_target.h"
13 #include "services/window_manager/window_manager_app.h" 14 #include "services/window_manager/window_manager_app.h"
14 #include "ui/events/event.h" 15 #include "ui/events/event.h"
15 16
16 DECLARE_VIEW_PROPERTY_TYPE(window_manager::FocusController*); 17 DECLARE_VIEW_PROPERTY_TYPE(window_manager::FocusController*);
17 18
18 using mojo::View; 19 using mojo::View;
19 20
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 bool FocusController::CanActivateView(View* view) const { 68 bool FocusController::CanActivateView(View* view) const {
68 return rules_->CanActivateView(view); 69 return rules_->CanActivateView(view);
69 } 70 }
70 71
71 void FocusController::FocusView(View* view) { 72 void FocusController::FocusView(View* view) {
72 if (view && 73 if (view &&
73 (view->Contains(focused_view_) || view->Contains(active_view_))) { 74 (view->Contains(focused_view_) || view->Contains(active_view_))) {
74 return; 75 return;
75 } 76 }
76 77
77 // TODO(erg): We need to early abort in the of a view having 78 // We should not be messing with the focus if the window has capture, unless
78 // capture. However, we currently don't have a capture client here. 79 // no view has focus.
80 if (view && (GetCaptureView(view) == view) && focused_view_)
sky 2014/12/16 03:44:20 This was was recently nuked from chrome: https://c
81 return;
79 82
80 // Focusing a window also activates its containing activatable window. Note 83 // Focusing a window also activates its containing activatable window. Note
81 // that the rules could redirect activation activation and/or focus. 84 // that the rules could redirect activation activation and/or focus.
82 View* focusable = rules_->GetFocusableView(view); 85 View* focusable = rules_->GetFocusableView(view);
83 View* activatable = 86 View* activatable =
84 focusable ? rules_->GetActivatableView(focusable) : nullptr; 87 focusable ? rules_->GetActivatableView(focusable) : nullptr;
85 88
86 // We need valid focusable/activatable windows in the event we're not clearing 89 // We need valid focusable/activatable windows in the event we're not clearing
87 // focus. "Clearing focus" is inferred by whether or not |window| passed to 90 // focus. "Clearing focus" is inferred by whether or not |window| passed to
88 // this function is non-null. 91 // this function is non-null.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 316 }
314 317
315 FocusController* GetFocusController(View* root_view) { 318 FocusController* GetFocusController(View* root_view) {
316 if (root_view) 319 if (root_view)
317 DCHECK_EQ(root_view->GetRoot(), root_view); 320 DCHECK_EQ(root_view->GetRoot(), root_view);
318 return root_view ? 321 return root_view ?
319 root_view->GetLocalProperty(kRootViewFocusController) : nullptr; 322 root_view->GetLocalProperty(kRootViewFocusController) : nullptr;
320 } 323 }
321 324
322 } // namespace window_manager 325 } // namespace window_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698