Commit fb356de7 authored by Muyuan Li's avatar Muyuan Li Committed by Commit Bot

assistant: take screenshot on screen with stylus selection.

Bug: b/111105039
Test: Manual
Change-Id: I7c39e63c2b65f557f668687bdc34ced2256462f6
Reviewed-on: https://chromium-review.googlesource.com/1149065Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Muyuan Li <muyuanli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579523}
parent 63512459
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "ui/gfx/skbitmap_operations.h" #include "ui/gfx/skbitmap_operations.h"
#include "ui/snapshot/snapshot.h" #include "ui/snapshot/snapshot.h"
#include "ui/snapshot/snapshot_aura.h" #include "ui/snapshot/snapshot_aura.h"
#include "ui/wm/core/focus_controller.h"
#include "ui/wm/core/window_util.h" #include "ui/wm/core/window_util.h"
namespace ash { namespace ash {
...@@ -143,8 +144,7 @@ void AssistantScreenContextController::RemoveModelObserver( ...@@ -143,8 +144,7 @@ void AssistantScreenContextController::RemoveModelObserver(
void AssistantScreenContextController::RequestScreenshot( void AssistantScreenContextController::RequestScreenshot(
const gfx::Rect& rect, const gfx::Rect& rect,
mojom::AssistantController::RequestScreenshotCallback callback) { mojom::AssistantController::RequestScreenshotCallback callback) {
// TODO(muyuanli): Handle multi-display when Assistant's behavior is defined. aura::Window* root_window = Shell::Get()->GetRootWindowForNewWindows();
aura::Window* root_window = Shell::GetPrimaryRootWindow();
std::unique_ptr<ui::LayerTreeOwner> layer_owner = std::unique_ptr<ui::LayerTreeOwner> layer_owner =
CreateLayerForAssistantSnapshot(root_window); CreateLayerForAssistantSnapshot(root_window);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ash/public/cpp/scale_utility.h" #include "ash/public/cpp/scale_utility.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_state.h"
#include "ash/system/palette/palette_utils.h" #include "ash/system/palette/palette_utils.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
...@@ -223,6 +224,10 @@ void HighlighterController::RecognizeGesture() { ...@@ -223,6 +224,10 @@ void HighlighterController::RecognizeGesture() {
if (!box.IsEmpty() && if (!box.IsEmpty() &&
gesture_type != HighlighterGestureType::kNotRecognized) { gesture_type != HighlighterGestureType::kNotRecognized) {
// The window for selection should be the root window to show assistant.
Shell::Get()->shell_state()->SetRootWindowForNewWindows(
current_window->GetRootWindow());
// TODO(muyuanli): Delete the check when native assistant is default on. // TODO(muyuanli): Delete the check when native assistant is default on.
// This is a temporary workaround to support both ARC-based assistant // This is a temporary workaround to support both ARC-based assistant
// and native assistant. In ARC-based assistant, we send the rect in pixels // and native assistant. In ARC-based assistant, we send the rect in pixels
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment