| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 } | 464 } |
| 465 | 465 |
| 466 DownloadQuery::DownloadVector all_items; | 466 DownloadQuery::DownloadVector all_items; |
| 467 if (query_in.id.get()) { | 467 if (query_in.id.get()) { |
| 468 DownloadItem* item = manager->GetDownload(*query_in.id.get()); | 468 DownloadItem* item = manager->GetDownload(*query_in.id.get()); |
| 469 if (!item && incognito_manager) | 469 if (!item && incognito_manager) |
| 470 item = incognito_manager->GetDownload(*query_in.id.get()); | 470 item = incognito_manager->GetDownload(*query_in.id.get()); |
| 471 if (item) | 471 if (item) |
| 472 all_items.push_back(item); | 472 all_items.push_back(item); |
| 473 } else { | 473 } else { |
| 474 manager->GetAllDownloads(&all_items); | 474 manager->GetAllDownloads(FilePath(FILE_PATH_LITERAL("")), &all_items); |
| 475 if (incognito_manager) | 475 if (incognito_manager) |
| 476 incognito_manager->GetAllDownloads(&all_items); | 476 incognito_manager->GetAllDownloads( |
| 477 FilePath(FILE_PATH_LITERAL("")), &all_items); |
| 477 } | 478 } |
| 478 query_out.AddFilter(base::Bind(&IsNotTemporaryDownloadFilter)); | |
| 479 query_out.Search(all_items.begin(), all_items.end(), results); | 479 query_out.Search(all_items.begin(), all_items.end(), results); |
| 480 } | 480 } |
| 481 | 481 |
| 482 void DispatchEventInternal( | 482 void DispatchEventInternal( |
| 483 Profile* target_profile, | 483 Profile* target_profile, |
| 484 const char* event_name, | 484 const char* event_name, |
| 485 const std::string& json_args, | 485 const std::string& json_args, |
| 486 scoped_ptr<base::ListValue> event_args) { | 486 scoped_ptr<base::ListValue> event_args) { |
| 487 target_profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 487 target_profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 488 event_name, | 488 event_name, |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 if (profile_->HasOffTheRecordProfile() && | 986 if (profile_->HasOffTheRecordProfile() && |
| 987 !profile_->IsOffTheRecord()) { | 987 !profile_->IsOffTheRecord()) { |
| 988 DispatchEventInternal( | 988 DispatchEventInternal( |
| 989 profile_->GetOffTheRecordProfile(), | 989 profile_->GetOffTheRecordProfile(), |
| 990 event_name, | 990 event_name, |
| 991 json_args, | 991 json_args, |
| 992 scoped_ptr<base::ListValue>(args->DeepCopy())); | 992 scoped_ptr<base::ListValue>(args->DeepCopy())); |
| 993 } | 993 } |
| 994 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); | 994 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); |
| 995 } | 995 } |
| OLD | NEW |