OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/downloads/downloads_api.h" | 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 ¬ification_source); | 1901 ¬ification_source); |
1902 content::NotificationService::current()->Notify( | 1902 content::NotificationService::current()->Notify( |
1903 extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, | 1903 extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, |
1904 content_source, | 1904 content_source, |
1905 content::Details<std::string>(&json_args)); | 1905 content::Details<std::string>(&json_args)); |
1906 } | 1906 } |
1907 | 1907 |
1908 void ExtensionDownloadsEventRouter::OnExtensionUnloaded( | 1908 void ExtensionDownloadsEventRouter::OnExtensionUnloaded( |
1909 content::BrowserContext* browser_context, | 1909 content::BrowserContext* browser_context, |
1910 const Extension* extension, | 1910 const Extension* extension, |
1911 UnloadedExtensionInfo::Reason reason) { | 1911 UnloadedExtensionReason reason) { |
1912 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1912 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1913 std::set<const Extension*>::iterator iter = | 1913 std::set<const Extension*>::iterator iter = |
1914 shelf_disabling_extensions_.find(extension); | 1914 shelf_disabling_extensions_.find(extension); |
1915 if (iter != shelf_disabling_extensions_.end()) | 1915 if (iter != shelf_disabling_extensions_.end()) |
1916 shelf_disabling_extensions_.erase(iter); | 1916 shelf_disabling_extensions_.erase(iter); |
1917 } | 1917 } |
1918 | 1918 |
1919 void ExtensionDownloadsEventRouter::CheckForHistoryFilesRemoval() { | 1919 void ExtensionDownloadsEventRouter::CheckForHistoryFilesRemoval() { |
1920 static const int kFileExistenceRateLimitSeconds = 10; | 1920 static const int kFileExistenceRateLimitSeconds = 10; |
1921 DownloadManager* manager = notifier_.GetManager(); | 1921 DownloadManager* manager = notifier_.GetManager(); |
1922 if (!manager) | 1922 if (!manager) |
1923 return; | 1923 return; |
1924 base::Time now(base::Time::Now()); | 1924 base::Time now(base::Time::Now()); |
1925 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); | 1925 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); |
1926 if (delta <= kFileExistenceRateLimitSeconds) | 1926 if (delta <= kFileExistenceRateLimitSeconds) |
1927 return; | 1927 return; |
1928 last_checked_removal_ = now; | 1928 last_checked_removal_ = now; |
1929 manager->CheckForHistoryFilesRemoval(); | 1929 manager->CheckForHistoryFilesRemoval(); |
1930 } | 1930 } |
1931 | 1931 |
1932 } // namespace extensions | 1932 } // namespace extensions |
OLD | NEW |