OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED"); | 263 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED"); |
264 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE"); | 264 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE"); |
265 | 265 |
266 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string; | 266 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string; |
267 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE"); | 267 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE"); |
268 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS"); | 268 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS"); |
269 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] = | 269 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] = |
270 std::string("DANGEROUS_BUT_VALIDATED"); | 270 std::string("DANGEROUS_BUT_VALIDATED"); |
271 | 271 |
272 DictionaryValue* dl_item_value = new DictionaryValue; | 272 DictionaryValue* dl_item_value = new DictionaryValue; |
273 dl_item_value->SetInteger("id", static_cast<int>(download->id())); | 273 dl_item_value->SetInteger("id", static_cast<int>(download->GetId())); |
274 dl_item_value->SetString("url", download->GetURL().spec()); | 274 dl_item_value->SetString("url", download->GetURL().spec()); |
275 dl_item_value->SetString("referrer_url", download->referrer_url().spec()); | 275 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec()); |
276 dl_item_value->SetString("file_name", | 276 dl_item_value->SetString("file_name", |
277 download->GetFileNameToReportUser().value()); | 277 download->GetFileNameToReportUser().value()); |
278 dl_item_value->SetString("full_path", | 278 dl_item_value->SetString("full_path", |
279 download->GetTargetFilePath().value()); | 279 download->GetTargetFilePath().value()); |
280 dl_item_value->SetBoolean("is_paused", download->is_paused()); | 280 dl_item_value->SetBoolean("is_paused", download->IsPaused()); |
281 dl_item_value->SetBoolean("open_when_complete", | 281 dl_item_value->SetBoolean("open_when_complete", |
282 download->open_when_complete()); | 282 download->GetOpenWhenComplete()); |
283 dl_item_value->SetBoolean("is_temporary", download->is_temporary()); | 283 dl_item_value->SetBoolean("is_temporary", download->IsTemporary()); |
284 dl_item_value->SetBoolean("is_otr", download->is_otr()); // incognito | 284 dl_item_value->SetBoolean("is_otr", download->IsOtr()); // incognito |
285 dl_item_value->SetString("state", state_to_string[download->state()]); | 285 dl_item_value->SetString("state", state_to_string[download->GetState()]); |
286 dl_item_value->SetString("safety_state", | 286 dl_item_value->SetString("safety_state", |
287 safety_state_to_string[download->safety_state()]); | 287 safety_state_to_string[download->GetSafetyState()]); |
288 dl_item_value->SetInteger("PercentComplete", download->PercentComplete()); | 288 dl_item_value->SetInteger("PercentComplete", download->PercentComplete()); |
289 | 289 |
290 return dl_item_value; | 290 return dl_item_value; |
291 } | 291 } |
292 | 292 |
293 const Extension* AutomationProvider::GetExtension(int extension_handle) { | 293 const Extension* AutomationProvider::GetExtension(int extension_handle) { |
294 return extension_tracker_->GetResource(extension_handle); | 294 return extension_tracker_->GetResource(extension_handle); |
295 } | 295 } |
296 | 296 |
297 const Extension* AutomationProvider::GetEnabledExtension(int extension_handle) { | 297 const Extension* AutomationProvider::GetEnabledExtension(int extension_handle) { |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 } | 1020 } |
1021 } | 1021 } |
1022 } | 1022 } |
1023 | 1023 |
1024 void AutomationProvider::SaveAsAsync(int tab_handle) { | 1024 void AutomationProvider::SaveAsAsync(int tab_handle) { |
1025 NavigationController* tab = NULL; | 1025 NavigationController* tab = NULL; |
1026 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 1026 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
1027 if (tab_contents) | 1027 if (tab_contents) |
1028 tab_contents->OnSavePage(); | 1028 tab_contents->OnSavePage(); |
1029 } | 1029 } |
OLD | NEW |