Chromium Code Reviews| Index: chrome/browser/extensions/api/tabs/tabs.cc |
| =================================================================== |
| --- chrome/browser/extensions/api/tabs/tabs.cc (revision 142698) |
| +++ chrome/browser/extensions/api/tabs/tabs.cc (working copy) |
| @@ -1101,6 +1101,33 @@ |
| return true; |
| } |
| +bool DuplicateTabFunction::RunImpl() { |
| + int tab_id = -1; |
| + EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); |
| + |
| + Browser* browser = NULL; |
| + TabStripModel* tab_strip = NULL; |
| + TabContents* contents = NULL; |
| + int tab_index = -1; |
| + if (!GetTabById(tab_id, profile(), include_incognito(), |
| + &browser, &tab_strip, &contents, &tab_index, &error_)) |
| + return false; |
| + |
| + TabContents* new_contents = browser->DuplicateContentsAt(tab_index); |
| + int new_index = tab_strip->GetIndexOfTabContents(new_contents); |
| + |
| + // Return data about the newly created tab. |
| + if (has_callback()) { |
| + bool has_permission = GetExtension()->HasAPIPermission( |
| + ExtensionAPIPermission::kTab); |
| + result_.reset(ExtensionTabUtil::CreateTabValue( |
|
Aaron Boodman
2012/07/16 21:37:59
Can you change CreateTabValue to take the Extensio
SanjoyPal
2012/07/17 10:39:56
Yes. I ll do that.
Can I make these changes as par
|
| + new_contents->web_contents(), |
| + tab_strip, new_index, has_permission)); |
| + } |
| + |
| + return true; |
| +} |
| + |
| bool GetTabFunction::RunImpl() { |
| int tab_id = -1; |
| EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); |