Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1176)

Side by Side Diff: mash/wm/user_window_controller_impl.cc

Issue 1899323002: Add mash shelf application id support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
31 return window; 31 return window;
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 mus::Window* focused = window->connection()->GetFocusedWindow(); 42 mus::Window* focused = window->connection()->GetFocusedWindow();
42 focused = GetTopLevelWindow(focused, window->parent()); 43 focused = GetTopLevelWindow(focused, window->parent());
43 user_window->window_has_focus = focused == window; 44 user_window->window_has_focus = focused == window;
44 return user_window; 45 return user_window;
45 } 46 }
46 47
47 } // namespace 48 } // namespace
48 49
49 // Observes property changes on user windows. UserWindowControllerImpl uses 50 // Observes property changes on user windows. UserWindowControllerImpl uses
50 // this separate observer to avoid observing duplicate tree change 51 // this separate observer to avoid observing duplicate tree change
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 182 }
182 183
183 void UserWindowControllerImpl::FocusUserWindow(uint32_t window_id) { 184 void UserWindowControllerImpl::FocusUserWindow(uint32_t window_id) {
184 mus::Window* window = GetUserWindowById(window_id); 185 mus::Window* window = GetUserWindowById(window_id);
185 if (window) 186 if (window)
186 window->SetFocus(); 187 window->SetFocus();
187 } 188 }
188 189
189 } // namespace wm 190 } // namespace wm
190 } // namespace mash 191 } // namespace mash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698