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

Unified Diff: apps/shell_window_geometry_cache.cc

Issue 17378003: [WIN]Save work area of window and adjust bounds to ensure it fit on screen before show. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
Index: apps/shell_window_geometry_cache.cc
diff --git a/apps/shell_window_geometry_cache.cc b/apps/shell_window_geometry_cache.cc
index f72dfcb8009df90ba40f8bfd42ce145f7f6f01a9..c168ee163d3d432d29031ab82c75a42088202f68 100644
--- a/apps/shell_window_geometry_cache.cc
+++ b/apps/shell_window_geometry_cache.cc
@@ -50,6 +50,7 @@ void ShellWindowGeometryCache::SaveGeometry(
const std::string& extension_id,
const std::string& window_id,
const gfx::Rect& bounds,
+ const gfx::Rect& work_area,
ui::WindowShowState window_state) {
ExtensionData& extension_data = cache_[extension_id];
@@ -57,12 +58,14 @@ void ShellWindowGeometryCache::SaveGeometry(
// already in the cache, just ignore it.
if (extension_data[window_id].bounds == bounds &&
extension_data[window_id].window_state == window_state &&
+ extension_data[window_id].work_area == work_area &&
!ContainsKey(unsynced_extensions_, extension_id))
return;
base::Time now = base::Time::Now();
extension_data[window_id].bounds = bounds;
+ extension_data[window_id].work_area = work_area;
extension_data[window_id].window_state = window_state;
extension_data[window_id].last_change = now;
@@ -107,10 +110,15 @@ void ShellWindowGeometryCache::SyncToStorage() {
eit = extension_data.end(); it != eit; ++it) {
base::DictionaryValue* value = new base::DictionaryValue;
const gfx::Rect& bounds = it->second.bounds;
+ const gfx::Rect& work_area = it->second.work_area;
value->SetInteger("x", bounds.x());
value->SetInteger("y", bounds.y());
value->SetInteger("w", bounds.width());
value->SetInteger("h", bounds.height());
+ value->SetInteger("work_area_x", work_area.x());
+ value->SetInteger("work_area_y", work_area.y());
+ value->SetInteger("work_area_w", work_area.width());
+ value->SetInteger("work_area_h", work_area.height());
value->SetInteger("state", it->second.window_state);
value->SetString(
"ts", base::Int64ToString(it->second.last_change.ToInternalValue()));
@@ -124,6 +132,7 @@ bool ShellWindowGeometryCache::GetGeometry(
const std::string& extension_id,
const std::string& window_id,
gfx::Rect* bounds,
+ gfx::Rect* work_area,
ui::WindowShowState* window_state) {
std::map<std::string, ExtensionData>::const_iterator
@@ -146,6 +155,8 @@ bool ShellWindowGeometryCache::GetGeometry(
if (bounds)
*bounds = window_data->second.bounds;
+ if (work_area)
+ *work_area = window_data->second.work_area;
if (window_state)
*window_state = window_data->second.window_state;
return true;
@@ -212,6 +223,14 @@ void ShellWindowGeometryCache::LoadGeometryFromStorage(
window_data.bounds.set_width(i);
if (stored_window->GetInteger("h", &i))
window_data.bounds.set_height(i);
+ if (stored_window->GetInteger("work_area_x", &i))
+ window_data.work_area.set_x(i);
+ if (stored_window->GetInteger("work_area_y", &i))
+ window_data.work_area.set_y(i);
+ if (stored_window->GetInteger("work_area_w", &i))
+ window_data.work_area.set_width(i);
+ if (stored_window->GetInteger("work_area_h", &i))
+ window_data.work_area.set_height(i);
if (stored_window->GetInteger("state", &i)) {
window_data.window_state =
static_cast<ui::WindowShowState>(i);

Powered by Google App Engine
This is Rietveld 408576698