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

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 21 matching lines...) Expand all
32 #include "chrome/browser/automation/automation_resource_message_filter.h" 32 #include "chrome/browser/automation/automation_resource_message_filter.h"
33 #include "chrome/browser/automation/automation_tab_tracker.h" 33 #include "chrome/browser/automation/automation_tab_tracker.h"
34 #include "chrome/browser/automation/automation_window_tracker.h" 34 #include "chrome/browser/automation/automation_window_tracker.h"
35 #include "chrome/browser/bookmarks/bookmark_model.h" 35 #include "chrome/browser/bookmarks/bookmark_model.h"
36 #include "chrome/browser/bookmarks/bookmark_storage.h" 36 #include "chrome/browser/bookmarks/bookmark_storage.h"
37 #include "chrome/browser/browser_process.h" 37 #include "chrome/browser/browser_process.h"
38 #include "chrome/browser/browsing_data/browsing_data_helper.h" 38 #include "chrome/browser/browsing_data/browsing_data_helper.h"
39 #include "chrome/browser/browsing_data/browsing_data_remover.h" 39 #include "chrome/browser/browsing_data/browsing_data_remover.h"
40 #include "chrome/browser/character_encoding.h" 40 #include "chrome/browser/character_encoding.h"
41 #include "chrome/browser/content_settings/host_content_settings_map.h" 41 #include "chrome/browser/content_settings/host_content_settings_map.h"
42 #include "chrome/browser/download/download_service.h"
43 #include "chrome/browser/download/download_service_factory.h"
asanka 2012/08/13 23:03:58 Nit: Are these needed?
benjhayden 2012/08/14 14:30:51 Done.
42 #include "chrome/browser/net/url_request_mock_util.h" 44 #include "chrome/browser/net/url_request_mock_util.h"
43 #include "chrome/browser/prefs/pref_service.h" 45 #include "chrome/browser/prefs/pref_service.h"
44 #include "chrome/browser/printing/print_job.h" 46 #include "chrome/browser/printing/print_job.h"
45 #include "chrome/browser/profiles/profile_manager.h" 47 #include "chrome/browser/profiles/profile_manager.h"
46 #include "chrome/browser/ssl/ssl_blocking_page.h" 48 #include "chrome/browser/ssl/ssl_blocking_page.h"
47 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 49 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
48 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 50 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
49 #include "chrome/browser/ui/browser_commands.h" 51 #include "chrome/browser/ui/browser_commands.h"
50 #include "chrome/browser/ui/browser_finder.h" 52 #include "chrome/browser/ui/browser_finder.h"
51 #include "chrome/browser/ui/browser_tabstrip.h" 53 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 295 }
294 296
295 int AutomationProvider::GetIndexForNavigationController( 297 int AutomationProvider::GetIndexForNavigationController(
296 const NavigationController* controller, const Browser* parent) const { 298 const NavigationController* controller, const Browser* parent) const {
297 DCHECK(parent); 299 DCHECK(parent);
298 return chrome::GetIndexOfTab(parent, controller->GetWebContents()); 300 return chrome::GetIndexOfTab(parent, controller->GetWebContents());
299 } 301 }
300 302
301 // TODO(phajdan.jr): move to TestingAutomationProvider. 303 // TODO(phajdan.jr): move to TestingAutomationProvider.
302 DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( 304 DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem(
303 const DownloadItem* download) { 305 const DownloadItem* download, bool incognito) {
304 std::map<DownloadItem::DownloadState, std::string> state_to_string; 306 std::map<DownloadItem::DownloadState, std::string> state_to_string;
305 state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS"); 307 state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS");
306 state_to_string[DownloadItem::CANCELLED] = std::string("CANCELLED"); 308 state_to_string[DownloadItem::CANCELLED] = std::string("CANCELLED");
307 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED"); 309 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED");
308 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE"); 310 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE");
309 311
310 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string; 312 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string;
311 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE"); 313 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE");
312 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS"); 314 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS");
313 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] = 315 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] =
314 std::string("DANGEROUS_BUT_VALIDATED"); 316 std::string("DANGEROUS_BUT_VALIDATED");
315 317
316 DictionaryValue* dl_item_value = new DictionaryValue; 318 DictionaryValue* dl_item_value = new DictionaryValue;
317 dl_item_value->SetInteger("id", static_cast<int>(download->GetId())); 319 dl_item_value->SetInteger("id", static_cast<int>(download->GetId()));
318 dl_item_value->SetString("url", download->GetURL().spec()); 320 dl_item_value->SetString("url", download->GetURL().spec());
319 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec()); 321 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec());
320 dl_item_value->SetString("file_name", 322 dl_item_value->SetString("file_name",
321 download->GetFileNameToReportUser().value()); 323 download->GetFileNameToReportUser().value());
322 dl_item_value->SetString("full_path", 324 dl_item_value->SetString("full_path",
323 download->GetTargetFilePath().value()); 325 download->GetTargetFilePath().value());
324 dl_item_value->SetBoolean("is_paused", download->IsPaused()); 326 dl_item_value->SetBoolean("is_paused", download->IsPaused());
325 dl_item_value->SetBoolean("open_when_complete", 327 dl_item_value->SetBoolean("open_when_complete",
326 download->GetOpenWhenComplete()); 328 download->GetOpenWhenComplete());
327 dl_item_value->SetBoolean("is_temporary", download->IsTemporary()); 329 dl_item_value->SetBoolean("is_temporary", download->IsTemporary());
328 dl_item_value->SetBoolean("is_otr", download->IsOtr()); // incognito 330 dl_item_value->SetBoolean("is_otr", incognito);
329 dl_item_value->SetString("state", state_to_string[download->GetState()]); 331 dl_item_value->SetString("state", state_to_string[download->GetState()]);
330 dl_item_value->SetString("safety_state", 332 dl_item_value->SetString("safety_state",
331 safety_state_to_string[download->GetSafetyState()]); 333 safety_state_to_string[download->GetSafetyState()]);
332 dl_item_value->SetInteger("PercentComplete", download->PercentComplete()); 334 dl_item_value->SetInteger("PercentComplete", download->PercentComplete());
333 335
334 return dl_item_value; 336 return dl_item_value;
335 } 337 }
336 338
337 void AutomationProvider::OnChannelConnected(int pid) { 339 void AutomationProvider::OnChannelConnected(int pid) {
338 is_connected_ = true; 340 is_connected_ = true;
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 752
751 return NULL; 753 return NULL;
752 } 754 }
753 755
754 void AutomationProvider::SaveAsAsync(int tab_handle) { 756 void AutomationProvider::SaveAsAsync(int tab_handle) {
755 NavigationController* tab = NULL; 757 NavigationController* tab = NULL;
756 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); 758 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab);
757 if (web_contents) 759 if (web_contents)
758 web_contents->OnSavePage(); 760 web_contents->OnSavePage();
759 } 761 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698