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

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

Issue 10805020: Kill DownloadItem::IsOtr() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 8 years, 4 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/automation_provider.h" 5 #include "chrome/browser/automation/automation_provider.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 int AutomationProvider::GetIndexForNavigationController( 295 int AutomationProvider::GetIndexForNavigationController(
296 const NavigationController* controller, const Browser* parent) const { 296 const NavigationController* controller, const Browser* parent) const {
297 DCHECK(parent); 297 DCHECK(parent);
298 return chrome::GetIndexOfTab(parent, controller->GetWebContents()); 298 return chrome::GetIndexOfTab(parent, controller->GetWebContents());
299 } 299 }
300 300
301 // TODO(phajdan.jr): move to TestingAutomationProvider. 301 // TODO(phajdan.jr): move to TestingAutomationProvider.
302 DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( 302 DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem(
303 const DownloadItem* download) { 303 const DownloadItem* download, bool incognito) {
304 std::map<DownloadItem::DownloadState, std::string> state_to_string; 304 std::map<DownloadItem::DownloadState, std::string> state_to_string;
305 state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS"); 305 state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS");
306 state_to_string[DownloadItem::CANCELLED] = std::string("CANCELLED"); 306 state_to_string[DownloadItem::CANCELLED] = std::string("CANCELLED");
307 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED"); 307 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED");
308 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE"); 308 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE");
309 309
310 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string; 310 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string;
311 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE"); 311 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE");
312 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS"); 312 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS");
313 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] = 313 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] =
314 std::string("DANGEROUS_BUT_VALIDATED"); 314 std::string("DANGEROUS_BUT_VALIDATED");
315 315
316 DictionaryValue* dl_item_value = new DictionaryValue; 316 DictionaryValue* dl_item_value = new DictionaryValue;
317 dl_item_value->SetInteger("id", static_cast<int>(download->GetId())); 317 dl_item_value->SetInteger("id", static_cast<int>(download->GetId()));
318 dl_item_value->SetString("url", download->GetURL().spec()); 318 dl_item_value->SetString("url", download->GetURL().spec());
319 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec()); 319 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec());
320 dl_item_value->SetString("file_name", 320 dl_item_value->SetString("file_name",
321 download->GetFileNameToReportUser().value()); 321 download->GetFileNameToReportUser().value());
322 dl_item_value->SetString("full_path", 322 dl_item_value->SetString("full_path",
323 download->GetTargetFilePath().value()); 323 download->GetTargetFilePath().value());
324 dl_item_value->SetBoolean("is_paused", download->IsPaused()); 324 dl_item_value->SetBoolean("is_paused", download->IsPaused());
325 dl_item_value->SetBoolean("open_when_complete", 325 dl_item_value->SetBoolean("open_when_complete",
326 download->GetOpenWhenComplete()); 326 download->GetOpenWhenComplete());
327 dl_item_value->SetBoolean("is_temporary", download->IsTemporary()); 327 dl_item_value->SetBoolean("is_temporary", download->IsTemporary());
328 dl_item_value->SetBoolean("is_otr", download->IsOtr()); // incognito 328 dl_item_value->SetBoolean("is_otr", incognito);
329 dl_item_value->SetString("state", state_to_string[download->GetState()]); 329 dl_item_value->SetString("state", state_to_string[download->GetState()]);
330 dl_item_value->SetString("safety_state", 330 dl_item_value->SetString("safety_state",
331 safety_state_to_string[download->GetSafetyState()]); 331 safety_state_to_string[download->GetSafetyState()]);
332 dl_item_value->SetInteger("PercentComplete", download->PercentComplete()); 332 dl_item_value->SetInteger("PercentComplete", download->PercentComplete());
333 333
334 return dl_item_value; 334 return dl_item_value;
335 } 335 }
336 336
337 void AutomationProvider::OnChannelConnected(int pid) { 337 void AutomationProvider::OnChannelConnected(int pid) {
338 is_connected_ = true; 338 is_connected_ = true;
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 750
751 return NULL; 751 return NULL;
752 } 752 }
753 753
754 void AutomationProvider::SaveAsAsync(int tab_handle) { 754 void AutomationProvider::SaveAsAsync(int tab_handle) {
755 NavigationController* tab = NULL; 755 NavigationController* tab = NULL;
756 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); 756 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab);
757 if (web_contents) 757 if (web_contents)
758 web_contents->OnSavePage(); 758 web_contents->OnSavePage();
759 } 759 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/browser/automation/automation_provider_observers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698