Index: components/mus/public/cpp/lib/window_tree_client_impl.cc |
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc |
index 2b094e96cdc0aa071aa8b3cd18e2d40e3d0b7f0d..2ae19a1a466b5d3bddd9d56c12fec0412e3f3778 100644 |
--- a/components/mus/public/cpp/lib/window_tree_client_impl.cc |
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc |
@@ -11,6 +11,7 @@ |
#include "components/mus/public/cpp/window_manager_delegate.h" |
#include "components/mus/public/cpp/window_observer.h" |
#include "components/mus/public/cpp/window_tree_connection.h" |
+#include "components/mus/public/cpp/window_tree_connection_observer.h" |
#include "components/mus/public/cpp/window_tree_delegate.h" |
#include "mojo/application/public/cpp/application_impl.h" |
#include "mojo/application/public/cpp/connect.h" |
@@ -353,6 +354,11 @@ void WindowTreeClientImpl::OnEmbedImpl(mojom::WindowTree* window_tree, |
focused_window_ = GetWindowById(focused_window_id); |
delegate_->OnEmbed(root_); |
+ |
+ if (focused_window_) { |
+ FOR_EACH_OBSERVER(WindowTreeConnectionObserver, observers_, |
+ OnWindowTreeFocusChanged(focused_window_, nullptr)); |
+ } |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -402,6 +408,15 @@ ConnectionSpecificId WindowTreeClientImpl::GetConnectionId() { |
//////////////////////////////////////////////////////////////////////////////// |
// WindowTreeClientImpl, WindowTreeClient implementation: |
+void WindowTreeClientImpl::AddObserver(WindowTreeConnectionObserver* observer) { |
+ observers_.AddObserver(observer); |
+} |
+ |
+void WindowTreeClientImpl::RemoveObserver( |
+ WindowTreeConnectionObserver* observer) { |
+ observers_.RemoveObserver(observer); |
+} |
+ |
void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, |
mojom::WindowDataPtr root_data, |
mojom::WindowTreePtr tree, |
@@ -595,6 +610,8 @@ void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) { |
FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(focused).observers(), |
OnWindowFocusChanged(focused, blurred)); |
} |
+ FOR_EACH_OBSERVER(WindowTreeConnectionObserver, observers_, |
+ OnWindowTreeFocusChanged(focused, blurred)); |
} |
void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) { |