| 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 "components/drive/drive_app_registry.h" | 5 #include "components/drive/drive_app_registry.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 app.create_url(), | 182 app.create_url(), |
| 183 app.is_removable()); | 183 app.is_removable()); |
| 184 | 184 |
| 185 // TODO(kinaba): consider taking primary/secondary distinction into account. | 185 // TODO(kinaba): consider taking primary/secondary distinction into account. |
| 186 AddAppSelectorList(app.primary_mimetypes(), id, &mimetype_map_); | 186 AddAppSelectorList(app.primary_mimetypes(), id, &mimetype_map_); |
| 187 AddAppSelectorList(app.secondary_mimetypes(), id, &mimetype_map_); | 187 AddAppSelectorList(app.secondary_mimetypes(), id, &mimetype_map_); |
| 188 AddAppSelectorList(app.primary_file_extensions(), id, &extension_map_); | 188 AddAppSelectorList(app.primary_file_extensions(), id, &extension_map_); |
| 189 AddAppSelectorList(app.secondary_file_extensions(), id, &extension_map_); | 189 AddAppSelectorList(app.secondary_file_extensions(), id, &extension_map_); |
| 190 } | 190 } |
| 191 | 191 |
| 192 FOR_EACH_OBSERVER(DriveAppRegistryObserver, | 192 for (auto& observer : observers_) |
| 193 observers_, | 193 observer.OnDriveAppRegistryUpdated(); |
| 194 OnDriveAppRegistryUpdated()); | |
| 195 } | 194 } |
| 196 | 195 |
| 197 void DriveAppRegistry::AddObserver(DriveAppRegistryObserver* observer) { | 196 void DriveAppRegistry::AddObserver(DriveAppRegistryObserver* observer) { |
| 198 observers_.AddObserver(observer); | 197 observers_.AddObserver(observer); |
| 199 } | 198 } |
| 200 | 199 |
| 201 void DriveAppRegistry::RemoveObserver(DriveAppRegistryObserver* observer) { | 200 void DriveAppRegistry::RemoveObserver(DriveAppRegistryObserver* observer) { |
| 202 observers_.RemoveObserver(observer); | 201 observers_.RemoveObserver(observer); |
| 203 } | 202 } |
| 204 | 203 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 240 |
| 242 // Go forward while the size is larger or equal to preferred_size. | 241 // Go forward while the size is larger or equal to preferred_size. |
| 243 size_t i = 1; | 242 size_t i = 1; |
| 244 while (i < sorted_icons.size() && sorted_icons[i].first >= preferred_size) | 243 while (i < sorted_icons.size() && sorted_icons[i].first >= preferred_size) |
| 245 ++i; | 244 ++i; |
| 246 return sorted_icons[i - 1].second; | 245 return sorted_icons[i - 1].second; |
| 247 } | 246 } |
| 248 | 247 |
| 249 } // namespace util | 248 } // namespace util |
| 250 } // namespace drive | 249 } // namespace drive |
| OLD | NEW |