| 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 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/common/extensions/api/downloads.h" | 41 #include "chrome/common/extensions/api/downloads.h" |
| 42 #include "content/public/browser/download_interrupt_reasons.h" | 42 #include "content/public/browser/download_interrupt_reasons.h" |
| 43 #include "content/public/browser/download_item.h" | 43 #include "content/public/browser/download_item.h" |
| 44 #include "content/public/browser/download_save_info.h" | 44 #include "content/public/browser/download_save_info.h" |
| 45 #include "content/public/browser/download_url_parameters.h" | 45 #include "content/public/browser/download_url_parameters.h" |
| 46 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/render_process_host.h" | 47 #include "content/public/browser/render_process_host.h" |
| 48 #include "content/public/browser/render_view_host.h" | 48 #include "content/public/browser/render_view_host.h" |
| 49 #include "content/public/browser/resource_context.h" | 49 #include "content/public/browser/resource_context.h" |
| 50 #include "content/public/browser/resource_dispatcher_host.h" | 50 #include "content/public/browser/resource_dispatcher_host.h" |
| 51 #include "content/public/browser/storage_partition.h" |
| 51 #include "net/base/load_flags.h" | 52 #include "net/base/load_flags.h" |
| 52 #include "net/http/http_util.h" | 53 #include "net/http/http_util.h" |
| 53 #include "net/url_request/url_request.h" | 54 #include "net/url_request/url_request.h" |
| 54 | 55 |
| 55 using content::BrowserContext; | 56 using content::BrowserContext; |
| 56 using content::BrowserThread; | 57 using content::BrowserThread; |
| 57 using content::DownloadId; | 58 using content::DownloadId; |
| 58 using content::DownloadItem; | 59 using content::DownloadItem; |
| 59 using content::DownloadManager; | 60 using content::DownloadManager; |
| 60 | 61 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 | 548 |
| 548 Profile* current_profile = profile(); | 549 Profile* current_profile = profile(); |
| 549 if (include_incognito() && profile()->HasOffTheRecordProfile()) | 550 if (include_incognito() && profile()->HasOffTheRecordProfile()) |
| 550 current_profile = profile()->GetOffTheRecordProfile(); | 551 current_profile = profile()->GetOffTheRecordProfile(); |
| 551 | 552 |
| 552 scoped_ptr<content::DownloadUrlParameters> download_params( | 553 scoped_ptr<content::DownloadUrlParameters> download_params( |
| 553 new content::DownloadUrlParameters( | 554 new content::DownloadUrlParameters( |
| 554 download_url, | 555 download_url, |
| 555 render_view_host()->GetProcess()->GetID(), | 556 render_view_host()->GetProcess()->GetID(), |
| 556 render_view_host()->GetRoutingID(), | 557 render_view_host()->GetRoutingID(), |
| 557 current_profile->GetResourceContext(), | 558 BrowserContext::GetDefaultStoragePartition(current_profile)-> |
| 559 GetResourceContext(), |
| 558 save_info)); | 560 save_info)); |
| 559 | 561 |
| 560 if (options.headers.get()) { | 562 if (options.headers.get()) { |
| 561 typedef extensions::api::downloads::HeaderNameValuePair HeaderNameValuePair; | 563 typedef extensions::api::downloads::HeaderNameValuePair HeaderNameValuePair; |
| 562 for (std::vector<linked_ptr<HeaderNameValuePair> >::const_iterator iter = | 564 for (std::vector<linked_ptr<HeaderNameValuePair> >::const_iterator iter = |
| 563 options.headers->begin(); | 565 options.headers->begin(); |
| 564 iter != options.headers->end(); | 566 iter != options.headers->end(); |
| 565 ++iter) { | 567 ++iter) { |
| 566 const HeaderNameValuePair& name_value = **iter; | 568 const HeaderNameValuePair& name_value = **iter; |
| 567 if (!net::HttpUtil::IsSafeHeader(name_value.name)) { | 569 if (!net::HttpUtil::IsSafeHeader(name_value.name)) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 if (profile_->HasOffTheRecordProfile() && | 988 if (profile_->HasOffTheRecordProfile() && |
| 987 !profile_->IsOffTheRecord()) { | 989 !profile_->IsOffTheRecord()) { |
| 988 DispatchEventInternal( | 990 DispatchEventInternal( |
| 989 profile_->GetOffTheRecordProfile(), | 991 profile_->GetOffTheRecordProfile(), |
| 990 event_name, | 992 event_name, |
| 991 json_args, | 993 json_args, |
| 992 scoped_ptr<base::ListValue>(args->DeepCopy())); | 994 scoped_ptr<base::ListValue>(args->DeepCopy())); |
| 993 } | 995 } |
| 994 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); | 996 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); |
| 995 } | 997 } |
| OLD | NEW |