Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/desktop_aura/desktop_capture_client.h" | 5 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/aura/window_event_dispatcher.h" | 8 #include "ui/aura/window_event_dispatcher.h" |
| 9 #include "ui/aura/window_tracker.h" | 9 #include "ui/aura/window_tracker.h" |
| 10 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 DesktopCaptureClient::CaptureClients* | 15 DesktopCaptureClient::CaptureClients* |
| 16 DesktopCaptureClient::capture_clients_ = NULL; | 16 DesktopCaptureClient::capture_clients_ = NULL; |
| 17 | 17 |
| 18 // static | |
| 19 aura::Window* DesktopCaptureClient::GetCaptureWindowGlobal() { | |
| 20 for (auto i = capture_clients_->begin(); i != capture_clients_->end(); ++i) { | |
|
sadrul
2017/01/25 16:40:22
I was hoping something like this would work:
fo
| |
| 21 if ((*i)->capture_window_) | |
| 22 return (*i)->capture_window_; | |
| 23 } | |
| 24 return NULL; | |
|
sadrul
2017/01/25 16:40:22
nullptr
| |
| 25 } | |
| 26 | |
| 18 DesktopCaptureClient::DesktopCaptureClient(aura::Window* root) | 27 DesktopCaptureClient::DesktopCaptureClient(aura::Window* root) |
| 19 : root_(root), | 28 : root_(root), |
| 20 capture_window_(NULL) { | 29 capture_window_(NULL) { |
| 21 if (!capture_clients_) | 30 if (!capture_clients_) |
| 22 capture_clients_ = new CaptureClients; | 31 capture_clients_ = new CaptureClients; |
| 23 capture_clients_->insert(this); | 32 capture_clients_->insert(this); |
| 24 aura::client::SetCaptureClient(root, this); | 33 aura::client::SetCaptureClient(root, this); |
| 25 } | 34 } |
| 26 | 35 |
| 27 DesktopCaptureClient::~DesktopCaptureClient() { | 36 DesktopCaptureClient::~DesktopCaptureClient() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 if (capture_window_ != window) | 92 if (capture_window_ != window) |
| 84 return; | 93 return; |
| 85 SetCapture(NULL); | 94 SetCapture(NULL); |
| 86 } | 95 } |
| 87 | 96 |
| 88 aura::Window* DesktopCaptureClient::GetCaptureWindow() { | 97 aura::Window* DesktopCaptureClient::GetCaptureWindow() { |
| 89 return capture_window_; | 98 return capture_window_; |
| 90 } | 99 } |
| 91 | 100 |
| 92 aura::Window* DesktopCaptureClient::GetGlobalCaptureWindow() { | 101 aura::Window* DesktopCaptureClient::GetGlobalCaptureWindow() { |
| 93 for (CaptureClients::iterator i = capture_clients_->begin(); | 102 return GetCaptureWindowGlobal(); |
| 94 i != capture_clients_->end(); ++i) { | |
| 95 if ((*i)->capture_window_) | |
| 96 return (*i)->capture_window_; | |
| 97 } | |
| 98 return NULL; | |
| 99 } | 103 } |
| 100 | 104 |
| 101 void DesktopCaptureClient::AddObserver( | 105 void DesktopCaptureClient::AddObserver( |
| 102 aura::client::CaptureClientObserver* observer) { | 106 aura::client::CaptureClientObserver* observer) { |
| 103 NOTREACHED(); | 107 NOTREACHED(); |
| 104 } | 108 } |
| 105 | 109 |
| 106 void DesktopCaptureClient::RemoveObserver( | 110 void DesktopCaptureClient::RemoveObserver( |
| 107 aura::client::CaptureClientObserver* observer) { | 111 aura::client::CaptureClientObserver* observer) { |
| 108 NOTREACHED(); | 112 NOTREACHED(); |
| 109 } | 113 } |
| 110 | 114 |
| 111 } // namespace views | 115 } // namespace views |
| OLD | NEW |