Index: ash/sysui/sysui_application.cc |
diff --git a/ash/sysui/sysui_application.cc b/ash/sysui/sysui_application.cc |
index 91e79de6bd1ef84507a337bb380b9a635460d64b..a12f5f72fe19a5998b27cb248211a8e815ba337f 100644 |
--- a/ash/sysui/sysui_application.cc |
+++ b/ash/sysui/sysui_application.cc |
@@ -60,26 +60,40 @@ const char kResourceFile100[] = "ash_resources_100_percent.pak"; |
const char kResourceFile200[] = "ash_resources_200_percent.pak"; |
// Tries to determine the corresponding mash container from widget init params. |
-mojom::Container GetContainerId(const views::Widget::InitParams& params) { |
- const int id = params.parent->id(); |
- if (id == kShellWindowId_DesktopBackgroundContainer) |
- return mojom::Container::USER_BACKGROUND; |
- if (id == kShellWindowId_ShelfContainer) |
- return mojom::Container::USER_PRIVATE_SHELF; |
- if (id == kShellWindowId_StatusContainer) |
- return mojom::Container::STATUS; |
+bool GetContainerForWidget(const views::Widget::InitParams& params, |
+ mojom::Container* container) { |
+ switch (params.parent->id()) { |
+ case kShellWindowId_DesktopBackgroundContainer: |
+ *container = mojom::Container::USER_BACKGROUND; |
+ return true; |
+ |
+ case kShellWindowId_ShelfContainer: |
+ *container = mojom::Container::USER_PRIVATE_SHELF; |
+ return true; |
+ |
+ case kShellWindowId_StatusContainer: |
+ *container = mojom::Container::STATUS; |
+ return true; |
+ } |
// Determine the container based on Widget type. |
switch (params.type) { |
case views::Widget::InitParams::Type::TYPE_BUBBLE: |
- return mojom::Container::BUBBLES; |
+ *container = mojom::Container::BUBBLES; |
+ return true; |
+ |
case views::Widget::InitParams::Type::TYPE_MENU: |
- return mojom::Container::MENUS; |
+ *container = mojom::Container::MENUS; |
+ return true; |
+ |
case views::Widget::InitParams::Type::TYPE_TOOLTIP: |
- return mojom::Container::DRAG_AND_TOOLTIPS; |
+ *container = mojom::Container::DRAG_AND_TOOLTIPS; |
+ return true; |
+ |
default: |
- return mojom::Container::COUNT; |
+ break; |
} |
+ return false; |
} |
// Tries to determine the corresponding ash window type from the ash container |
@@ -140,8 +154,8 @@ class NativeWidgetFactory { |
views::internal::NativeWidgetDelegate* delegate) { |
std::map<std::string, std::vector<uint8_t>> properties; |
if (params.parent) { |
- mojom::Container container = GetContainerId(params); |
- if (container != mojom::Container::COUNT) { |
+ mojom::Container container; |
+ if (GetContainerForWidget(params, &container)) { |
properties[mojom::kWindowContainer_Property] = |
mojo::ConvertTo<std::vector<uint8_t>>( |
static_cast<int32_t>(container)); |