| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/wm/core/capture_controller.h" | 5 #include "ui/wm/core/capture_controller.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 wm { | 13 namespace wm { |
| 13 | 14 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
| 15 // CaptureController, public: | 16 // CaptureController, public: |
| 16 | 17 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 66 |
| 66 for (const auto& it : delegates) | 67 for (const auto& it : delegates) |
| 67 it.second->UpdateCapture(old_capture_window, new_capture_window); | 68 it.second->UpdateCapture(old_capture_window, new_capture_window); |
| 68 | 69 |
| 69 if (capture_delegate_ != old_capture_delegate) { | 70 if (capture_delegate_ != old_capture_delegate) { |
| 70 if (old_capture_delegate) | 71 if (old_capture_delegate) |
| 71 old_capture_delegate->ReleaseNativeCapture(); | 72 old_capture_delegate->ReleaseNativeCapture(); |
| 72 if (capture_delegate_) | 73 if (capture_delegate_) |
| 73 capture_delegate_->SetNativeCapture(); | 74 capture_delegate_->SetNativeCapture(); |
| 74 } | 75 } |
| 76 |
| 77 for (aura::client::CaptureClientObserver& observer : observers_) |
| 78 observer.OnCaptureChanged(old_capture_window, capture_window_); |
| 75 } | 79 } |
| 76 | 80 |
| 77 void CaptureController::ReleaseCapture(aura::Window* window) { | 81 void CaptureController::ReleaseCapture(aura::Window* window) { |
| 78 if (capture_window_ != window) | 82 if (capture_window_ != window) |
| 79 return; | 83 return; |
| 80 SetCapture(nullptr); | 84 SetCapture(nullptr); |
| 81 } | 85 } |
| 82 | 86 |
| 83 aura::Window* CaptureController::GetCaptureWindow() { | 87 aura::Window* CaptureController::GetCaptureWindow() { |
| 84 return capture_window_; | 88 return capture_window_; |
| 85 } | 89 } |
| 86 | 90 |
| 87 aura::Window* CaptureController::GetGlobalCaptureWindow() { | 91 aura::Window* CaptureController::GetGlobalCaptureWindow() { |
| 88 return capture_window_; | 92 return capture_window_; |
| 89 } | 93 } |
| 90 | 94 |
| 95 void CaptureController::AddObserver( |
| 96 aura::client::CaptureClientObserver* observer) { |
| 97 observers_.AddObserver(observer); |
| 98 } |
| 99 |
| 100 void CaptureController::RemoveObserver( |
| 101 aura::client::CaptureClientObserver* observer) { |
| 102 observers_.RemoveObserver(observer); |
| 103 } |
| 104 |
| 91 //////////////////////////////////////////////////////////////////////////////// | 105 //////////////////////////////////////////////////////////////////////////////// |
| 92 // CaptureController, private: | 106 // CaptureController, private: |
| 93 | 107 |
| 94 CaptureController::CaptureController() | 108 CaptureController::CaptureController() |
| 95 : capture_window_(nullptr), | 109 : capture_window_(nullptr), |
| 96 capture_delegate_(nullptr) { | 110 capture_delegate_(nullptr) { |
| 97 } | 111 } |
| 98 | 112 |
| 99 CaptureController::~CaptureController() { | 113 CaptureController::~CaptureController() { |
| 100 } | 114 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 156 |
| 143 /////////////////////////////////////////////////////////////////////////////// | 157 /////////////////////////////////////////////////////////////////////////////// |
| 144 // CaptureController::TestApi | 158 // CaptureController::TestApi |
| 145 | 159 |
| 146 void ScopedCaptureClient::TestApi::SetDelegate( | 160 void ScopedCaptureClient::TestApi::SetDelegate( |
| 147 aura::client::CaptureDelegate* delegate) { | 161 aura::client::CaptureDelegate* delegate) { |
| 148 client_->capture_controller_->delegates_[client_->root_window_] = delegate; | 162 client_->capture_controller_->delegates_[client_->root_window_] = delegate; |
| 149 } | 163 } |
| 150 | 164 |
| 151 } // namespace wm | 165 } // namespace wm |
| OLD | NEW |