| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cctype> | 8 #include <cctype> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 SendResponse(true); | 1510 SendResponse(true); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 ExtensionDownloadsEventRouter::ExtensionDownloadsEventRouter( | 1513 ExtensionDownloadsEventRouter::ExtensionDownloadsEventRouter( |
| 1514 Profile* profile, | 1514 Profile* profile, |
| 1515 DownloadManager* manager) | 1515 DownloadManager* manager) |
| 1516 : profile_(profile), | 1516 : profile_(profile), |
| 1517 notifier_(manager, this) { | 1517 notifier_(manager, this) { |
| 1518 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1518 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1519 DCHECK(profile_); | 1519 DCHECK(profile_); |
| 1520 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 1520 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 1521 content::Source<Profile>(profile_)); | 1521 content::Source<Profile>(profile_)); |
| 1522 extensions::EventRouter* router = extensions::ExtensionSystem::Get(profile_)-> | 1522 extensions::EventRouter* router = extensions::ExtensionSystem::Get(profile_)-> |
| 1523 event_router(); | 1523 event_router(); |
| 1524 if (router) | 1524 if (router) |
| 1525 router->RegisterObserver(this, | 1525 router->RegisterObserver(this, |
| 1526 downloads::OnDeterminingFilename::kEventName); | 1526 downloads::OnDeterminingFilename::kEventName); |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 ExtensionDownloadsEventRouter::~ExtensionDownloadsEventRouter() { | 1529 ExtensionDownloadsEventRouter::~ExtensionDownloadsEventRouter() { |
| 1530 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1530 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 content_source, | 1887 content_source, |
| 1888 content::Details<std::string>(&json_args)); | 1888 content::Details<std::string>(&json_args)); |
| 1889 } | 1889 } |
| 1890 | 1890 |
| 1891 void ExtensionDownloadsEventRouter::Observe( | 1891 void ExtensionDownloadsEventRouter::Observe( |
| 1892 int type, | 1892 int type, |
| 1893 const content::NotificationSource& source, | 1893 const content::NotificationSource& source, |
| 1894 const content::NotificationDetails& details) { | 1894 const content::NotificationDetails& details) { |
| 1895 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1895 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1896 switch (type) { | 1896 switch (type) { |
| 1897 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 1897 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 1898 extensions::UnloadedExtensionInfo* unloaded = | 1898 extensions::UnloadedExtensionInfo* unloaded = |
| 1899 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); | 1899 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); |
| 1900 std::set<const extensions::Extension*>::iterator iter = | 1900 std::set<const extensions::Extension*>::iterator iter = |
| 1901 shelf_disabling_extensions_.find(unloaded->extension); | 1901 shelf_disabling_extensions_.find(unloaded->extension); |
| 1902 if (iter != shelf_disabling_extensions_.end()) | 1902 if (iter != shelf_disabling_extensions_.end()) |
| 1903 shelf_disabling_extensions_.erase(iter); | 1903 shelf_disabling_extensions_.erase(iter); |
| 1904 break; | 1904 break; |
| 1905 } | 1905 } |
| 1906 } | 1906 } |
| 1907 } | 1907 } |
| OLD | NEW |