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

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

Issue 9699065: "index" property should be optional with "chrome.tabs.move" (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 months 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
« no previous file with comments | « no previous file | chrome/common/extensions/api/tabs.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tabs_module.cc
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index dbf198bc71c1fd73545ff35ba40c7c0bf1c79986..24c9878ebbc10faf7675182168c2924656b349bc 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/extension_tabs_module.h"
#include <algorithm>
+#include <limits>
#include <vector>
#include "base/base64.h"
@@ -1402,12 +1403,18 @@ bool MoveTabsFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(ReadOneOrMoreIntegers(tab_value, &tab_ids));
DictionaryValue* update_props = NULL;
- EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props));
+ if (HasOptionalArgument(1)) {
+ EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props));
+ }
int new_index = -1;
- EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
- keys::kIndexKey, &new_index));
- EXTENSION_FUNCTION_VALIDATE(new_index >= 0);
+ if (update_props && update_props->HasKey(keys::kIndexKey)) {
+ EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
+ keys::kIndexKey, &new_index));
+ EXTENSION_FUNCTION_VALIDATE(new_index >= 0);
+ } else {
+ new_index = std::numeric_limits<int>::max(); // Will get clamped
clintstaley 2012/03/20 17:19:29 . after all comments
mitchellwrosen 2012/03/27 01:19:49 Done.
+ }
ListValue tab_values;
for (size_t i = 0; i < tab_ids.size(); ++i) {
@@ -1429,7 +1436,7 @@ bool MoveTabsFunction::RunImpl() {
// Insert the tabs one after another.
new_index += i;
- if (update_props->HasKey(keys::kWindowIdKey)) {
+ if (update_props && update_props->HasKey(keys::kWindowIdKey)) {
Browser* target_browser = NULL;
int window_id = extension_misc::kUnknownWindowId;
EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
« no previous file with comments | « no previous file | chrome/common/extensions/api/tabs.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698