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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 12212155: When focusing a tab via the extension API, bring focus to its containing window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/tabs/tabs_api.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 9f91fd7307931da384bd1c2146776e1abc69694b..c9dffec1b3bcb0d9b11796cba0bd56902f5a67a7 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -1098,8 +1098,7 @@ bool TabsCreateFunction::RunImpl() {
index = std::min(std::max(index, -1), tab_strip->count());
- int add_types = active ? TabStripModel::ADD_ACTIVE :
- TabStripModel::ADD_NONE;
+ int add_types = active ? TabStripModel::ADD_ACTIVE : TabStripModel::ADD_NONE;
add_types |= TabStripModel::ADD_FORCE_INDEX;
if (pinned)
add_types |= TabStripModel::ADD_PINNED;
@@ -1116,8 +1115,11 @@ bool TabsCreateFunction::RunImpl() {
if (opener)
tab_strip->SetOpenerOfWebContentsAt(new_index, opener);
- if (active)
+ if (active) {
params.target_contents->GetView()->SetInitialFocus();
+ params.target_contents->GetDelegate()->ActivateContents(
+ params.target_contents);
not at google - send to devlin 2013/02/13 01:28:11 here and below if you activate it does it automati
Matt Perry 2013/02/13 01:38:52 Good call, it does. I've removed the extraneous ca
+ }
// Return data about the newly created tab.
if (has_callback()) {
@@ -1306,6 +1308,7 @@ bool TabsUpdateFunction::RunImpl() {
DCHECK_EQ(contents, tab_strip->GetActiveWebContents());
}
web_contents_->Focus();
+ web_contents_->GetDelegate()->ActivateContents(web_contents_);
}
if (update_props->HasKey(keys::kHighlightedKey)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698