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

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

Issue 2042903002: Support app window draggable areas in mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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 side-by-side diff with in-line comments
Download patch
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 718bbe92d49cb191aff3b2ca46c6d7ab47be8597..0367bc0c101a40d8eb9649e2efb1895328dc62e8 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,14 @@
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/widget/widget.h"
+#if defined(MOJO_SHELL_CLIENT)
+#include "components/mus/public/cpp/property_type_converters.h"
+#include "components/mus/public/cpp/window.h"
+#include "components/mus/public/interfaces/window_manager.mojom.h"
+#include "ui/aura/mus/mus_util.h"
+#include "ui/gfx/skia_util.h"
+#endif
+
using extensions::AppWindow;
namespace {
@@ -140,6 +148,11 @@ void ChromeNativeAppWindowViewsAuraAsh::OnBeforeWidgetInit(
ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
ash::kShellWindowId_ImeWindowParentContainer);
}
+#if defined(MOJO_SHELL_CLIENT)
+ init_params->mus_properties
+ [mus::mojom::WindowManager::kRemoveStandardFrame_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(init_params->remove_standard_frame);
dcheng 2016/06/16 09:04:36 How does a bool turn into a vector of bytes? (Am I
msw 2016/06/16 16:54:21 Yes, see the impl here: https://cs.chromium.org/ch
sky 2016/06/16 20:03:07 property_type_converters contains common types use
dcheng 2016/06/16 20:13:54 Right, but there's nothing mus-specific about the
+#endif
}
void ChromeNativeAppWindowViewsAuraAsh::OnBeforePanelWidgetInit(
@@ -312,3 +325,29 @@ void ChromeNativeAppWindowViewsAuraAsh::SetFullscreen(int fullscreen_types) {
ash::Shell::GetInstance()->UpdateShelfVisibility();
}
}
+
+void ChromeNativeAppWindowViewsAuraAsh::UpdateDraggableRegions(
+ const std::vector<extensions::DraggableRegion>& regions) {
+ ChromeNativeAppWindowViewsAura::UpdateDraggableRegions(regions);
+
+#if defined(MOJO_SHELL_CLIENT)
+ SkRegion* draggable_region = GetDraggableRegion();
+ // Set the NativeAppWindow's draggable region on the mus window.
+ if (draggable_region && !draggable_region->isEmpty() && widget() &&
+ GetMusWindow(widget()->GetNativeWindow())) {
+ // Supply client area insets that encompass all draggable regions.
+ gfx::Insets insets(draggable_region->getBounds().bottom(), 0, 0, 0);
+
+ // Invert the draggable regions to determine the additional client areas.
+ SkRegion inverted_region;
+ inverted_region.setRect(draggable_region->getBounds());
+ inverted_region.op(*draggable_region, SkRegion::kDifference_Op);
+ std::vector<gfx::Rect> additional_client_regions;
+ for (SkRegion::Iterator i(inverted_region); !i.done(); i.next())
+ additional_client_regions.push_back(gfx::SkIRectToRect(i.rect()));
+
+ GetMusWindow(widget()->GetNativeWindow())
+ ->SetClientArea(insets, std::move(additional_client_regions));
+ }
+#endif
+}

Powered by Google App Engine
This is Rietveld 408576698