| Index: chrome/browser/automation/testing_automation_provider.cc
|
| diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
|
| index deb355f2346627fdb8161c9d487d4e1cf68d7397..d40681d5793c00602a8feff92a68d8676360ed00 100644
|
| --- a/chrome/browser/automation/testing_automation_provider.cc
|
| +++ b/chrome/browser/automation/testing_automation_provider.cc
|
| @@ -2706,11 +2706,13 @@ void TestingAutomationProvider::GetDownloadsInfo(Browser* browser,
|
| std::vector<DownloadItem*> downloads;
|
| BrowserContext::GetDownloadManager(browser->profile())->
|
| GetAllDownloads(FilePath(), &downloads);
|
| + bool incognito = browser->profile()->HasOffTheRecordProfile() &&
|
| + (browser->profile() == browser->profile()->GetOffTheRecordProfile());
|
|
|
| for (std::vector<DownloadItem*>::iterator it = downloads.begin();
|
| it != downloads.end();
|
| it++) { // Fill info about each download item.
|
| - list_of_downloads->Append(GetDictionaryFromDownloadItem(*it));
|
| + list_of_downloads->Append(GetDictionaryFromDownloadItem(*it, incognito));
|
| }
|
| }
|
| return_value->Set("downloads", list_of_downloads);
|
| @@ -2802,10 +2804,12 @@ void TestingAutomationProvider::PerformActionOnDownload(
|
| .SendError("Selected DownloadItem is not in progress.");
|
| }
|
|
|
| + bool incognito = browser->profile()->HasOffTheRecordProfile() &&
|
| + (browser->profile() == browser->profile()->GetOffTheRecordProfile());
|
| if (action == "open") {
|
| selected_item->AddObserver(
|
| new AutomationProviderDownloadUpdatedObserver(
|
| - this, reply_message, true));
|
| + this, reply_message, true, incognito));
|
| selected_item->OpenDownload();
|
| } else if (action == "toggle_open_files_like_this") {
|
| DownloadPrefs* prefs =
|
| @@ -2828,16 +2832,16 @@ void TestingAutomationProvider::PerformActionOnDownload(
|
| selected_item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
|
| } else if (action == "save_dangerous_download") {
|
| selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver(
|
| - this, reply_message, false));
|
| + this, reply_message, false, incognito));
|
| selected_item->DangerousDownloadValidated();
|
| } else if (action == "toggle_pause") {
|
| selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver(
|
| - this, reply_message, false));
|
| + this, reply_message, false, incognito));
|
| // This will still return if download has already completed.
|
| selected_item->TogglePause();
|
| } else if (action == "cancel") {
|
| selected_item->AddObserver(new AutomationProviderDownloadUpdatedObserver(
|
| - this, reply_message, false));
|
| + this, reply_message, false, incognito));
|
| selected_item->Cancel(true);
|
| } else {
|
| AutomationJSONReply(this, reply_message)
|
|
|