Chromium Code Reviews| Index: chrome/browser/extensions/extension_tabs_module.cc |
| =================================================================== |
| --- chrome/browser/extensions/extension_tabs_module.cc (revision 114830) |
| +++ chrome/browser/extensions/extension_tabs_module.cc (working copy) |
| @@ -189,6 +189,17 @@ |
| int window_id; |
| EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); |
| + bool populate_tabs = false; |
| + if (HasOptionalArgument(1)) { |
| + DictionaryValue* args; |
|
Aaron Boodman
2011/12/17 07:12:58
Always initialize primitives (to NULL in this case
|
| + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &args)); |
| + |
| + if (args->HasKey(keys::kPopulateKey)) { |
| + EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPopulateKey, |
| + &populate_tabs)); |
| + } |
| + } |
| + |
| Browser* browser = GetBrowserInProfileWithId(profile(), window_id, |
| include_incognito(), &error_); |
| if (!browser || !browser->window()) { |
| @@ -197,28 +208,50 @@ |
| return false; |
| } |
| - result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); |
| + result_.reset(ExtensionTabUtil::CreateWindowValue(browser, populate_tabs)); |
| return true; |
| } |
| bool GetCurrentWindowFunction::RunImpl() { |
| + bool populate_tabs = false; |
| + if (HasOptionalArgument(0)) { |
| + DictionaryValue* args; |
| + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); |
| + |
| + if (args->HasKey(keys::kPopulateKey)) { |
| + EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPopulateKey, |
| + &populate_tabs)); |
| + } |
| + } |
| + |
| Browser* browser = GetCurrentBrowser(); |
| if (!browser || !browser->window()) { |
| error_ = keys::kNoCurrentWindowError; |
| return false; |
| } |
| - result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); |
| + result_.reset(ExtensionTabUtil::CreateWindowValue(browser, populate_tabs)); |
| return true; |
| } |
| bool GetLastFocusedWindowFunction::RunImpl() { |
| + bool populate_tabs = false; |
| + if (HasOptionalArgument(0)) { |
| + DictionaryValue* args; |
| + EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); |
| + |
| + if (args->HasKey(keys::kPopulateKey)) { |
| + EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPopulateKey, |
| + &populate_tabs)); |
| + } |
| + } |
| + |
| Browser* browser = BrowserList::FindAnyBrowser( |
| profile(), include_incognito()); |
| if (!browser || !browser->window()) { |
| error_ = keys::kNoLastFocusedWindowError; |
| return false; |
| } |
| - result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); |
| + result_.reset(ExtensionTabUtil::CreateWindowValue(browser, populate_tabs)); |
| return true; |
| } |