| 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..e6c967a27ca4efe64208d10cb57c91c131bce91c 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
|
| @@ -23,6 +23,7 @@
|
| #include "components/arc/arc_bridge_service.h"
|
| #include "components/arc/instance_holder.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 +40,8 @@ namespace arc {
|
|
|
| namespace {
|
|
|
| +using LayerSet = base::flat_set<const ui::Layer*>;
|
| +
|
| void ScreenshotCallback(
|
| const mojom::VoiceInteractionFrameworkHost::CaptureFocusedWindowCallback&
|
| callback,
|
| @@ -51,9 +54,25 @@ void ScreenshotCallback(
|
| callback.Run(result);
|
| }
|
|
|
| +bool IsMetalayerWindow(aura::Window* window) {
|
| + return window->GetProperty(aura::client::kStylusOnlyKey);
|
| +}
|
| +
|
| +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 +80,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(
|
|
|