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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
22 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
23 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
26 #include "base/task/cancelable_task_tracker.h" | 26 #include "base/task/cancelable_task_tracker.h" |
27 #include "base/values.h" | 27 #include "base/values.h" |
28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/chrome_notification_types.h" | |
30 #include "chrome/browser/download/download_danger_prompt.h" | 29 #include "chrome/browser/download/download_danger_prompt.h" |
31 #include "chrome/browser/download/download_file_icon_extractor.h" | 30 #include "chrome/browser/download/download_file_icon_extractor.h" |
32 #include "chrome/browser/download/download_prefs.h" | 31 #include "chrome/browser/download/download_prefs.h" |
33 #include "chrome/browser/download/download_query.h" | 32 #include "chrome/browser/download/download_query.h" |
34 #include "chrome/browser/download/download_service.h" | 33 #include "chrome/browser/download/download_service.h" |
35 #include "chrome/browser/download/download_service_factory.h" | 34 #include "chrome/browser/download/download_service_factory.h" |
36 #include "chrome/browser/download/download_shelf.h" | 35 #include "chrome/browser/download/download_shelf.h" |
37 #include "chrome/browser/download/download_stats.h" | 36 #include "chrome/browser/download/download_stats.h" |
38 #include "chrome/browser/download/drag_download_item.h" | 37 #include "chrome/browser/download/drag_download_item.h" |
39 #include "chrome/browser/extensions/extension_warning_service.h" | 38 #include "chrome/browser/extensions/extension_warning_service.h" |
(...skipping 17 matching lines...) Expand all Loading... |
57 #include "content/public/browser/render_process_host.h" | 56 #include "content/public/browser/render_process_host.h" |
58 #include "content/public/browser/render_view_host.h" | 57 #include "content/public/browser/render_view_host.h" |
59 #include "content/public/browser/render_widget_host_view.h" | 58 #include "content/public/browser/render_widget_host_view.h" |
60 #include "content/public/browser/resource_context.h" | 59 #include "content/public/browser/resource_context.h" |
61 #include "content/public/browser/resource_dispatcher_host.h" | 60 #include "content/public/browser/resource_dispatcher_host.h" |
62 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
63 #include "extensions/browser/event_router.h" | 62 #include "extensions/browser/event_router.h" |
64 #include "extensions/browser/extension_function_dispatcher.h" | 63 #include "extensions/browser/extension_function_dispatcher.h" |
65 #include "extensions/browser/extension_prefs.h" | 64 #include "extensions/browser/extension_prefs.h" |
66 #include "extensions/browser/extension_registry.h" | 65 #include "extensions/browser/extension_registry.h" |
| 66 #include "extensions/browser/notification_types.h" |
67 #include "extensions/common/permissions/permissions_data.h" | 67 #include "extensions/common/permissions/permissions_data.h" |
68 #include "net/base/filename_util.h" | 68 #include "net/base/filename_util.h" |
69 #include "net/base/load_flags.h" | 69 #include "net/base/load_flags.h" |
70 #include "net/http/http_util.h" | 70 #include "net/http/http_util.h" |
71 #include "third_party/skia/include/core/SkBitmap.h" | 71 #include "third_party/skia/include/core/SkBitmap.h" |
72 #include "ui/base/webui/web_ui_util.h" | 72 #include "ui/base/webui/web_ui_util.h" |
73 #include "ui/gfx/image/image_skia.h" | 73 #include "ui/gfx/image/image_skia.h" |
74 | 74 |
75 using content::BrowserContext; | 75 using content::BrowserContext; |
76 using content::BrowserThread; | 76 using content::BrowserThread; |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 event->restrict_to_browser_context = | 1904 event->restrict_to_browser_context = |
1905 (include_incognito && !profile_->IsOffTheRecord()) ? NULL : profile_; | 1905 (include_incognito && !profile_->IsOffTheRecord()) ? NULL : profile_; |
1906 event->will_dispatch_callback = will_dispatch_callback; | 1906 event->will_dispatch_callback = will_dispatch_callback; |
1907 EventRouter::Get(profile_)->BroadcastEvent(event.Pass()); | 1907 EventRouter::Get(profile_)->BroadcastEvent(event.Pass()); |
1908 DownloadsNotificationSource notification_source; | 1908 DownloadsNotificationSource notification_source; |
1909 notification_source.event_name = event_name; | 1909 notification_source.event_name = event_name; |
1910 notification_source.profile = profile_; | 1910 notification_source.profile = profile_; |
1911 content::Source<DownloadsNotificationSource> content_source( | 1911 content::Source<DownloadsNotificationSource> content_source( |
1912 ¬ification_source); | 1912 ¬ification_source); |
1913 content::NotificationService::current()->Notify( | 1913 content::NotificationService::current()->Notify( |
1914 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, | 1914 extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, |
1915 content_source, | 1915 content_source, |
1916 content::Details<std::string>(&json_args)); | 1916 content::Details<std::string>(&json_args)); |
1917 } | 1917 } |
1918 | 1918 |
1919 void ExtensionDownloadsEventRouter::OnExtensionUnloaded( | 1919 void ExtensionDownloadsEventRouter::OnExtensionUnloaded( |
1920 content::BrowserContext* browser_context, | 1920 content::BrowserContext* browser_context, |
1921 const Extension* extension, | 1921 const Extension* extension, |
1922 UnloadedExtensionInfo::Reason reason) { | 1922 UnloadedExtensionInfo::Reason reason) { |
1923 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1923 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1924 std::set<const Extension*>::iterator iter = | 1924 std::set<const Extension*>::iterator iter = |
1925 shelf_disabling_extensions_.find(extension); | 1925 shelf_disabling_extensions_.find(extension); |
1926 if (iter != shelf_disabling_extensions_.end()) | 1926 if (iter != shelf_disabling_extensions_.end()) |
1927 shelf_disabling_extensions_.erase(iter); | 1927 shelf_disabling_extensions_.erase(iter); |
1928 } | 1928 } |
1929 | 1929 |
1930 } // namespace extensions | 1930 } // namespace extensions |
OLD | NEW |