| 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* | 16 DesktopCaptureClient::CaptureClients* |
| 16 DesktopCaptureClient::capture_clients_ = NULL; | 17 DesktopCaptureClient::capture_clients_ = NULL; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 CaptureClients capture_clients(*capture_clients_); | 71 CaptureClients capture_clients(*capture_clients_); |
| 71 for (CaptureClients::iterator i = capture_clients.begin(); | 72 for (CaptureClients::iterator i = capture_clients.begin(); |
| 72 i != capture_clients.end(); ++i) { | 73 i != capture_clients.end(); ++i) { |
| 73 if (*i != this) { | 74 if (*i != this) { |
| 74 aura::client::CaptureDelegate* delegate = | 75 aura::client::CaptureDelegate* delegate = |
| 75 (*i)->root_->GetHost()->dispatcher(); | 76 (*i)->root_->GetHost()->dispatcher(); |
| 76 delegate->OnOtherRootGotCapture(); | 77 delegate->OnOtherRootGotCapture(); |
| 77 } | 78 } |
| 78 } | 79 } |
| 79 } // else case is capture is remaining in our root, nothing to do. | 80 } // else case is capture is remaining in our root, nothing to do. |
| 81 |
| 82 for (aura::client::CaptureClientObserver& observer : observers_) |
| 83 observer.OnCaptureChanged(old_capture_window, capture_window_); |
| 80 } | 84 } |
| 81 | 85 |
| 82 void DesktopCaptureClient::ReleaseCapture(aura::Window* window) { | 86 void DesktopCaptureClient::ReleaseCapture(aura::Window* window) { |
| 83 if (capture_window_ != window) | 87 if (capture_window_ != window) |
| 84 return; | 88 return; |
| 85 SetCapture(NULL); | 89 SetCapture(NULL); |
| 86 } | 90 } |
| 87 | 91 |
| 88 aura::Window* DesktopCaptureClient::GetCaptureWindow() { | 92 aura::Window* DesktopCaptureClient::GetCaptureWindow() { |
| 89 return capture_window_; | 93 return capture_window_; |
| 90 } | 94 } |
| 91 | 95 |
| 92 aura::Window* DesktopCaptureClient::GetGlobalCaptureWindow() { | 96 aura::Window* DesktopCaptureClient::GetGlobalCaptureWindow() { |
| 93 for (CaptureClients::iterator i = capture_clients_->begin(); | 97 for (CaptureClients::iterator i = capture_clients_->begin(); |
| 94 i != capture_clients_->end(); ++i) { | 98 i != capture_clients_->end(); ++i) { |
| 95 if ((*i)->capture_window_) | 99 if ((*i)->capture_window_) |
| 96 return (*i)->capture_window_; | 100 return (*i)->capture_window_; |
| 97 } | 101 } |
| 98 return NULL; | 102 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 observers_.AddObserver(observer); |
| 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 observers_.RemoveObserver(observer); |
| 109 } | 113 } |
| 110 | 114 |
| 111 } // namespace views | 115 } // namespace views |
| OLD | NEW |