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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10914158: Revert 155351 - Make DownloadManager::GetAllDownloads return all downloads regardless of state, per… (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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 IPC::Message* reply_message) { 2636 IPC::Message* reply_message) {
2637 AutomationJSONReply reply(this, reply_message); 2637 AutomationJSONReply reply(this, reply_message);
2638 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 2638 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
2639 ListValue* list_of_downloads = new ListValue; 2639 ListValue* list_of_downloads = new ListValue;
2640 2640
2641 DownloadService* download_service( 2641 DownloadService* download_service(
2642 DownloadServiceFactory::GetForProfile(browser->profile())); 2642 DownloadServiceFactory::GetForProfile(browser->profile()));
2643 2643
2644 if (download_service->HasCreatedDownloadManager()) { 2644 if (download_service->HasCreatedDownloadManager()) {
2645 std::vector<DownloadItem*> downloads; 2645 std::vector<DownloadItem*> downloads;
2646 BrowserContext::GetDownloadManager(browser->profile())->GetAllDownloads( 2646 BrowserContext::GetDownloadManager(browser->profile())->
2647 &downloads); 2647 GetAllDownloads(FilePath(), &downloads);
2648 2648
2649 for (std::vector<DownloadItem*>::iterator it = downloads.begin(); 2649 for (std::vector<DownloadItem*>::iterator it = downloads.begin();
2650 it != downloads.end(); 2650 it != downloads.end();
2651 it++) { // Fill info about each download item. 2651 it++) { // Fill info about each download item.
2652 list_of_downloads->Append(GetDictionaryFromDownloadItem( 2652 list_of_downloads->Append(GetDictionaryFromDownloadItem(
2653 *it, browser->profile()->IsOffTheRecord())); 2653 *it, browser->profile()->IsOffTheRecord()));
2654 } 2654 }
2655 } 2655 }
2656 return_value->Set("downloads", list_of_downloads); 2656 return_value->Set("downloads", list_of_downloads);
2657 reply.SendSuccess(return_value.get()); 2657 reply.SendSuccess(return_value.get());
(...skipping 23 matching lines...) Expand all
2681 new AllDownloadsCompleteObserver( 2681 new AllDownloadsCompleteObserver(
2682 this, reply_message, 2682 this, reply_message,
2683 BrowserContext::GetDownloadManager(browser->profile()), 2683 BrowserContext::GetDownloadManager(browser->profile()),
2684 pre_download_ids); 2684 pre_download_ids);
2685 } 2685 }
2686 2686
2687 namespace { 2687 namespace {
2688 2688
2689 DownloadItem* GetDownloadItemFromId(int id, DownloadManager* download_manager) { 2689 DownloadItem* GetDownloadItemFromId(int id, DownloadManager* download_manager) {
2690 std::vector<DownloadItem*> downloads; 2690 std::vector<DownloadItem*> downloads;
2691 download_manager->GetAllDownloads(&downloads); 2691 download_manager->GetAllDownloads(FilePath(), &downloads);
2692 DownloadItem* selected_item = NULL; 2692 DownloadItem* selected_item = NULL;
2693 2693
2694 for (std::vector<DownloadItem*>::iterator it = downloads.begin(); 2694 for (std::vector<DownloadItem*>::iterator it = downloads.begin();
2695 it != downloads.end(); 2695 it != downloads.end();
2696 it++) { 2696 it++) {
2697 DownloadItem* curr_item = *it; 2697 DownloadItem* curr_item = *it;
2698 if (curr_item->GetId() == id) { 2698 if (curr_item->GetId() == id) {
2699 selected_item = curr_item; 2699 selected_item = curr_item;
2700 break; 2700 break;
2701 } 2701 }
(...skipping 3739 matching lines...) Expand 10 before | Expand all | Expand 10 after
6441 void TestingAutomationProvider::OnRemoveProvider() { 6441 void TestingAutomationProvider::OnRemoveProvider() {
6442 if (g_browser_process) 6442 if (g_browser_process)
6443 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6443 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6444 } 6444 }
6445 6445
6446 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 6446 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
6447 WebContents* tab) { 6447 WebContents* tab) {
6448 if (chrome::GetActiveWebContents(browser) != tab) 6448 if (chrome::GetActiveWebContents(browser) != tab)
6449 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); 6449 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true);
6450 } 6450 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698