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

Unified Diff: chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc

Issue 2896943002: Add "stylus-tools" Wayland protocol. (Closed)
Patch Set: Moved the property out of aura Created 3 years, 7 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 | « no previous file | components/exo/surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
index 97f746f60fc83e28d20ef544598de70092f3d14e..8c034c18df0052288145411af379f58a8c9e3568 100644
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
+++ b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
@@ -22,7 +22,9 @@
#include "chromeos/chromeos_switches.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/instance_holder.h"
+#include "components/exo/surface.h"
#include "content/public/browser/browser_thread.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_owner.h"
@@ -39,6 +41,8 @@ namespace arc {
namespace {
+using LayerSet = base::flat_set<const ui::Layer*>;
+
void ScreenshotCallback(
const mojom::VoiceInteractionFrameworkHost::CaptureFocusedWindowCallback&
callback,
@@ -51,9 +55,26 @@ void ScreenshotCallback(
callback.Run(result);
}
+bool IsMetalayerWindow(aura::Window* window) {
+ exo::Surface* surface = exo::Surface::AsSurface(window);
+ return surface != nullptr && surface->IsStylusOnly();
+}
+
+void CollectLayers(LayerSet& layers,
+ aura::Window* root_window,
+ base::Callback<bool(aura::Window*)> matcher_func) {
+ if (matcher_func.Run(root_window))
+ layers.insert(root_window->layer());
+
+ aura::Window::Windows children = root_window->children();
+ for (aura::Window::Windows::iterator iter = children.begin();
+ iter != children.end(); ++iter) {
+ CollectLayers(layers, *iter, matcher_func);
+ }
+}
+
std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshot(
aura::Window* root_window) {
- using LayerSet = base::flat_set<const ui::Layer*>;
LayerSet blocked_layers;
for (auto* browser : *BrowserList::GetInstance()) {
if (browser->profile()->IsOffTheRecord())
@@ -61,15 +82,7 @@ std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshot(
}
LayerSet excluded_layers;
- // For the best UX the metalayer has to be excluded from the snapshot.
- // It is currently impossible to identify the metalayer among others layers
- // under kShellWindowId_SystemModalContainer. Other layers in this container
- // are not relevant for this kind of snapshot, so it is safe to exclude all
- // of them.
- aura::Window* modal_container = ash::Shell::GetContainer(
- root_window, ash::kShellWindowId_SystemModalContainer);
- if (modal_container != nullptr)
- excluded_layers.insert(modal_container->layer());
+ CollectLayers(excluded_layers, root_window, base::Bind(IsMetalayerWindow));
auto layer_tree_owner = ::wm::RecreateLayersWithClosure(
root_window, base::BindRepeating(
« no previous file with comments | « no previous file | components/exo/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698