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

Side by Side Diff: ui/aura/client/default_capture_client.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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/aura/client/default_capture_client.h ('k') | ui/aura/client/event_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/aura/client/default_capture_client.h"
6
7 #include "ui/aura/window.h"
8 #include "ui/aura/window_event_dispatcher.h"
9 #include "ui/aura/window_tree_host.h"
10
11 namespace aura {
12 namespace client {
13
14 DefaultCaptureClient::DefaultCaptureClient(Window* root_window)
15 : root_window_(root_window),
16 capture_window_(NULL) {
17 SetCaptureClient(root_window_, this);
18 }
19
20 DefaultCaptureClient::~DefaultCaptureClient() {
21 SetCaptureClient(root_window_, NULL);
22 }
23
24 void DefaultCaptureClient::SetCapture(Window* window) {
25 if (capture_window_ == window)
26 return;
27 if (window) {
28 ui::GestureRecognizer::Get()->TransferEventsTo(
29 capture_window_, window);
30 }
31
32 Window* old_capture_window = capture_window_;
33 capture_window_ = window;
34
35 CaptureDelegate* capture_delegate = root_window_->GetHost()->dispatcher();
36 if (capture_window_)
37 capture_delegate->SetNativeCapture();
38 else
39 capture_delegate->ReleaseNativeCapture();
40
41 capture_delegate->UpdateCapture(old_capture_window, capture_window_);
42 }
43
44 void DefaultCaptureClient::ReleaseCapture(Window* window) {
45 if (capture_window_ != window)
46 return;
47 SetCapture(NULL);
48 }
49
50 Window* DefaultCaptureClient::GetCaptureWindow() {
51 return capture_window_;
52 }
53
54 Window* DefaultCaptureClient::GetGlobalCaptureWindow() {
55 return capture_window_;
56 }
57
58 } // namespace client
59 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/client/default_capture_client.h ('k') | ui/aura/client/event_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698