| 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/sysui_application.h" | 5 #include "ash/mus/sysui_application.h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
| 8 #include "ash/host/ash_window_tree_host_init_params.h" | 8 #include "ash/host/ash_window_tree_host_init_params.h" |
| 9 #include "ash/host/ash_window_tree_host_platform.h" | 9 #include "ash/host/ash_window_tree_host_platform.h" |
| 10 #include "ash/mus/keyboard_ui_mus.h" | 10 #include "ash/mus/keyboard_ui_mus.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 using views::ViewsDelegate; | 41 using views::ViewsDelegate; |
| 42 | 42 |
| 43 namespace ash { | 43 namespace ash { |
| 44 namespace sysui { | 44 namespace sysui { |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 // Tries to determine the corresponding mash container from widget init params. | 48 // Tries to determine the corresponding mash container from widget init params. |
| 49 mash::wm::mojom::Container GetContainerId( | 49 mash::wm::mojom::Container GetContainerId( |
| 50 const views::Widget::InitParams& params) { | 50 const views::Widget::InitParams& params) { |
| 51 DCHECK(params.parent); | |
| 52 const int id = params.parent->id(); | 51 const int id = params.parent->id(); |
| 53 if (id == kShellWindowId_DesktopBackgroundContainer) | 52 if (id == kShellWindowId_DesktopBackgroundContainer) |
| 54 return mash::wm::mojom::Container::USER_BACKGROUND; | 53 return mash::wm::mojom::Container::USER_BACKGROUND; |
| 55 // mash::wm::ShelfLayout manages both the shelf and the status area. | 54 // mash::wm::ShelfLayout manages both the shelf and the status area. |
| 56 if (id == kShellWindowId_ShelfContainer || | 55 if (id == kShellWindowId_ShelfContainer || |
| 57 id == kShellWindowId_StatusContainer) { | 56 id == kShellWindowId_StatusContainer) { |
| 58 return mash::wm::mojom::Container::USER_SHELF; | 57 return mash::wm::mojom::Container::USER_SHELF; |
| 59 } | 58 } |
| 60 | 59 |
| 61 // Show mash shelf tooltips and settings bubbles in the menu container. | 60 // Determine the container based on Widget type. |
| 62 if (params.type == views::Widget::InitParams::Type::TYPE_MENU || | 61 switch (params.type) { |
| 63 params.type == views::Widget::InitParams::Type::TYPE_BUBBLE) { | 62 case views::Widget::InitParams::Type::TYPE_BUBBLE: |
| 64 return mash::wm::mojom::Container::MENUS; | 63 return mash::wm::mojom::Container::BUBBLES; |
| 64 case views::Widget::InitParams::Type::TYPE_MENU: |
| 65 return mash::wm::mojom::Container::MENUS; |
| 66 case views::Widget::InitParams::Type::TYPE_TOOLTIP: |
| 67 return mash::wm::mojom::Container::TOOLTIPS; |
| 68 default: |
| 69 return mash::wm::mojom::Container::COUNT; |
| 65 } | 70 } |
| 66 | |
| 67 if (params.type == views::Widget::InitParams::Type::TYPE_TOOLTIP) | |
| 68 return mash::wm::mojom::Container::TOOLTIPS; | |
| 69 | |
| 70 return mash::wm::mojom::Container::COUNT; | |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Tries to determine the corresponding ash window type from the ash container | 73 // Tries to determine the corresponding ash window type from the ash container |
| 74 // for the widget. | 74 // for the widget. |
| 75 mash::wm::mojom::AshWindowType GetAshWindowType(aura::Window* container) { | 75 mash::wm::mojom::AshWindowType GetAshWindowType(aura::Window* container) { |
| 76 DCHECK(container); | 76 DCHECK(container); |
| 77 int id = container->id(); | 77 int id = container->id(); |
| 78 if (id == kShellWindowId_ShelfContainer) | 78 if (id == kShellWindowId_ShelfContainer) |
| 79 return mash::wm::mojom::AshWindowType::SHELF; | 79 return mash::wm::mojom::AshWindowType::SHELF; |
| 80 if (id == kShellWindowId_StatusContainer) | 80 if (id == kShellWindowId_StatusContainer) |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 ash_init_.reset(new AshInit()); | 292 ash_init_.reset(new AshInit()); |
| 293 ash_init_->Initialize(connector); | 293 ash_init_->Initialize(connector); |
| 294 } | 294 } |
| 295 | 295 |
| 296 bool SysUIApplication::AcceptConnection(mojo::Connection* connection) { | 296 bool SysUIApplication::AcceptConnection(mojo::Connection* connection) { |
| 297 return true; | 297 return true; |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace sysui | 300 } // namespace sysui |
| 301 } // namespace ash | 301 } // namespace ash |
| OLD | NEW |