| 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 "chrome/browser/media_galleries/gallery_watch_manager.h" | 5 #include "chrome/browser/media_galleries/gallery_watch_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 | 10 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 bool GalleryWatchManager::WatchOwner::operator<(const WatchOwner& other) const { | 161 bool GalleryWatchManager::WatchOwner::operator<(const WatchOwner& other) const { |
| 162 return std::tie(browser_context, extension_id, gallery_id) < | 162 return std::tie(browser_context, extension_id, gallery_id) < |
| 163 std::tie(other.browser_context, other.extension_id, other.gallery_id); | 163 std::tie(other.browser_context, other.extension_id, other.gallery_id); |
| 164 } | 164 } |
| 165 | 165 |
| 166 GalleryWatchManager::NotificationInfo::NotificationInfo() | 166 GalleryWatchManager::NotificationInfo::NotificationInfo() |
| 167 : delayed_notification_pending(false) { | 167 : delayed_notification_pending(false) { |
| 168 } | 168 } |
| 169 | 169 |
| 170 GalleryWatchManager::NotificationInfo::NotificationInfo( |
| 171 const NotificationInfo& other) = default; |
| 172 |
| 170 GalleryWatchManager::NotificationInfo::~NotificationInfo() { | 173 GalleryWatchManager::NotificationInfo::~NotificationInfo() { |
| 171 } | 174 } |
| 172 | 175 |
| 173 GalleryWatchManager::GalleryWatchManager() | 176 GalleryWatchManager::GalleryWatchManager() |
| 174 : storage_monitor_observed_(false), weak_factory_(this) { | 177 : storage_monitor_observed_(false), weak_factory_(this) { |
| 175 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 178 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 176 watch_manager_.reset(new FileWatchManager(base::Bind( | 179 watch_manager_.reset(new FileWatchManager(base::Bind( |
| 177 &GalleryWatchManager::OnFilePathChanged, weak_factory_.GetWeakPtr()))); | 180 &GalleryWatchManager::OnFilePathChanged, weak_factory_.GetWeakPtr()))); |
| 178 } | 181 } |
| 179 | 182 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 DeactivateFileWatch(owner, it->second); | 493 DeactivateFileWatch(owner, it->second); |
| 491 // Post increment moves iterator to next element while deleting current. | 494 // Post increment moves iterator to next element while deleting current. |
| 492 watches_.erase(it++); | 495 watches_.erase(it++); |
| 493 observers_[preferences->profile()]->OnGalleryWatchDropped( | 496 observers_[preferences->profile()]->OnGalleryWatchDropped( |
| 494 owner.extension_id, owner.gallery_id); | 497 owner.extension_id, owner.gallery_id); |
| 495 } else { | 498 } else { |
| 496 ++it; | 499 ++it; |
| 497 } | 500 } |
| 498 } | 501 } |
| 499 } | 502 } |
| OLD | NEW |