diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 09:17:16 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 09:17:16 +0000 |
commit | cc04a159cd1ef9daa7f35257372f1f432ffd2162 (patch) | |
tree | 3d9e97736c91ab527f8e687e6215f42b1a04780a | |
parent | 5bcc8054cad35c87a449e9eb9c9401155dcbde00 (diff) | |
download | chromium_src-cc04a159cd1ef9daa7f35257372f1f432ffd2162.zip chromium_src-cc04a159cd1ef9daa7f35257372f1f432ffd2162.tar.gz chromium_src-cc04a159cd1ef9daa7f35257372f1f432ffd2162.tar.bz2 |
Linux Aura: Notify the window manager when a new browser instance opens in an existing window.
BUG=326033
TEST=manual, see bug.
Review URL: https://codereview.chromium.org/153203003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250656 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/process_singleton_linux.cc | 17 | ||||
-rw-r--r-- | chrome/browser/ui/libgtk2ui/gtk2_ui.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/libgtk2ui/gtk2_ui.h | 1 | ||||
-rw-r--r-- | ui/views/linux_ui/linux_ui.h | 8 |
4 files changed, 29 insertions, 3 deletions
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index 8e12d98..8038afe 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -41,9 +41,6 @@ #include <errno.h> #include <fcntl.h> -#if defined(TOOLKIT_GTK) -#include <gdk/gdk.h> -#endif #include <signal.h> #include <sys/socket.h> #include <sys/stat.h> @@ -85,6 +82,13 @@ #include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" +#if defined(TOOLKIT_GTK) +#include <gdk/gdk.h> +#endif +#if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) +#include "ui/views/linux_ui/linux_ui.h" +#endif + using content::BrowserThread; const int ProcessSingleton::kTimeoutInSeconds; @@ -816,6 +820,13 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( // window, GTK will not automatically call this for us. gdk_notify_startup_complete(); #endif +#if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) + // Likely NULL in unit tests. + views::LinuxUI* linux_ui = views::LinuxUI::instance(); + if (linux_ui) + linux_ui->NotifyWindowManagerStartupComplete(); +#endif + // Assume the other process is handling the request. return PROCESS_NOTIFIED; } diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc index 43e3ca2..c84955e 100644 --- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc +++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc @@ -661,6 +661,12 @@ bool Gtk2UI::UnityIsRunning() { return unity::IsRunning(); } +void Gtk2UI::NotifyWindowManagerStartupComplete() { + // TODO(port) Implement this using _NET_STARTUP_INFO_BEGIN/_NET_STARTUP_INFO + // from http://standards.freedesktop.org/startup-notification-spec/ instead. + gdk_notify_startup_complete(); +} + void Gtk2UI::GetScrollbarColors(GdkColor* thumb_active_color, GdkColor* thumb_inactive_color, GdkColor* track_color) { diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.h b/chrome/browser/ui/libgtk2ui/gtk2_ui.h index a03e5cb6..3516699 100644 --- a/chrome/browser/ui/libgtk2ui/gtk2_ui.h +++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.h @@ -108,6 +108,7 @@ class Gtk2UI : public views::LinuxUI { virtual void RemoveWindowButtonOrderObserver( views::WindowButtonOrderObserver* observer) OVERRIDE; virtual bool UnityIsRunning() OVERRIDE; + virtual void NotifyWindowManagerStartupComplete() OVERRIDE; private: typedef std::map<int, SkColor> ColorMap; diff --git a/ui/views/linux_ui/linux_ui.h b/ui/views/linux_ui/linux_ui.h index ef5a332..7e73e45 100644 --- a/ui/views/linux_ui/linux_ui.h +++ b/ui/views/linux_ui/linux_ui.h @@ -5,6 +5,8 @@ #ifndef UI_VIEWS_LINUX_UI_LINUX_UI_H_ #define UI_VIEWS_LINUX_UI_LINUX_UI_H_ +#include <string> + #include "third_party/skia/include/core/SkColor.h" #include "ui/base/ime/linux/linux_input_method_context_factory.h" #include "ui/gfx/linux_font_delegate.h" @@ -118,6 +120,12 @@ class VIEWS_EXPORT LinuxUI : public ui::LinuxInputMethodContextFactory, // Determines whether the user's window manager is Unity. virtual bool UnityIsRunning() = 0; + + // Notifies the window manager that start up has completed. + // Normally Chromium opens a new window on startup and GTK does this + // automatically. In case Chromium does not open a new window on startup, + // e.g. an existing browser window already exists, this should be called. + virtual void NotifyWindowManagerStartupComplete() = 0; }; } // namespace views |