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