summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_init.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 21:09:00 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 21:09:00 +0000
commitb69e649feb5dc5f7daa6daa84c98b3a2d9a28124 (patch)
tree5f56ff83299a2753d388c5fd1d3dcdf59e4be9b0 /chrome/browser/browser_init.cc
parent68b745055e85cc466a0c867e87eacb43539baaa4 (diff)
downloadchromium_src-b69e649feb5dc5f7daa6daa84c98b3a2d9a28124.zip
chromium_src-b69e649feb5dc5f7daa6daa84c98b3a2d9a28124.tar.gz
chromium_src-b69e649feb5dc5f7daa6daa84c98b3a2d9a28124.tar.bz2
GTK: raise old browser windows when adding a new tab
BUG=38166 TEST=`google-chrome http://google.com` should raise the browser window. Review URL: http://codereview.chromium.org/1646011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_init.cc')
-rw-r--r--chrome/browser/browser_init.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index af39c5b..301d7db 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -62,6 +62,10 @@
#include "app/win_util.h"
#endif
+#if defined(TOOLKIT_GTK)
+#include "chrome/browser/gtk/gtk_util.h"
+#endif
+
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/browser_notification_observers.h"
#include "chrome/browser/dom_ui/mediaplayer_ui.h"
@@ -694,8 +698,16 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
if (!profile_ && browser)
profile_ = browser->profile();
- if (!browser || browser->type() != Browser::TYPE_NORMAL)
+ if (!browser || browser->type() != Browser::TYPE_NORMAL) {
browser = Browser::Create(profile_);
+ } else {
+#if defined(TOOLKIT_GTK)
+ // Setting the time of the last action on the window here allows us to steal
+ // focus, which is what the user wants when opening a new tab in an existing
+ // browser window.
+ gtk_util::SetWMLastUserActionTime(browser->window()->GetNativeHandle());
+#endif
+ }
#if !defined(OS_MACOSX)
// In kiosk mode, we want to always be fullscreen, so switch to that now.