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

Unified Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc

Issue 2665523002: mash: Use ChromeNativeAppWindowViewsAuraAsh; workaround crashes. (Closed)
Patch Set: Cleanup; fix panel with frame crash. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/apps/chrome_app_window_client_views_chromeos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
index abc6fb929eafbf966d5119a69f6b1bad7c1b5858..ae52bf0d0f86777a62a8d26772a71e9113782770 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
@@ -28,6 +28,7 @@
#include "services/ui/public/cpp/property_type_converters.h"
#include "services/ui/public/interfaces/window_manager.mojom.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/mus/property_converter.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
@@ -136,7 +137,9 @@ void ChromeNativeAppWindowViewsAuraAsh::InitializeWindow(
if (app_window->window_type_is_panel()) {
// Ash's ShelfWindowWatcher handles app panel windows once this type is set.
- window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_APP_PANEL);
+ // The type should have been initialized for mash below, via mus_properties.
+ if (!chrome::IsRunningInMash())
+ window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_APP_PANEL);
} else {
window->SetProperty(aura::client::kAppType,
static_cast<int>(ash::AppType::CHROME_APP));
@@ -150,11 +153,23 @@ void ChromeNativeAppWindowViewsAuraAsh::OnBeforeWidgetInit(
ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit(create_params, init_params,
widget);
if (create_params.is_ime_window) {
- // Puts ime windows into the ime window container.
- init_params->parent =
- ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
- ash::kShellWindowId_ImeWindowParentContainer);
+ // Put ime windows into the ime window container on the primary display.
+ int container_id = ash::kShellWindowId_ImeWindowParentContainer;
+ if (chrome::IsRunningInMash()) {
+ init_params->mus_properties
+ [ui::mojom::WindowManager::kContainerId_InitProperty] =
+ mojo::ConvertTo<std::vector<uint8_t>>(container_id);
+ int display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+ init_params
+ ->mus_properties[ui::mojom::WindowManager::kDisplayId_InitProperty] =
+ mojo::ConvertTo<std::vector<uint8_t>>(display_id);
+ } else {
+ init_params->parent = ash::Shell::GetContainer(
+ ash::Shell::GetPrimaryRootWindow(), container_id);
+ }
}
+ DCHECK_NE(AppWindow::WINDOW_TYPE_PANEL, create_params.window_type);
+ DCHECK_NE(AppWindow::WINDOW_TYPE_V1_PANEL, create_params.window_type);
init_params->mus_properties
[ui::mojom::WindowManager::kRemoveStandardFrame_InitProperty] =
mojo::ConvertTo<std::vector<uint8_t>>(init_params->remove_standard_frame);
@@ -168,7 +183,14 @@ void ChromeNativeAppWindowViewsAuraAsh::OnBeforePanelWidgetInit(
init_params,
widget);
- if (ash::Shell::HasInstance() && use_default_bounds) {
+ if (chrome::IsRunningInMash()) {
+ // Ash's ShelfWindowWatcher handles app panel windows once this type is set.
+ init_params
+ ->mus_properties[ui::mojom::WindowManager::kShelfItemType_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(
+ static_cast<aura::PropertyConverter::PrimitiveType>(
+ ash::TYPE_APP_PANEL));
+ } else if (ash::Shell::HasInstance() && use_default_bounds) {
// Open a new panel on the target root.
init_params->context = ash::Shell::GetTargetRootWindow();
init_params->bounds = ash::ScreenUtil::ConvertRectToScreen(
@@ -284,6 +306,9 @@ ChromeNativeAppWindowViewsAuraAsh::CreateNonClientFrameView(
if (IsFrameless())
return CreateNonStandardAppFrame();
+ if (chrome::IsRunningInMash())
+ return ChromeNativeAppWindowViews::CreateNonClientFrameView(widget);
+
if (app_window()->window_type_is_panel()) {
ash::PanelFrameView* frame_view =
new ash::PanelFrameView(widget, ash::PanelFrameView::FRAME_ASH);
@@ -293,9 +318,6 @@ ChromeNativeAppWindowViewsAuraAsh::CreateNonClientFrameView(
return frame_view;
}
- if (chrome::IsRunningInMash())
- return ChromeNativeAppWindowViews::CreateNonClientFrameView(widget);
-
ash::CustomFrameViewAsh* custom_frame_view =
new ash::CustomFrameViewAsh(widget);
// Non-frameless app windows can be put into immersive fullscreen.
@@ -328,8 +350,10 @@ void ChromeNativeAppWindowViewsAuraAsh::SetFullscreen(int fullscreen_types) {
ash::wm::GetWindowState(widget()->GetNativeWindow());
window_state->set_hide_shelf_when_fullscreen(fullscreen_types !=
AppWindow::FULLSCREEN_TYPE_OS);
- DCHECK(ash::Shell::HasInstance());
- ash::Shell::GetInstance()->UpdateShelfVisibility();
+ if (!chrome::IsRunningInMash()) {
+ DCHECK(ash::Shell::HasInstance());
+ ash::Shell::GetInstance()->UpdateShelfVisibility();
+ }
}
}
« no previous file with comments | « chrome/browser/ui/views/apps/chrome_app_window_client_views_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698