Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 10913015: Reland DownloadManager::GetAllDownloads actually does now (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(FilePath(FILE_PATH_LITERAL("")), &all_items); 474 manager->GetAllDownloads(&all_items);
475 if (incognito_manager) 475 if (incognito_manager)
476 incognito_manager->GetAllDownloads( 476 incognito_manager->GetAllDownloads(&all_items);
477 FilePath(FILE_PATH_LITERAL("")), &all_items);
478 } 477 }
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698