| 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 | 61 |
| 62 base::Time now = base::Time::Now(); | 62 base::Time now = base::Time::Now(); |
| 63 | 63 |
| 64 extension_data[window_id].bounds = bounds; | 64 extension_data[window_id].bounds = bounds; |
| 65 extension_data[window_id].screen_bounds = screen_bounds; | 65 extension_data[window_id].screen_bounds = screen_bounds; |
| 66 extension_data[window_id].window_state = window_state; | 66 extension_data[window_id].window_state = window_state; |
| 67 extension_data[window_id].last_change = now; | 67 extension_data[window_id].last_change = now; |
| 68 | 68 |
| 69 if (extension_data.size() > kMaxCachedWindows) { | 69 if (extension_data.size() > kMaxCachedWindows) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 void AppWindowGeometryCache::AddObserver(Observer* observer) { | 301 void AppWindowGeometryCache::AddObserver(Observer* observer) { |
| 302 observers_.AddObserver(observer); | 302 observers_.AddObserver(observer); |
| 303 } | 303 } |
| 304 | 304 |
| 305 void AppWindowGeometryCache::RemoveObserver(Observer* observer) { | 305 void AppWindowGeometryCache::RemoveObserver(Observer* observer) { |
| 306 observers_.RemoveObserver(observer); | 306 observers_.RemoveObserver(observer); |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace extensions | 309 } // namespace extensions |
| OLD | NEW |