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

Side by Side Diff: mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc

Issue 805123003: Adds capture to the mojo window_manager. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: sky comments 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 "mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h" 5 #include "mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "mojo/public/cpp/application/application_impl.h" 10 #include "mojo/public/cpp/application/application_impl.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate, 94 ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate,
95 Shell* shell, 95 Shell* shell,
96 ScopedMessagePipeHandle handle, 96 ScopedMessagePipeHandle handle,
97 bool delete_on_error) 97 bool delete_on_error)
98 : connected_(false), 98 : connected_(false),
99 connection_id_(0), 99 connection_id_(0),
100 next_id_(1), 100 next_id_(1),
101 delegate_(delegate), 101 delegate_(delegate),
102 root_(nullptr), 102 root_(nullptr),
103 capture_view_(nullptr),
103 focused_view_(nullptr), 104 focused_view_(nullptr),
104 activated_view_(nullptr), 105 activated_view_(nullptr),
105 binding_(this, handle.Pass()), 106 binding_(this, handle.Pass()),
106 service_(binding_.client()), 107 service_(binding_.client()),
107 delete_on_error_(delete_on_error) { 108 delete_on_error_(delete_on_error) {
108 } 109 }
109 110
110 ViewManagerClientImpl::~ViewManagerClientImpl() { 111 ViewManagerClientImpl::~ViewManagerClientImpl() {
111 std::vector<View*> non_owned; 112 std::vector<View*> non_owned;
112 while (!views_.empty()) { 113 while (!views_.empty()) {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 *ViewPrivate(view).observers(), 375 *ViewPrivate(view).observers(),
375 OnViewInputEvent(view, event)); 376 OnViewInputEvent(view, event));
376 } 377 }
377 ack_callback.Run(); 378 ack_callback.Run();
378 } 379 }
379 380
380 //////////////////////////////////////////////////////////////////////////////// 381 ////////////////////////////////////////////////////////////////////////////////
381 // ViewManagerClientImpl, WindowManagerClient implementation: 382 // ViewManagerClientImpl, WindowManagerClient implementation:
382 383
383 void ViewManagerClientImpl::OnCaptureChanged(Id old_capture_view_id, 384 void ViewManagerClientImpl::OnCaptureChanged(Id old_capture_view_id,
384 Id new_capture_view_id) {} 385 Id new_capture_view_id) {
386 View* gained_capture = GetViewById(new_capture_view_id);
387 View* lost_capture = GetViewById(old_capture_view_id);
388 if (lost_capture) {
389 FOR_EACH_OBSERVER(ViewObserver,
390 *ViewPrivate(lost_capture).observers(),
391 OnViewFocusChanged(gained_capture, lost_capture));
392 }
393 capture_view_ = gained_capture;
394 if (gained_capture) {
395 FOR_EACH_OBSERVER(ViewObserver,
396 *ViewPrivate(gained_capture).observers(),
397 OnViewFocusChanged(gained_capture, lost_capture));
398 }
399 }
385 400
386 void ViewManagerClientImpl::OnFocusChanged(Id old_focused_view_id, 401 void ViewManagerClientImpl::OnFocusChanged(Id old_focused_view_id,
387 Id new_focused_view_id) { 402 Id new_focused_view_id) {
388 View* focused = GetViewById(new_focused_view_id); 403 View* focused = GetViewById(new_focused_view_id);
389 View* blurred = GetViewById(old_focused_view_id); 404 View* blurred = GetViewById(old_focused_view_id);
390 if (blurred) { 405 if (blurred) {
391 FOR_EACH_OBSERVER(ViewObserver, 406 FOR_EACH_OBSERVER(ViewObserver,
392 *ViewPrivate(blurred).observers(), 407 *ViewPrivate(blurred).observers(),
393 OnViewFocusChanged(focused, blurred)); 408 OnViewFocusChanged(focused, blurred));
394 } 409 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 uint32 active_view_id) { 471 uint32 active_view_id) {
457 if (GetViewById(focused_view_id) != focused_view_) 472 if (GetViewById(focused_view_id) != focused_view_)
458 OnFocusChanged(focused_view_ ? focused_view_->id() : 0, focused_view_id); 473 OnFocusChanged(focused_view_ ? focused_view_->id() : 0, focused_view_id);
459 if (GetViewById(active_view_id) != activated_view_) { 474 if (GetViewById(active_view_id) != activated_view_) {
460 OnActiveWindowChanged(activated_view_ ? activated_view_->id() : 0, 475 OnActiveWindowChanged(activated_view_ ? activated_view_->id() : 0,
461 active_view_id); 476 active_view_id);
462 } 477 }
463 } 478 }
464 479
465 } // namespace mojo 480 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h ('k') | mojo/services/view_manager/public/cpp/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698