Commit 84cba865 authored by Nancy Wang's avatar Nancy Wang Committed by Chromium LUCI CQ

Add the interfaces for the window management component.

This CL adds 2 interfaces for the window management component to save
the window information, and get the saved window info based on:
go/chrome-os-full-restore-interfaces

There will be separate CLs to implement these 2 interfaces.

BUG=1146900

Change-Id: Id2885863f4e9a1725382793064e10ac7597cfb1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586648
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836889}
parent edd1e108
...@@ -17,6 +17,8 @@ component("full_restore") { ...@@ -17,6 +17,8 @@ component("full_restore") {
"full_restore_utils.h", "full_restore_utils.h",
"restore_data.cc", "restore_data.cc",
"restore_data.h", "restore_data.h",
"window_info.cc",
"window_info.h",
] ]
defines = [ "IS_FULL_RESTORE_IMPL" ] defines = [ "IS_FULL_RESTORE_IMPL" ]
...@@ -25,6 +27,7 @@ component("full_restore") { ...@@ -25,6 +27,7 @@ component("full_restore") {
"//ash/public/cpp", "//ash/public/cpp",
"//base", "//base",
"//components/services/app_service/public/mojom", "//components/services/app_service/public/mojom",
"//ui/aura",
] ]
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "components/full_restore/app_launch_info.h" #include "components/full_restore/app_launch_info.h"
#include "components/full_restore/full_restore_save_handler.h" #include "components/full_restore/full_restore_save_handler.h"
#include "components/full_restore/window_info.h"
namespace { namespace {
...@@ -28,6 +29,25 @@ void SaveAppLaunchInfo(const base::FilePath& profile_dir, ...@@ -28,6 +29,25 @@ void SaveAppLaunchInfo(const base::FilePath& profile_dir,
profile_dir, std::move(app_launch_info)); profile_dir, std::move(app_launch_info));
} }
void SaveWindowInfo(std::unique_ptr<WindowInfo> window_info) {
if (!ash::features::IsFullRestoreEnabled())
return;
// TODO(crbug.com/1146900): Save the window information to the full restore
// file.
}
std::unique_ptr<WindowInfo> GetWindowInfo(aura::Window* window) {
if (!ash::features::IsFullRestoreEnabled())
return nullptr;
auto window_info = std::make_unique<WindowInfo>();
// TODO(crbug.com/1146900): Get the window information from the full restore
// file.
return window_info;
}
bool ShouldRestore() { bool ShouldRestore() {
return g_restore; return g_restore;
} }
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include "base/component_export.h" #include "base/component_export.h"
namespace aura {
class Window;
}
namespace base { namespace base {
class FilePath; class FilePath;
} }
...@@ -16,12 +20,21 @@ class FilePath; ...@@ -16,12 +20,21 @@ class FilePath;
namespace full_restore { namespace full_restore {
struct AppLaunchInfo; struct AppLaunchInfo;
struct WindowInfo;
// Saves the app launch parameters to the full restore file. // Saves the app launch parameters to the full restore file.
COMPONENT_EXPORT(FULL_RESTORE) COMPONENT_EXPORT(FULL_RESTORE)
void SaveAppLaunchInfo(const base::FilePath& profile_dir, void SaveAppLaunchInfo(const base::FilePath& profile_dir,
std::unique_ptr<AppLaunchInfo> app_launch_info); std::unique_ptr<AppLaunchInfo> app_launch_info);
// Saves the window information to the full restore file.
COMPONENT_EXPORT(FULL_RESTORE)
void SaveWindowInfo(std::unique_ptr<WindowInfo> window_info);
// Gets the window information from the full restore file.
COMPONENT_EXPORT(FULL_RESTORE)
std::unique_ptr<WindowInfo> GetWindowInfo(aura::Window* window);
// Returns true if we should restore apps and pages based on the restore setting // Returns true if we should restore apps and pages based on the restore setting
// and the user's choice from the notification. Otherwise, returns false. // and the user's choice from the notification. Otherwise, returns false.
COMPONENT_EXPORT(FULL_RESTORE) bool ShouldRestore(); COMPONENT_EXPORT(FULL_RESTORE) bool ShouldRestore();
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/full_restore/window_info.h"
namespace full_restore {
WindowInfo::WindowInfo() = default;
WindowInfo::~WindowInfo() = default;
} // namespace full_restore
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_FULL_RESTORE_WINDOW_INFO_H_
#define COMPONENTS_FULL_RESTORE_WINDOW_INFO_H_
#include "base/optional.h"
#include "ui/aura/window.h"
#include "ui/gfx/geometry/rect.h"
namespace full_restore {
// This struct is the parameter for the interface SaveWindowInfo, to save the
// window information.
struct COMPONENT_EXPORT(FULL_RESTORE) WindowInfo {
public:
WindowInfo();
WindowInfo(const WindowInfo&) = delete;
WindowInfo& operator=(const WindowInfo&) = delete;
~WindowInfo();
aura::Window* window;
// Index in MruWindowTracker to restore window stack.
base::Optional<int32_t> activation_index;
// Virtual desk id.
base::Optional<int32_t> desk_id;
// The restored bounds in screen coordinates. Empty if the window is not
// snapped/maximized/minimized.
base::Optional<gfx::Rect> restore_bounds;
// Current bounds in screen in coordinates.
base::Optional<gfx::Rect> current_bounds;
// Window state, minimized, maximized, inactive, etc.
base::Optional<int32_t> window_state_type;
};
} // namespace full_restore
#endif // COMPONENTS_FULL_RESTORE_WINDOW_INFO_H_
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