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

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

Issue 8503018: Split DownloadItem into an ABC, an Impl, and a Mock. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED"); 262 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED");
263 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE"); 263 state_to_string[DownloadItem::COMPLETE] = std::string("COMPLETE");
264 264
265 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string; 265 std::map<DownloadItem::SafetyState, std::string> safety_state_to_string;
266 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE"); 266 safety_state_to_string[DownloadItem::SAFE] = std::string("SAFE");
267 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS"); 267 safety_state_to_string[DownloadItem::DANGEROUS] = std::string("DANGEROUS");
268 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] = 268 safety_state_to_string[DownloadItem::DANGEROUS_BUT_VALIDATED] =
269 std::string("DANGEROUS_BUT_VALIDATED"); 269 std::string("DANGEROUS_BUT_VALIDATED");
270 270
271 DictionaryValue* dl_item_value = new DictionaryValue; 271 DictionaryValue* dl_item_value = new DictionaryValue;
272 dl_item_value->SetInteger("id", static_cast<int>(download->id())); 272 dl_item_value->SetInteger("id", static_cast<int>(download->GetId()));
273 dl_item_value->SetString("url", download->GetURL().spec()); 273 dl_item_value->SetString("url", download->GetURL().spec());
274 dl_item_value->SetString("referrer_url", download->referrer_url().spec()); 274 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec());
275 dl_item_value->SetString("file_name", 275 dl_item_value->SetString("file_name",
276 download->GetFileNameToReportUser().value()); 276 download->GetFileNameToReportUser().value());
277 dl_item_value->SetString("full_path", 277 dl_item_value->SetString("full_path",
278 download->GetTargetFilePath().value()); 278 download->GetTargetFilePath().value());
279 dl_item_value->SetBoolean("is_paused", download->is_paused()); 279 dl_item_value->SetBoolean("is_paused", download->IsPaused());
280 dl_item_value->SetBoolean("open_when_complete", 280 dl_item_value->SetBoolean("open_when_complete",
281 download->open_when_complete()); 281 download->GetOpenWhenComplete());
282 dl_item_value->SetBoolean("is_temporary", download->is_temporary()); 282 dl_item_value->SetBoolean("is_temporary", download->IsTemporary());
283 dl_item_value->SetBoolean("is_otr", download->is_otr()); // incognito 283 dl_item_value->SetBoolean("is_otr", download->IsOtr()); // incognito
284 dl_item_value->SetString("state", state_to_string[download->state()]); 284 dl_item_value->SetString("state", state_to_string[download->GetState()]);
285 dl_item_value->SetString("safety_state", 285 dl_item_value->SetString("safety_state",
286 safety_state_to_string[download->safety_state()]); 286 safety_state_to_string[download->GetSafetyState()]);
287 dl_item_value->SetInteger("PercentComplete", download->PercentComplete()); 287 dl_item_value->SetInteger("PercentComplete", download->PercentComplete());
288 288
289 return dl_item_value; 289 return dl_item_value;
290 } 290 }
291 291
292 const Extension* AutomationProvider::GetExtension(int extension_handle) { 292 const Extension* AutomationProvider::GetExtension(int extension_handle) {
293 return extension_tracker_->GetResource(extension_handle); 293 return extension_tracker_->GetResource(extension_handle);
294 } 294 }
295 295
296 const Extension* AutomationProvider::GetEnabledExtension(int extension_handle) { 296 const Extension* AutomationProvider::GetEnabledExtension(int extension_handle) {
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 } 1019 }
1020 } 1020 }
1021 } 1021 }
1022 1022
1023 void AutomationProvider::SaveAsAsync(int tab_handle) { 1023 void AutomationProvider::SaveAsAsync(int tab_handle) {
1024 NavigationController* tab = NULL; 1024 NavigationController* tab = NULL;
1025 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); 1025 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab);
1026 if (tab_contents) 1026 if (tab_contents)
1027 tab_contents->OnSavePage(); 1027 tab_contents->OnSavePage();
1028 } 1028 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698