diff options
-rw-r--r-- | chrome/browser/extensions/extension_tabs_module.cc | 10 | ||||
-rwxr-xr-x | chrome/chrome_tests.gypi | 2 | ||||
-rwxr-xr-x | chrome/common/extensions/api/extension_api.json | 3 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/tabs/basics/test.js | 9 |
4 files changed, 20 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index 19d2687..6f40ad6 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -386,7 +386,15 @@ bool UpdateWindowFunction::RunImpl() { } browser->window()->SetBounds(bounds); - // TODO(rafaelw): Support |focused|. + + if (update_props->HasKey(keys::kFocusedKey)) { + bool focused = false; + EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean(keys::kFocusedKey, + &focused)); + if (focused) + browser->window()->Activate(); + } + result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); return true; diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index e82d3c9..026584f 100755 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -15,7 +15,6 @@ 'browser/extensions/extension_shelf_model_unittest.cc', 'browser/extensions/extension_startup_unittest.cc', 'browser/extensions/extension_storage_apitest.cc', - 'browser/extensions/extension_tabs_apitest.cc', 'browser/extensions/extension_popup_apitest.cc', # TODO(jam): http://crbug.com/15101 These tests fail on Linux and Mac. 'browser/child_process_security_policy_browser_test.cc', @@ -1115,6 +1114,7 @@ 'browser/extensions/extension_javascript_url_apitest.cc', 'browser/extensions/extension_messages_apitest.cc', 'browser/extensions/extension_override_apitest.cc', + 'browser/extensions/extension_tabs_apitest.cc', 'browser/extensions/extension_toolstrip_apitest.cc', 'browser/extensions/incognito_noscript_apitest.cc', 'browser/extensions/isolated_world_apitest.cc', diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 1daeb09..a02895f 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -357,7 +357,8 @@ "left": {"type": "integer", "optional": true, "description": "The offset from the left edge of the screen to move the window to in pixels."}, "top": {"type": "integer", "optional": true, "description": "The offset from the top edge of the screen to move the window to in pixels."}, "width": {"type": "integer", "minimum": 0, "optional": true, "description": "The width to resize the window to in pixels."}, - "height": {"type": "integer", "minimum": 0, "optional": true, "description": "The height to resize the window to in pixels."} + "height": {"type": "integer", "minimum": 0, "optional": true, "description": "The height to resize the window to in pixels."}, + "focused": {"type": "boolean", "optional": true, "description": "Set to true to focus the window. Setting to false has no effect on the window (it doesn't blur it)."} } }, { diff --git a/chrome/test/data/extensions/api_test/tabs/basics/test.js b/chrome/test/data/extensions/api_test/tabs/basics/test.js index a516ddc..00f20dd 100644 --- a/chrome/test/data/extensions/api_test/tabs/basics/test.js +++ b/chrome/test/data/extensions/api_test/tabs/basics/test.js @@ -35,7 +35,6 @@ chrome.test.runTests([ assertTrue(tab.index > firstTabIndex); assertEq(firstWindowId, tab.windowId); assertEq(false, tab.selected); - assertEq("chrome://newtab/", tab.url); })); }, @@ -241,6 +240,14 @@ chrome.test.runTests([ })); }, + function focus() { + chrome.test.listenOnce(chrome.windows.onFocusChanged, function(winId) { + assertEq(firstWindowId, winId); + }); + + chrome.windows.update(firstWindowId, {focused: true}, pass()); + }, + /* // TODO(jcampan): http://crbug.com/30662 the detection language library // crashes on some sites and has been temporarily disabled. |