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

Side by Side 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: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "apps/shell_window_geometry_cache.h" 5 #include "apps/shell_window_geometry_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 extension_data_it = cache_.find(extension_id); 146 extension_data_it = cache_.find(extension_id);
147 DCHECK(extension_data_it != cache_.end()); 147 DCHECK(extension_data_it != cache_.end());
148 } 148 }
149 149
150 ExtensionData::const_iterator window_data = extension_data_it->second.find( 150 ExtensionData::const_iterator window_data = extension_data_it->second.find(
151 window_id); 151 window_id);
152 152
153 if (window_data == extension_data_it->second.end()) 153 if (window_data == extension_data_it->second.end())
154 return false; 154 return false;
155 155
156 // Check for and do not return corrupt data.
157 if ((bounds && window_data->second.bounds.IsEmpty()) ||
158 (screen_bounds && window_data->second.screen_bounds.IsEmpty()) ||
159 (window_state &&
160 window_data->second.window_state == ui::SHOW_STATE_DEFAULT))
161 return false;
162
Ken Rockot(use gerrit already) 2013/08/01 01:04:49 nit: It might be nicer to use a named WindowData&
156 if (bounds) 163 if (bounds)
157 *bounds = window_data->second.bounds; 164 *bounds = window_data->second.bounds;
158 if (screen_bounds) 165 if (screen_bounds)
159 *screen_bounds = window_data->second.screen_bounds; 166 *screen_bounds = window_data->second.screen_bounds;
160 if (window_state) 167 if (window_state)
161 *window_state = window_data->second.window_state; 168 *window_state = window_data->second.window_state;
162 return true; 169 return true;
163 } 170 }
164 171
165 void ShellWindowGeometryCache::Shutdown() { 172 void ShellWindowGeometryCache::Shutdown() {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 return false; 306 return false;
300 } 307 }
301 308
302 content::BrowserContext* 309 content::BrowserContext*
303 ShellWindowGeometryCache::Factory::GetBrowserContextToUse( 310 ShellWindowGeometryCache::Factory::GetBrowserContextToUse(
304 content::BrowserContext* context) const { 311 content::BrowserContext* context) const {
305 return chrome::GetBrowserContextRedirectedInIncognito(context); 312 return chrome::GetBrowserContextRedirectedInIncognito(context);
306 } 313 }
307 314
308 } // namespace apps 315 } // namespace apps
OLDNEW
« 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