Chromium Code Reviews| 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 549c76a5d34445bfcb39ba35a7a1979b18eccd90..39108c4502ac5a2d5b0fd424c8664f00e23ae1f4 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 |
| @@ -8,6 +8,7 @@ |
| #include <vector> |
| #include "ash/accelerators/accelerator_controller.h" |
| +#include "ash/public/cpp/shell_window_ids.h" |
| #include "ash/shell.h" |
| #include "base/bind.h" |
| #include "base/command_line.h" |
| @@ -59,9 +60,21 @@ std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshot( |
| blocked_layers.insert(browser->window()->GetNativeWindow()->layer()); |
| } |
| + 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); |
|
xc
2017/05/19 00:10:42
Why metalayer view is in this container?
kaznacheev
2017/05/19 00:31:05
This is where Chrome puts all Android system windo
|
| + if (modal_container != nullptr) { |
|
Luis Héctor Chávez
2017/05/19 15:03:21
nit: elide braces. Same in L91.
Vladislav Kaznacheev
2017/05/19 17:11:20
Done.
|
| + excluded_layers.insert(modal_container->layer()); |
| + } |
| + |
| auto layer_tree_owner = ::wm::RecreateLayersWithClosure( |
| root_window, base::BindRepeating( |
| - [](LayerSet blocked_layers, |
| + [](LayerSet blocked_layers, LayerSet excluded_layers, |
| ui::LayerOwner* owner) -> std::unique_ptr<ui::Layer> { |
| // Parent layer is excluded meaning that it's pointless |
| // to clone current child and all its descendants. This |
| @@ -75,9 +88,12 @@ std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshot( |
| layer->SetColor(SK_ColorBLACK); |
| return layer; |
| } |
| + if (excluded_layers.count(owner->layer())) { |
| + return nullptr; |
| + } |
| return owner->RecreateLayer(); |
| }, |
| - std::move(blocked_layers))); |
| + std::move(blocked_layers), std::move(excluded_layers))); |
| // layer_tree_owner cannot be null since we are starting off from the root |
| // window, which could never be incognito. |