| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_downloads_api.h" | 5 #include "chrome/browser/download/download_extension_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> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/string16.h" | 19 #include "base/string16.h" |
| 20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 21 #include "base/stringprintf.h" | 21 #include "base/stringprintf.h" |
| 22 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/download/download_extension_api_constants.h" |
| 24 #include "chrome/browser/download/download_service.h" | 25 #include "chrome/browser/download/download_service.h" |
| 25 #include "chrome/browser/download/download_service_factory.h" | 26 #include "chrome/browser/download/download_service_factory.h" |
| 26 #include "chrome/browser/download/download_util.h" | 27 #include "chrome/browser/download/download_util.h" |
| 27 #include "chrome/browser/extensions/extension_downloads_api_constants.h" | |
| 28 #include "chrome/browser/extensions/extension_event_names.h" | 28 #include "chrome/browser/extensions/extension_event_names.h" |
| 29 #include "chrome/browser/extensions/extension_event_router.h" | 29 #include "chrome/browser/extensions/extension_event_router.h" |
| 30 #include "chrome/browser/icon_loader.h" | 30 #include "chrome/browser/icon_loader.h" |
| 31 #include "chrome/browser/icon_manager.h" | 31 #include "chrome/browser/icon_manager.h" |
| 32 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 32 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 33 #include "chrome/browser/ui/browser_list.h" | 33 #include "chrome/browser/ui/browser_list.h" |
| 34 #include "content/browser/download/download_file_manager.h" | 34 #include "content/browser/download/download_file_manager.h" |
| 35 #include "content/browser/download/download_item.h" | 35 #include "content/browser/download/download_item.h" |
| 36 #include "content/browser/download/download_types.h" | 36 #include "content/browser/download/download_types.h" |
| 37 #include "content/browser/download/interrupt_reasons.h" | 37 #include "content/browser/download/interrupt_reasons.h" |
| 38 #include "content/browser/renderer_host/render_process_host.h" | 38 #include "content/browser/renderer_host/render_process_host.h" |
| 39 #include "content/browser/renderer_host/render_view_host.h" | 39 #include "content/browser/renderer_host/render_view_host.h" |
| 40 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 40 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 41 #include "net/http/http_util.h" | 41 #include "net/http/http_util.h" |
| 42 #include "net/url_request/url_request.h" | 42 #include "net/url_request/url_request.h" |
| 43 | 43 |
| 44 using content::BrowserThread; | 44 using content::BrowserThread; |
| 45 | 45 |
| 46 namespace constants = extension_downloads_api_constants; | 46 namespace constants = download_extension_api_constants; |
| 47 | 47 |
| 48 bool DownloadsFunctionInterface::RunImplImpl( | 48 bool DownloadsFunctionInterface::RunImplImpl( |
| 49 DownloadsFunctionInterface* pimpl) { | 49 DownloadsFunctionInterface* pimpl) { |
| 50 CHECK(pimpl); | 50 CHECK(pimpl); |
| 51 if (!pimpl->ParseArgs()) return false; | 51 if (!pimpl->ParseArgs()) return false; |
| 52 UMA_HISTOGRAM_ENUMERATION( | 52 UMA_HISTOGRAM_ENUMERATION( |
| 53 "Download.ApiFunctions", pimpl->function(), DOWNLOADS_FUNCTION_LAST); | 53 "Download.ApiFunctions", pimpl->function(), DOWNLOADS_FUNCTION_LAST); |
| 54 pimpl->RunInternal(); | 54 pimpl->RunInternal(); |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 ListValue args; | 488 ListValue args; |
| 489 args.Append(arg); | 489 args.Append(arg); |
| 490 std::string json_args; | 490 std::string json_args; |
| 491 base::JSONWriter::Write(&args, false, &json_args); | 491 base::JSONWriter::Write(&args, false, &json_args); |
| 492 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 492 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 493 event_name, | 493 event_name, |
| 494 json_args, | 494 json_args, |
| 495 profile_, | 495 profile_, |
| 496 GURL()); | 496 GURL()); |
| 497 } | 497 } |
| OLD | NEW |