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/client/capture_client_observer.h" | |
| 7 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 8 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
| 9 #include "ui/aura/window_tracker.h" | 10 #include "ui/aura/window_tracker.h" |
| 10 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
| 11 | 12 |
| 12 namespace views { | 13 namespace views { |
| 13 | 14 |
| 14 // static | 15 // static |
| 15 DesktopCaptureClient::CaptureClients* DesktopCaptureClient::capture_clients_ = | 16 DesktopCaptureClient::CaptureClients* DesktopCaptureClient::capture_clients_ = |
| 16 nullptr; | 17 nullptr; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 CaptureClients capture_clients(*capture_clients_); | 79 CaptureClients capture_clients(*capture_clients_); |
| 79 for (CaptureClients::iterator i = capture_clients.begin(); | 80 for (CaptureClients::iterator i = capture_clients.begin(); |
| 80 i != capture_clients.end(); ++i) { | 81 i != capture_clients.end(); ++i) { |
| 81 if (*i != this) { | 82 if (*i != this) { |
| 82 aura::client::CaptureDelegate* delegate = | 83 aura::client::CaptureDelegate* delegate = |
| 83 (*i)->root_->GetHost()->dispatcher(); | 84 (*i)->root_->GetHost()->dispatcher(); |
| 84 delegate->OnOtherRootGotCapture(); | 85 delegate->OnOtherRootGotCapture(); |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 } // else case is capture is remaining in our root, nothing to do. | 88 } // else case is capture is remaining in our root, nothing to do. |
| 89 | |
| 90 for (aura::client::CaptureClientObserver& observer : observers_) | |
|
sadrul
2017/01/27 01:06:54
for (auto& observer : observers_)
riajiang
2017/01/30 18:36:22
Done.
| |
| 91 observer.OnCaptureChanged(old_capture_window, capture_window_); | |
| 88 } | 92 } |
| 89 | 93 |
| 90 void DesktopCaptureClient::ReleaseCapture(aura::Window* window) { | 94 void DesktopCaptureClient::ReleaseCapture(aura::Window* window) { |
| 91 if (capture_window_ != window) | 95 if (capture_window_ != window) |
| 92 return; | 96 return; |
| 93 SetCapture(nullptr); | 97 SetCapture(nullptr); |
| 94 } | 98 } |
| 95 | 99 |
| 96 aura::Window* DesktopCaptureClient::GetCaptureWindow() { | 100 aura::Window* DesktopCaptureClient::GetCaptureWindow() { |
| 97 return capture_window_; | 101 return capture_window_; |
| 98 } | 102 } |
| 99 | 103 |
| 100 aura::Window* DesktopCaptureClient::GetGlobalCaptureWindow() { | 104 aura::Window* DesktopCaptureClient::GetGlobalCaptureWindow() { |
| 101 return GetCaptureWindowGlobal(); | 105 return GetCaptureWindowGlobal(); |
| 102 } | 106 } |
| 103 | 107 |
| 104 void DesktopCaptureClient::AddObserver( | 108 void DesktopCaptureClient::AddObserver( |
| 105 aura::client::CaptureClientObserver* observer) { | 109 aura::client::CaptureClientObserver* observer) { |
| 106 NOTREACHED(); | 110 observers_.AddObserver(observer); |
| 107 } | 111 } |
| 108 | 112 |
| 109 void DesktopCaptureClient::RemoveObserver( | 113 void DesktopCaptureClient::RemoveObserver( |
| 110 aura::client::CaptureClientObserver* observer) { | 114 aura::client::CaptureClientObserver* observer) { |
| 111 NOTREACHED(); | 115 observers_.RemoveObserver(observer); |
| 112 } | 116 } |
| 113 | 117 |
| 114 } // namespace views | 118 } // namespace views |
| OLD | NEW |