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

Unified Diff: apps/shell_window_geometry_cache.cc

Issue 21444002: Do not restore corrupt cached app window bounds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser tests Created 7 years, 5 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 | « apps/shell_window_geometry_cache.h ('k') | apps/shell_window_geometry_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/shell_window_geometry_cache.cc
diff --git a/apps/shell_window_geometry_cache.cc b/apps/shell_window_geometry_cache.cc
index caa83acba04ed343dda8cb622f2cbc82f1ad8817..31b44a42477c6c66db045c8bcd598e0626df01c8 100644
--- a/apps/shell_window_geometry_cache.cc
+++ b/apps/shell_window_geometry_cache.cc
@@ -147,18 +147,26 @@ bool ShellWindowGeometryCache::GetGeometry(
DCHECK(extension_data_it != cache_.end());
}
- ExtensionData::const_iterator window_data = extension_data_it->second.find(
+ ExtensionData::const_iterator window_data_it = extension_data_it->second.find(
window_id);
- if (window_data == extension_data_it->second.end())
+ if (window_data_it == extension_data_it->second.end())
+ return false;
+
+ const WindowData& window_data = window_data_it->second;
+
+ // Check for and do not return corrupt data.
+ if ((bounds && window_data.bounds.IsEmpty()) ||
+ (screen_bounds && window_data.screen_bounds.IsEmpty()) ||
+ (window_state && window_data.window_state == ui::SHOW_STATE_DEFAULT))
return false;
if (bounds)
- *bounds = window_data->second.bounds;
+ *bounds = window_data.bounds;
if (screen_bounds)
- *screen_bounds = window_data->second.screen_bounds;
+ *screen_bounds = window_data.screen_bounds;
if (window_state)
- *window_state = window_data->second.window_state;
+ *window_state = window_data.window_state;
return true;
}
« no previous file with comments | « apps/shell_window_geometry_cache.h ('k') | apps/shell_window_geometry_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698