OLD | NEW |
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 int AutomationProvider::GetIndexForNavigationController( | 212 int AutomationProvider::GetIndexForNavigationController( |
213 const NavigationController* controller, const Browser* parent) const { | 213 const NavigationController* controller, const Browser* parent) const { |
214 DCHECK(parent); | 214 DCHECK(parent); |
215 return parent->tab_strip_model()->GetIndexOfWebContents( | 215 return parent->tab_strip_model()->GetIndexOfWebContents( |
216 controller->GetWebContents()); | 216 controller->GetWebContents()); |
217 } | 217 } |
218 | 218 |
219 // TODO(phajdan.jr): move to TestingAutomationProvider. | 219 // TODO(phajdan.jr): move to TestingAutomationProvider. |
220 DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( | 220 base::DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( |
221 const DownloadItem* download, bool incognito) { | 221 const DownloadItem* download, bool incognito) { |
222 const char *download_state_string = NULL; | 222 const char *download_state_string = NULL; |
223 switch (download->GetState()) { | 223 switch (download->GetState()) { |
224 case DownloadItem::IN_PROGRESS: | 224 case DownloadItem::IN_PROGRESS: |
225 download_state_string = "IN_PROGRESS"; | 225 download_state_string = "IN_PROGRESS"; |
226 break; | 226 break; |
227 case DownloadItem::CANCELLED: | 227 case DownloadItem::CANCELLED: |
228 download_state_string = "CANCELLED"; | 228 download_state_string = "CANCELLED"; |
229 break; | 229 break; |
230 case DownloadItem::INTERRUPTED: | 230 case DownloadItem::INTERRUPTED: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 break; | 273 break; |
274 case content::DOWNLOAD_DANGER_TYPE_MAX: | 274 case content::DOWNLOAD_DANGER_TYPE_MAX: |
275 NOTREACHED(); | 275 NOTREACHED(); |
276 download_danger_type_string = "UNKNOWN"; | 276 download_danger_type_string = "UNKNOWN"; |
277 break; | 277 break; |
278 } | 278 } |
279 DCHECK(download_danger_type_string); | 279 DCHECK(download_danger_type_string); |
280 if (!download_danger_type_string) | 280 if (!download_danger_type_string) |
281 download_danger_type_string = "UNKNOWN"; | 281 download_danger_type_string = "UNKNOWN"; |
282 | 282 |
283 DictionaryValue* dl_item_value = new DictionaryValue; | 283 base::DictionaryValue* dl_item_value = new base::DictionaryValue; |
284 dl_item_value->SetInteger("id", static_cast<int>(download->GetId())); | 284 dl_item_value->SetInteger("id", static_cast<int>(download->GetId())); |
285 dl_item_value->SetString("url", download->GetURL().spec()); | 285 dl_item_value->SetString("url", download->GetURL().spec()); |
286 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec()); | 286 dl_item_value->SetString("referrer_url", download->GetReferrerUrl().spec()); |
287 dl_item_value->SetString("file_name", | 287 dl_item_value->SetString("file_name", |
288 download->GetFileNameToReportUser().value()); | 288 download->GetFileNameToReportUser().value()); |
289 dl_item_value->SetString("full_path", | 289 dl_item_value->SetString("full_path", |
290 download->GetTargetFilePath().value()); | 290 download->GetTargetFilePath().value()); |
291 dl_item_value->SetBoolean("is_paused", download->IsPaused()); | 291 dl_item_value->SetBoolean("is_paused", download->IsPaused()); |
292 dl_item_value->SetBoolean("open_when_complete", | 292 dl_item_value->SetBoolean("open_when_complete", |
293 download->GetOpenWhenComplete()); | 293 download->GetOpenWhenComplete()); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 NOTREACHED(); | 636 NOTREACHED(); |
637 return NULL; | 637 return NULL; |
638 } | 638 } |
639 | 639 |
640 RenderViewHost* view_host = web_contents->GetRenderViewHost(); | 640 RenderViewHost* view_host = web_contents->GetRenderViewHost(); |
641 return view_host; | 641 return view_host; |
642 } | 642 } |
643 | 643 |
644 return NULL; | 644 return NULL; |
645 } | 645 } |
OLD | NEW |