OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/mus/shelf_delegate_mus.h" | 5 #include "ash/mus/shelf_delegate_mus.h" |
6 | 6 |
7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
8 #include "ash/shelf/shelf_item_delegate.h" | 8 #include "ash/shelf/shelf_item_delegate.h" |
9 #include "ash/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/shelf/shelf_item_delegate_manager.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
11 #include "ash/shelf/shelf_model.h" | 11 #include "ash/shelf/shelf_model.h" |
12 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "components/mus/public/cpp/property_type_converters.h" | 15 #include "components/mus/public/cpp/property_type_converters.h" |
16 #include "components/mus/public/cpp/window.h" | 16 #include "components/mus/public/cpp/window.h" |
17 #include "components/mus/public/cpp/window_property.h" | 17 #include "components/mus/public/cpp/window_property.h" |
18 #include "mojo/common/common_type_converters.h" | 18 #include "mojo/common/common_type_converters.h" |
19 #include "mojo/shell/public/cpp/shell.h" | 19 #include "mojo/shell/public/cpp/connector.h" |
20 #include "ui/aura/mus/mus_util.h" | 20 #include "ui/aura/mus/mus_util.h" |
21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/resources/grit/ui_resources.h" | 22 #include "ui/resources/grit/ui_resources.h" |
23 #include "ui/views/mus/window_manager_connection.h" | 23 #include "ui/views/mus/window_manager_connection.h" |
24 | 24 |
25 using mash::wm::mojom::UserWindowController; | 25 using mash::wm::mojom::UserWindowController; |
26 | 26 |
27 namespace ash { | 27 namespace ash { |
28 namespace sysui { | 28 namespace sysui { |
29 | 29 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::string16 title_; | 83 base::string16 title_; |
84 UserWindowController* user_window_controller_; | 84 UserWindowController* user_window_controller_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegateMus); | 86 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegateMus); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace | 89 } // namespace |
90 | 90 |
91 ShelfDelegateMus::ShelfDelegateMus(ShelfModel* model) | 91 ShelfDelegateMus::ShelfDelegateMus(ShelfModel* model) |
92 : model_(model), binding_(this) { | 92 : model_(model), binding_(this) { |
93 mojo::Shell* shell = views::WindowManagerConnection::Get()->shell(); | 93 mojo::Connector* connector = |
94 shell->ConnectToInterface("mojo:desktop_wm", &user_window_controller_); | 94 views::WindowManagerConnection::Get()->connector(); |
| 95 connector->ConnectToInterface("mojo:desktop_wm", &user_window_controller_); |
95 user_window_controller_->AddUserWindowObserver( | 96 user_window_controller_->AddUserWindowObserver( |
96 binding_.CreateInterfacePtrAndBind()); | 97 binding_.CreateInterfacePtrAndBind()); |
97 } | 98 } |
98 | 99 |
99 ShelfDelegateMus::~ShelfDelegateMus() {} | 100 ShelfDelegateMus::~ShelfDelegateMus() {} |
100 | 101 |
101 void ShelfDelegateMus::OnShelfCreated(Shelf* shelf) { | 102 void ShelfDelegateMus::OnShelfCreated(Shelf* shelf) { |
102 ash::ShelfWidget* widget = shelf->shelf_widget(); | 103 ash::ShelfWidget* widget = shelf->shelf_widget(); |
103 ash::ShelfLayoutManager* layout_manager = widget->shelf_layout_manager(); | 104 ash::ShelfLayoutManager* layout_manager = widget->shelf_layout_manager(); |
104 mus::Window* window = aura::GetMusWindow(widget->GetNativeWindow()); | 105 mus::Window* window = aura::GetMusWindow(widget->GetNativeWindow()); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 DCHECK_GE(index, 0); | 211 DCHECK_GE(index, 0); |
211 ShelfItems::const_iterator iter = model_->ItemByID(shelf_id); | 212 ShelfItems::const_iterator iter = model_->ItemByID(shelf_id); |
212 DCHECK(iter != model_->items().end()); | 213 DCHECK(iter != model_->items().end()); |
213 ShelfItem item = *iter; | 214 ShelfItem item = *iter; |
214 item.status = has_focus ? STATUS_ACTIVE : STATUS_RUNNING; | 215 item.status = has_focus ? STATUS_ACTIVE : STATUS_RUNNING; |
215 model_->Set(index, item); | 216 model_->Set(index, item); |
216 } | 217 } |
217 | 218 |
218 } // namespace sysui | 219 } // namespace sysui |
219 } // namespace ash | 220 } // namespace ash |
OLD | NEW |