Index: chrome/browser/automation/automation_provider.cc |
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc |
index b2ea3ffbe87eca76a9d9f338c01c1281cd62b9a3..3780b21b2951b061a970c315ef4c193d59e719fa 100644 |
--- a/chrome/browser/automation/automation_provider.cc |
+++ b/chrome/browser/automation/automation_provider.cc |
@@ -39,6 +39,8 @@ |
#include "chrome/browser/browsing_data/browsing_data_remover.h" |
#include "chrome/browser/character_encoding.h" |
#include "chrome/browser/content_settings/host_content_settings_map.h" |
+#include "chrome/browser/download/download_service.h" |
+#include "chrome/browser/download/download_service_factory.h" |
#include "chrome/browser/net/url_request_mock_util.h" |
#include "chrome/browser/prefs/pref_service.h" |
#include "chrome/browser/printing/print_job.h" |
@@ -300,7 +302,7 @@ int AutomationProvider::GetIndexForNavigationController( |
// TODO(phajdan.jr): move to TestingAutomationProvider. |
DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( |
- const DownloadItem* download) { |
+ const DownloadItem* download, Profile* profile) { |
std::map<DownloadItem::DownloadState, std::string> state_to_string; |
state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS"); |
state_to_string[DownloadItem::CANCELLED] = std::string("CANCELLED"); |
@@ -326,7 +328,13 @@ DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( |
dl_item_value->SetBoolean("open_when_complete", |
download->GetOpenWhenComplete()); |
dl_item_value->SetBoolean("is_temporary", download->IsTemporary()); |
- dl_item_value->SetBoolean("is_otr", download->IsOtr()); // incognito |
+ bool incognito = profile->HasOffTheRecordProfile() && |
+ DownloadServiceFactory::GetForProfile( |
+ profile->GetOffTheRecordProfile())->HasCreatedDownloadManager() && |
+ (content::BrowserContext::GetDownloadManager( |
+ profile->GetOffTheRecordProfile())->GetDownload( |
+ download->GetId()) == download); |
+ dl_item_value->SetBoolean("is_otr", incognito); |
dl_item_value->SetString("state", state_to_string[download->GetState()]); |
dl_item_value->SetString("safety_state", |
safety_state_to_string[download->GetSafetyState()]); |