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

Side by Side Diff: ash/sysui/sysui_application.cc

Issue 2033843003: Makes ash/mus use RootWindowControllerCommon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_mash_wm
Patch Set: merge fail Created 4 years, 6 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
« no previous file with comments | « ash/public/interfaces/container.mojom ('k') | ash/wm/ash_focus_rules.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sysui/sysui_application.h" 5 #include "ash/sysui/sysui_application.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 namespace ash { 57 namespace ash {
58 namespace sysui { 58 namespace sysui {
59 59
60 namespace { 60 namespace {
61 61
62 const char kResourceFileStrings[] = "ash_resources_strings.pak"; 62 const char kResourceFileStrings[] = "ash_resources_strings.pak";
63 const char kResourceFile100[] = "ash_resources_100_percent.pak"; 63 const char kResourceFile100[] = "ash_resources_100_percent.pak";
64 const char kResourceFile200[] = "ash_resources_200_percent.pak"; 64 const char kResourceFile200[] = "ash_resources_200_percent.pak";
65 65
66 // Tries to determine the corresponding mash container from widget init params. 66 // Tries to determine the corresponding mash container from widget init params.
67 ash::mojom::Container GetContainerId(const views::Widget::InitParams& params) { 67 bool GetContainerForWidget(const views::Widget::InitParams& params,
68 const int id = params.parent->id(); 68 ash::mojom::Container* container) {
69 if (id == kShellWindowId_DesktopBackgroundContainer) 69 switch (params.parent->id()) {
70 return ash::mojom::Container::USER_BACKGROUND; 70 case kShellWindowId_DesktopBackgroundContainer:
71 if (id == kShellWindowId_ShelfContainer) 71 *container = ash::mojom::Container::USER_BACKGROUND;
72 return ash::mojom::Container::USER_PRIVATE_SHELF; 72 return true;
73 if (id == kShellWindowId_StatusContainer) 73
74 return ash::mojom::Container::STATUS; 74 case kShellWindowId_ShelfContainer:
75 *container = ash::mojom::Container::USER_PRIVATE_SHELF;
76 return true;
77
78 case kShellWindowId_StatusContainer:
79 *container = ash::mojom::Container::STATUS;
80 return true;
81 }
75 82
76 // Determine the container based on Widget type. 83 // Determine the container based on Widget type.
77 switch (params.type) { 84 switch (params.type) {
78 case views::Widget::InitParams::Type::TYPE_BUBBLE: 85 case views::Widget::InitParams::Type::TYPE_BUBBLE:
79 return ash::mojom::Container::BUBBLES; 86 *container = ash::mojom::Container::BUBBLES;
87 return true;
88
80 case views::Widget::InitParams::Type::TYPE_MENU: 89 case views::Widget::InitParams::Type::TYPE_MENU:
81 return ash::mojom::Container::MENUS; 90 *container = ash::mojom::Container::MENUS;
91 return true;
92
82 case views::Widget::InitParams::Type::TYPE_TOOLTIP: 93 case views::Widget::InitParams::Type::TYPE_TOOLTIP:
83 return ash::mojom::Container::DRAG_AND_TOOLTIPS; 94 *container = ash::mojom::Container::DRAG_AND_TOOLTIPS;
95 return true;
96
84 default: 97 default:
85 return ash::mojom::Container::COUNT; 98 break;
86 } 99 }
100 return false;
87 } 101 }
88 102
89 // Tries to determine the corresponding ash window type from the ash container 103 // Tries to determine the corresponding ash window type from the ash container
90 // for the widget. 104 // for the widget.
91 ash::mojom::AshWindowType GetAshWindowType(aura::Window* container) { 105 ash::mojom::AshWindowType GetAshWindowType(aura::Window* container) {
92 DCHECK(container); 106 DCHECK(container);
93 int id = container->id(); 107 int id = container->id();
94 if (id == kShellWindowId_ShelfContainer) 108 if (id == kShellWindowId_ShelfContainer)
95 return ash::mojom::AshWindowType::SHELF; 109 return ash::mojom::AshWindowType::SHELF;
96 if (id == kShellWindowId_StatusContainer) 110 if (id == kShellWindowId_StatusContainer)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ViewsDelegate::GetInstance()->set_native_widget_factory( 151 ViewsDelegate::GetInstance()->set_native_widget_factory(
138 ViewsDelegate::NativeWidgetFactory()); 152 ViewsDelegate::NativeWidgetFactory());
139 } 153 }
140 154
141 private: 155 private:
142 views::NativeWidget* InitNativeWidget( 156 views::NativeWidget* InitNativeWidget(
143 const views::Widget::InitParams& params, 157 const views::Widget::InitParams& params,
144 views::internal::NativeWidgetDelegate* delegate) { 158 views::internal::NativeWidgetDelegate* delegate) {
145 std::map<std::string, std::vector<uint8_t>> properties; 159 std::map<std::string, std::vector<uint8_t>> properties;
146 if (params.parent) { 160 if (params.parent) {
147 ash::mojom::Container container = GetContainerId(params); 161 ash::mojom::Container container;
148 if (container != ash::mojom::Container::COUNT) { 162 if (GetContainerForWidget(params, &container)) {
149 properties[ash::mojom::kWindowContainer_Property] = 163 properties[ash::mojom::kWindowContainer_Property] =
150 mojo::ConvertTo<std::vector<uint8_t>>( 164 mojo::ConvertTo<std::vector<uint8_t>>(
151 static_cast<int32_t>(container)); 165 static_cast<int32_t>(container));
152 } 166 }
153 ash::mojom::AshWindowType type = GetAshWindowType(params.parent); 167 ash::mojom::AshWindowType type = GetAshWindowType(params.parent);
154 if (type != ash::mojom::AshWindowType::COUNT) { 168 if (type != ash::mojom::AshWindowType::COUNT) {
155 properties[ash::mojom::kAshWindowType_Property] = 169 properties[ash::mojom::kAshWindowType_Property] =
156 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>(type)); 170 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>(type));
157 } 171 }
158 } 172 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 mojom::WallpaperControllerRequest request) { 333 mojom::WallpaperControllerRequest request) {
320 mojom::WallpaperController* wallpaper_controller = 334 mojom::WallpaperController* wallpaper_controller =
321 static_cast<UserWallpaperDelegateMus*>( 335 static_cast<UserWallpaperDelegateMus*>(
322 Shell::GetInstance()->user_wallpaper_delegate()); 336 Shell::GetInstance()->user_wallpaper_delegate());
323 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, 337 wallpaper_controller_bindings_.AddBinding(wallpaper_controller,
324 std::move(request)); 338 std::move(request));
325 } 339 }
326 340
327 } // namespace sysui 341 } // namespace sysui
328 } // namespace ash 342 } // namespace ash
OLDNEW
« no previous file with comments | « ash/public/interfaces/container.mojom ('k') | ash/wm/ash_focus_rules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698