| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mash/wm/user_window_controller_impl.h" | 5 #include "mash/wm/user_window_controller_impl.h" |
| 6 | 6 |
| 7 #include "components/mus/public/cpp/property_type_converters.h" | 7 #include "components/mus/public/cpp/property_type_converters.h" |
| 8 #include "components/mus/public/cpp/window.h" | 8 #include "components/mus/public/cpp/window.h" |
| 9 #include "components/mus/public/cpp/window_property.h" | 9 #include "components/mus/public/cpp/window_property.h" |
| 10 #include "components/mus/public/cpp/window_tree_connection.h" | 10 #include "components/mus/public/cpp/window_tree_connection.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Get a UserWindow struct from a mus::Window. | 34 // Get a UserWindow struct from a mus::Window. |
| 35 mojom::UserWindowPtr GetUserWindow(mus::Window* window) { | 35 mojom::UserWindowPtr GetUserWindow(mus::Window* window) { |
| 36 mojom::UserWindowPtr user_window(mojom::UserWindow::New()); | 36 mojom::UserWindowPtr user_window(mojom::UserWindow::New()); |
| 37 DCHECK_NE(0u, window->GetLocalProperty(kUserWindowIdKey)); | 37 DCHECK_NE(0u, window->GetLocalProperty(kUserWindowIdKey)); |
| 38 user_window->window_id = window->GetLocalProperty(kUserWindowIdKey); | 38 user_window->window_id = window->GetLocalProperty(kUserWindowIdKey); |
| 39 user_window->window_title = mojo::String::From(GetWindowTitle(window)); | 39 user_window->window_title = mojo::String::From(GetWindowTitle(window)); |
| 40 user_window->window_app_icon = GetWindowAppIcon(window); | 40 user_window->window_app_icon = GetWindowAppIcon(window); |
| 41 user_window->window_app_id = mojo::String::From(GetAppID(window)); | 41 user_window->window_app_id = mojo::String::From(GetAppID(window)); |
| 42 user_window->ignored_by_shelf = GetWindowIgnoredByShelf(window); |
| 42 mus::Window* focused = window->connection()->GetFocusedWindow(); | 43 mus::Window* focused = window->connection()->GetFocusedWindow(); |
| 43 focused = GetTopLevelWindow(focused, window->parent()); | 44 focused = GetTopLevelWindow(focused, window->parent()); |
| 44 user_window->window_has_focus = focused == window; | 45 user_window->window_has_focus = focused == window; |
| 45 return user_window; | 46 return user_window; |
| 46 } | 47 } |
| 47 | 48 |
| 48 } // namespace | 49 } // namespace |
| 49 | 50 |
| 50 // Observes property changes on user windows. UserWindowControllerImpl uses | 51 // Observes property changes on user windows. UserWindowControllerImpl uses |
| 51 // this separate observer to avoid observing duplicate tree change | 52 // this separate observer to avoid observing duplicate tree change |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 183 } |
| 183 | 184 |
| 184 void UserWindowControllerImpl::FocusUserWindow(uint32_t window_id) { | 185 void UserWindowControllerImpl::FocusUserWindow(uint32_t window_id) { |
| 185 mus::Window* window = GetUserWindowById(window_id); | 186 mus::Window* window = GetUserWindowById(window_id); |
| 186 if (window) | 187 if (window) |
| 187 window->SetFocus(); | 188 window->SetFocus(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace wm | 191 } // namespace wm |
| 191 } // namespace mash | 192 } // namespace mash |
| OLD | NEW |