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

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

Issue 2889183004: Exclude Android system windows from a voice interaction snapshsot. (Closed)
Patch Set: Addressed comments 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 | no next file » | 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 549c76a5d34445bfcb39ba35a7a1979b18eccd90..97f746f60fc83e28d20ef544598de70092f3d14e 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,20 @@ 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);
+ if (modal_container != nullptr)
+ 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 +87,11 @@ 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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698