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 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 ¬ification_source); | 1903 ¬ification_source); |
1904 content::NotificationService::current()->Notify( | 1904 content::NotificationService::current()->Notify( |
1905 extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, | 1905 extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, |
1906 content_source, | 1906 content_source, |
1907 content::Details<std::string>(&json_args)); | 1907 content::Details<std::string>(&json_args)); |
1908 } | 1908 } |
1909 | 1909 |
1910 void ExtensionDownloadsEventRouter::OnExtensionUnloaded( | 1910 void ExtensionDownloadsEventRouter::OnExtensionUnloaded( |
1911 content::BrowserContext* browser_context, | 1911 content::BrowserContext* browser_context, |
1912 const Extension* extension, | 1912 const Extension* extension, |
1913 UnloadedExtensionInfo::Reason reason) { | 1913 UnloadedExtensionReason reason) { |
1914 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1914 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1915 std::set<const Extension*>::iterator iter = | 1915 std::set<const Extension*>::iterator iter = |
1916 shelf_disabling_extensions_.find(extension); | 1916 shelf_disabling_extensions_.find(extension); |
1917 if (iter != shelf_disabling_extensions_.end()) | 1917 if (iter != shelf_disabling_extensions_.end()) |
1918 shelf_disabling_extensions_.erase(iter); | 1918 shelf_disabling_extensions_.erase(iter); |
1919 } | 1919 } |
1920 | 1920 |
1921 void ExtensionDownloadsEventRouter::CheckForHistoryFilesRemoval() { | 1921 void ExtensionDownloadsEventRouter::CheckForHistoryFilesRemoval() { |
1922 static const int kFileExistenceRateLimitSeconds = 10; | 1922 static const int kFileExistenceRateLimitSeconds = 10; |
1923 DownloadManager* manager = notifier_.GetManager(); | 1923 DownloadManager* manager = notifier_.GetManager(); |
1924 if (!manager) | 1924 if (!manager) |
1925 return; | 1925 return; |
1926 base::Time now(base::Time::Now()); | 1926 base::Time now(base::Time::Now()); |
1927 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); | 1927 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); |
1928 if (delta <= kFileExistenceRateLimitSeconds) | 1928 if (delta <= kFileExistenceRateLimitSeconds) |
1929 return; | 1929 return; |
1930 last_checked_removal_ = now; | 1930 last_checked_removal_ = now; |
1931 manager->CheckForHistoryFilesRemoval(); | 1931 manager->CheckForHistoryFilesRemoval(); |
1932 } | 1932 } |
1933 | 1933 |
1934 } // namespace extensions | 1934 } // namespace extensions |
OLD | NEW |