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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Don't send a notification more than once per 3 seconds (chosen arbitrarily). | 26 // Don't send a notification more than once per 3 seconds (chosen arbitrarily). |
27 const int kMinNotificiationDelayInSeconds = 3; | 27 const int kMinNotificiationDelayInSeconds = 3; |
28 | 28 |
29 class ShutdownNotifierFactory | 29 class ShutdownNotifierFactory |
30 : public BrowserContextKeyedServiceShutdownNotifierFactory { | 30 : public BrowserContextKeyedServiceShutdownNotifierFactory { |
31 public: | 31 public: |
32 static ShutdownNotifierFactory* GetInstance() { | 32 static ShutdownNotifierFactory* GetInstance() { |
33 return Singleton<ShutdownNotifierFactory>::get(); | 33 return base::Singleton<ShutdownNotifierFactory>::get(); |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
37 friend struct DefaultSingletonTraits<ShutdownNotifierFactory>; | 37 friend struct base::DefaultSingletonTraits<ShutdownNotifierFactory>; |
38 | 38 |
39 ShutdownNotifierFactory() | 39 ShutdownNotifierFactory() |
40 : BrowserContextKeyedServiceShutdownNotifierFactory( | 40 : BrowserContextKeyedServiceShutdownNotifierFactory( |
41 "GalleryWatchManager") { | 41 "GalleryWatchManager") { |
42 DependsOn(MediaGalleriesPreferencesFactory::GetInstance()); | 42 DependsOn(MediaGalleriesPreferencesFactory::GetInstance()); |
43 } | 43 } |
44 ~ShutdownNotifierFactory() override {} | 44 ~ShutdownNotifierFactory() override {} |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); | 46 DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); |
47 }; | 47 }; |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 DeactivateFileWatch(owner, it->second); | 486 DeactivateFileWatch(owner, it->second); |
487 // Post increment moves iterator to next element while deleting current. | 487 // Post increment moves iterator to next element while deleting current. |
488 watches_.erase(it++); | 488 watches_.erase(it++); |
489 observers_[preferences->profile()]->OnGalleryWatchDropped( | 489 observers_[preferences->profile()]->OnGalleryWatchDropped( |
490 owner.extension_id, owner.gallery_id); | 490 owner.extension_id, owner.gallery_id); |
491 } else { | 491 } else { |
492 ++it; | 492 ++it; |
493 } | 493 } |
494 } | 494 } |
495 } | 495 } |
OLD | NEW |