---
# System prepended metadata

title: Overview session in ChromeOS
tags: [Chromium-Graphics, elkurin-daily-note]

---

# Overview session in ChromeOS

Overview mode is the feature in ChromeOS to see the list of the windows at once with smaller size.  
You can enter overview mode by pressing F5 or swiping up the bottom on tablet mode.  
You can select the window to activate by clicking or touching the window you want to activate.

Let's see some basic implementation and objects.

## Overview Sesion, Grid and Item
[OverviewSession](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_session.h;l=63;drc=ed78fc845558abe744fc8ac34f5a9192d6f8d51e) shows a overview grids for all of your windows.  
Each grid is represented as [OverviewGrid](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_grid.h;l=64;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090) which is an instace that is created during the overview session initialization.  
This is created for each root window on [OverviewSession::Init](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_session.cc;l=214;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090).  
This will contain all [OverviewItemBase](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_grid.h;l=620;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090) as `item_list_`.  

OverviewSession is a member of [OverviewController](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_controller.h;l=171;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090) which manages a overview session to display all overview feature.

[OverviewItemBase](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_item_base.h;l=48;drc=c2661ec2af8d75f3973bd7a75e1ec1c232cafd0e) is an interface for overview item.  
We have [OverviewItem](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_item.h;l=42;drc=788583afe3e6b0fac844b20622443fc14c19e1f0), [OverviewGroupItem](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_group_item.h;l=29;drc=e63cbaf6fdcfdac0f04883d956b00e83330bd0a2) and [OverviewDropTarget](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_drop_target.h;l=21;drc=e63cbaf6fdcfdac0f04883d956b00e83330bd0a2) as the implementation of the interface.  
[OverviewItem](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_item.h;l=42;drc=788583afe3e6b0fac844b20622443fc14c19e1f0) implements the basic view, a single window in overview mode.  
[OverviewGroupItem](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_group_item.h;l=29;drc=e63cbaf6fdcfdac0f04883d956b00e83330bd0a2) implements a window group which is the composite item of the item hierarchy.  

[OverviewSession::SelectWindow](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_session.cc;l=410;drc=ed78fc845558abe744fc8ac34f5a9192d6f8d51e) is called to activate the window.  
`item` which is [OverviewItemBase](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_item_base.h;l=48;drc=c2661ec2af8d75f3973bd7a75e1ec1c232cafd0e) will be passed as the event target.

## How to set Overview item bounds
[`target_bounds_`](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_item_base.h;l=359;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090) represents the bounds of the item size for the item.  
This is not the original window size.  

The item size is calculated inside [OverviewGrid::PositionWindows](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_grid.cc;l=689;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090).  
[GetWindowRects](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_grid.cc;l=2441;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090) return the rect of each items.  
Inside this method, [FitWindowRectsInBounds](https://source.chromium.org/chromium/chromium/src/+/main:ash/wm/overview/overview_grid.cc;l=2623;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090) is called to calculated the rect by dividing and offsetting the items.