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

Unified Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 8969011: Added populate parameter to chrome.windows.get, chrome.windows.getCurrent, (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years 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 side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698