diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-09 07:33:19 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-09 07:33:19 +0000 |
commit | 6de53d401aa8dc6c7e0a9874c71a95ce88ade50d (patch) | |
tree | dd3143fedf4a8affa5988fe71a11379b2b10af9d | |
parent | 6c20697e6da610f40947526bbd65dbda0579445c (diff) | |
download | chromium_src-6de53d401aa8dc6c7e0a9874c71a95ce88ade50d.zip chromium_src-6de53d401aa8dc6c7e0a9874c71a95ce88ade50d.tar.gz chromium_src-6de53d401aa8dc6c7e0a9874c71a95ce88ade50d.tar.bz2 |
Make GConf dependency optional.
This is upstreaming a Gentoo Linux patch.
BUG=13322
TEST=none
Review URL: http://codereview.chromium.org/4691001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65507 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/common.gypi | 3 | ||||
-rw-r--r-- | build/linux/system.gyp | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_titlebar.cc | 11 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_titlebar.h | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/gconf_titlebar_listener.cc | 10 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 6 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_linux.cc | 6 |
7 files changed, 37 insertions, 8 deletions
diff --git a/build/common.gypi b/build/common.gypi index 97863a9..c9f219e 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -314,6 +314,9 @@ # whether to compile in the sources for the GPU plugin / process. 'enable_gpu%': 1, + # Use GConf, the GNOME configuration system. + 'use_gconf%': 1, + # Use OpenSSL instead of NSS. Currently in development. 'use_openssl%': 0, diff --git a/build/linux/system.gyp b/build/linux/system.gyp index ed88a0a..271feef 100644 --- a/build/linux/system.gyp +++ b/build/linux/system.gyp @@ -188,11 +188,14 @@ 'target_name': 'gconf', 'type': 'settings', 'conditions': [ - ['_toolset=="target"', { + ['use_gconf==1 and _toolset=="target"', { 'direct_dependent_settings': { 'cflags': [ '<!@(<(pkg-config) --cflags gconf-2.0)', ], + 'defines': [ + 'USE_GCONF', + ], }, 'link_settings': { 'ldflags': [ diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/gtk/browser_titlebar.cc index dea24e6..77adb09 100644 --- a/chrome/browser/gtk/browser_titlebar.cc +++ b/chrome/browser/gtk/browser_titlebar.cc @@ -23,7 +23,9 @@ #include "chrome/browser/gtk/accelerators_gtk.h" #include "chrome/browser/gtk/browser_window_gtk.h" #include "chrome/browser/gtk/custom_button.h" +#if defined(USE_GCONF) #include "chrome/browser/gtk/gconf_titlebar_listener.h" +#endif #include "chrome/browser/gtk/gtk_theme_provider.h" #include "chrome/browser/gtk/gtk_util.h" #include "chrome/browser/gtk/menu_gtk.h" @@ -193,6 +195,9 @@ void PopupPageMenuModel::Build() { //////////////////////////////////////////////////////////////////////////////// // BrowserTitlebar +// static +const char BrowserTitlebar::kDefaultButtonString[] = ":minimize,maximize,close"; + BrowserTitlebar::BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window) : browser_window_(browser_window), @@ -299,9 +304,13 @@ void BrowserTitlebar::Init() { gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_buttons_vbox_, FALSE, FALSE, 0); +#if defined(USE_GCONF) // Either read the gconf database and register for updates (on GNOME), or use // the default value (anywhere else). Singleton<GConfTitlebarListener>()->SetTitlebarButtons(this); +#else + BuildButtons(kDefaultButtonString); +#endif // We use an alignment to control the titlebar height. titlebar_alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); @@ -363,7 +372,9 @@ void BrowserTitlebar::Init() { BrowserTitlebar::~BrowserTitlebar() { ActiveWindowWatcherX::RemoveObserver(this); +#if defined(USE_GCONF) Singleton<GConfTitlebarListener>()->RemoveObserver(this); +#endif } void BrowserTitlebar::BuildButtons(const std::string& button_string) { diff --git a/chrome/browser/gtk/browser_titlebar.h b/chrome/browser/gtk/browser_titlebar.h index c6da855..5cd30e6 100644 --- a/chrome/browser/gtk/browser_titlebar.h +++ b/chrome/browser/gtk/browser_titlebar.h @@ -31,6 +31,10 @@ class BrowserTitlebar : public NotificationObserver, public ActiveWindowWatcherX::Observer, public menus::SimpleMenuModel::Delegate { public: + // A default button order string for when we aren't asking gconf for the + // metacity configuration. + static const char kDefaultButtonString[]; + BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window); virtual ~BrowserTitlebar(); diff --git a/chrome/browser/gtk/gconf_titlebar_listener.cc b/chrome/browser/gtk/gconf_titlebar_listener.cc index 81b5ef0..237332f 100644 --- a/chrome/browser/gtk/gconf_titlebar_listener.cc +++ b/chrome/browser/gtk/gconf_titlebar_listener.cc @@ -13,10 +13,6 @@ namespace { -// A default button order string for when we aren't asking gconf for the -// metacity configuration. -const char* kDefaultButtonPlacement = ":minimize,maximize,close"; - // The GConf key we read for the button placement string. Even through the key // has "metacity" in it, it's shared between metacity and compiz. const char* kButtonLayoutKey = "/apps/metacity/general/button_layout"; @@ -34,7 +30,7 @@ void GConfTitlebarListener::SetTitlebarButtons(BrowserTitlebar* titlebar) { titlebar->BuildButtons(current_value_); titlebars_.insert(titlebar); } else { - titlebar->BuildButtons(kDefaultButtonPlacement); + titlebar->BuildButtons(BrowserTitlebar::kDefaultButtonString); } } @@ -113,8 +109,8 @@ bool GConfTitlebarListener::HandleGError(GError* error, const char* key) { void GConfTitlebarListener::ParseAndStoreValue(GConfValue* gconf_value) { if (gconf_value) { const char* value = gconf_value_get_string(gconf_value); - current_value_ = value ? value : kDefaultButtonPlacement; + current_value_ = value ? value : BrowserTitlebar::kDefaultButtonString; } else { - current_value_ = kDefaultButtonPlacement; + current_value_ = BrowserTitlebar::kDefaultButtonString; } } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 88e1448..9fc4fb7 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3405,6 +3405,12 @@ ], }, }], + ['use_gconf==0', { + 'sources!': [ + 'browser/gtk/gconf_titlebar_listener.cc', + 'browser/gtk/gconf_titlebar_listener.h', + ], + }], ['use_gnome_keyring==0', { 'sources!': [ 'browser/password_manager/native_backend_gnome_x.h', diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index 3d8c3ce..5e548cf 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -6,7 +6,9 @@ #include <errno.h> #include <fcntl.h> +#if defined(USE_GCONF) #include <gconf/gconf-client.h> +#endif #include <limits.h> #include <stdio.h> #include <stdlib.h> @@ -185,6 +187,7 @@ namespace { const int kDebounceTimeoutMilliseconds = 250; +#if defined(USE_GCONF) // This is the "real" gconf version that actually uses gconf. class GConfSettingGetterImplGConf : public ProxyConfigServiceLinux::GConfSettingGetter { @@ -419,6 +422,7 @@ class GConfSettingGetterImplGConf DISALLOW_COPY_AND_ASSIGN(GConfSettingGetterImplGConf); }; +#endif // defined(USE_GCONF) // This is the KDE version that reads kioslaverc and simulates gconf. // Doing this allows the main Delegate code, as well as the unit tests @@ -1064,7 +1068,9 @@ ProxyConfigServiceLinux::Delegate::Delegate(base::Environment* env_var_getter) // Figure out which GConfSettingGetterImpl to use, if any. switch (base::nix::GetDesktopEnvironment(env_var_getter)) { case base::nix::DESKTOP_ENVIRONMENT_GNOME: +#if defined(USE_GCONF) gconf_getter_.reset(new GConfSettingGetterImplGConf()); +#endif break; case base::nix::DESKTOP_ENVIRONMENT_KDE3: case base::nix::DESKTOP_ENVIRONMENT_KDE4: |