Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/app_window/app_window_geometry_cache.h" | 5 #include "extensions/browser/app_window/app_window_geometry_cache.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 const gfx::Rect& bounds, | 49 const gfx::Rect& bounds, |
| 50 const gfx::Rect& screen_bounds, | 50 const gfx::Rect& screen_bounds, |
| 51 ui::WindowShowState window_state) { | 51 ui::WindowShowState window_state) { |
| 52 ExtensionData& extension_data = cache_[extension_id]; | 52 ExtensionData& extension_data = cache_[extension_id]; |
| 53 | 53 |
| 54 // If we don't have any unsynced changes and this is a duplicate of what's | 54 // If we don't have any unsynced changes and this is a duplicate of what's |
| 55 // already in the cache, just ignore it. | 55 // already in the cache, just ignore it. |
| 56 if (extension_data[window_id].bounds == bounds && | 56 if (extension_data[window_id].bounds == bounds && |
| 57 extension_data[window_id].window_state == window_state && | 57 extension_data[window_id].window_state == window_state && |
| 58 extension_data[window_id].screen_bounds == screen_bounds && | 58 extension_data[window_id].screen_bounds == screen_bounds && |
| 59 !ContainsKey(unsynced_extensions_, extension_id)) | 59 !base::ContainsKey(unsynced_extensions_, extension_id)) { |
| 60 return; | 60 return; |
| 61 } | |
|
Finnur
2016/08/11 10:19:47
ditto here.
Sami
2016/08/12 12:25:03
Done.
| |
| 61 | 62 |
| 62 base::Time now = base::Time::Now(); | 63 base::Time now = base::Time::Now(); |
| 63 | 64 |
| 64 extension_data[window_id].bounds = bounds; | 65 extension_data[window_id].bounds = bounds; |
| 65 extension_data[window_id].screen_bounds = screen_bounds; | 66 extension_data[window_id].screen_bounds = screen_bounds; |
| 66 extension_data[window_id].window_state = window_state; | 67 extension_data[window_id].window_state = window_state; |
| 67 extension_data[window_id].last_change = now; | 68 extension_data[window_id].last_change = now; |
| 68 | 69 |
| 69 if (extension_data.size() > kMaxCachedWindows) { | 70 if (extension_data.size() > kMaxCachedWindows) { |
| 70 ExtensionData::iterator oldest = extension_data.end(); | 71 ExtensionData::iterator oldest = extension_data.end(); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 | 301 |
| 301 void AppWindowGeometryCache::AddObserver(Observer* observer) { | 302 void AppWindowGeometryCache::AddObserver(Observer* observer) { |
| 302 observers_.AddObserver(observer); | 303 observers_.AddObserver(observer); |
| 303 } | 304 } |
| 304 | 305 |
| 305 void AppWindowGeometryCache::RemoveObserver(Observer* observer) { | 306 void AppWindowGeometryCache::RemoveObserver(Observer* observer) { |
| 306 observers_.RemoveObserver(observer); | 307 observers_.RemoveObserver(observer); |
| 307 } | 308 } |
| 308 | 309 |
| 309 } // namespace extensions | 310 } // namespace extensions |
| OLD | NEW |