| 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 "apps/app_window_geometry_cache.h" | 5 #include "apps/app_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 16 matching lines...) Expand all Loading... |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 namespace apps { | 29 namespace apps { |
| 30 | 30 |
| 31 AppWindowGeometryCache::AppWindowGeometryCache( | 31 AppWindowGeometryCache::AppWindowGeometryCache( |
| 32 Profile* profile, | 32 Profile* profile, |
| 33 extensions::ExtensionPrefs* prefs) | 33 extensions::ExtensionPrefs* prefs) |
| 34 : prefs_(prefs), | 34 : prefs_(prefs), |
| 35 sync_delay_(base::TimeDelta::FromMilliseconds(kSyncTimeoutMilliseconds)) { | 35 sync_delay_(base::TimeDelta::FromMilliseconds(kSyncTimeoutMilliseconds)) { |
| 36 registrar_.Add(this, | 36 registrar_.Add(this, |
| 37 chrome::NOTIFICATION_EXTENSION_LOADED, | 37 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 38 content::Source<Profile>(profile)); | 38 content::Source<Profile>(profile)); |
| 39 registrar_.Add(this, | 39 registrar_.Add(this, |
| 40 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 40 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 41 content::Source<Profile>(profile)); | 41 content::Source<Profile>(profile)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 AppWindowGeometryCache::~AppWindowGeometryCache() {} | 44 AppWindowGeometryCache::~AppWindowGeometryCache() {} |
| 45 | 45 |
| 46 // static | 46 // static |
| 47 AppWindowGeometryCache* AppWindowGeometryCache::Get( | 47 AppWindowGeometryCache* AppWindowGeometryCache::Get( |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 AppWindowGeometryCache::WindowData::WindowData() | 191 AppWindowGeometryCache::WindowData::WindowData() |
| 192 : window_state(ui::SHOW_STATE_DEFAULT) {} | 192 : window_state(ui::SHOW_STATE_DEFAULT) {} |
| 193 | 193 |
| 194 AppWindowGeometryCache::WindowData::~WindowData() {} | 194 AppWindowGeometryCache::WindowData::~WindowData() {} |
| 195 | 195 |
| 196 void AppWindowGeometryCache::Observe( | 196 void AppWindowGeometryCache::Observe( |
| 197 int type, | 197 int type, |
| 198 const content::NotificationSource& source, | 198 const content::NotificationSource& source, |
| 199 const content::NotificationDetails& details) { | 199 const content::NotificationDetails& details) { |
| 200 switch (type) { | 200 switch (type) { |
| 201 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 201 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 202 std::string extension_id = | 202 std::string extension_id = |
| 203 content::Details<const extensions::Extension>(details).ptr()->id(); | 203 content::Details<const extensions::Extension>(details).ptr()->id(); |
| 204 LoadGeometryFromStorage(extension_id); | 204 LoadGeometryFromStorage(extension_id); |
| 205 break; | 205 break; |
| 206 } | 206 } |
| 207 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { | 207 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 208 std::string extension_id = | 208 std::string extension_id = |
| 209 content::Details<const extensions::UnloadedExtensionInfo>(details) | 209 content::Details<const extensions::UnloadedExtensionInfo>(details) |
| 210 .ptr() | 210 .ptr() |
| 211 ->extension->id(); | 211 ->extension->id(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 void AppWindowGeometryCache::AddObserver(Observer* observer) { | 327 void AppWindowGeometryCache::AddObserver(Observer* observer) { |
| 328 observers_.AddObserver(observer); | 328 observers_.AddObserver(observer); |
| 329 } | 329 } |
| 330 | 330 |
| 331 void AppWindowGeometryCache::RemoveObserver(Observer* observer) { | 331 void AppWindowGeometryCache::RemoveObserver(Observer* observer) { |
| 332 observers_.RemoveObserver(observer); | 332 observers_.RemoveObserver(observer); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace apps | 335 } // namespace apps |
| OLD | NEW |