Remove TOOLKIT_USES_GTK and consolidate it into TOOLKIT_GTK
Add gtk dependency to base.gyp for android host_os="linux" case

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/9969080

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130784 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: a13283ccd0eef981bd92b5ba3b78c7d1b4a678f5
diff --git a/base/base.gypi b/base/base.gypi
index c1caecd..bc310e6 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -656,15 +656,17 @@
           # hence the *_android.cc files are included but the actual code
           # doesn't have OS_ANDROID / ANDROID defined.
           'conditions': [
+            # Host build on linux depends on system.gyp::gtk as
+            # default linux build has TOOLKIT_GTK defined.
             ['host_os == "linux"', {
               'sources/': [
                 ['include', '^atomicops_internals_x86_gcc\\.cc$'],
               ],
               'dependencies': [
-                '../build/linux/system.gyp:glib',
+                '../build/linux/system.gyp:gtk',
               ],
               'export_dependent_settings': [
-                '../build/linux/system.gyp:glib',
+                '../build/linux/system.gyp:gtk',
               ],
             }],
             ['host_os == "mac"', {
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc
index 779ac33..29a2a88 100644
--- a/base/i18n/rtl.cc
+++ b/base/i18n/rtl.cc
@@ -14,7 +14,7 @@
 #include "unicode/uchar.h"
 #include "unicode/uscript.h"
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@ -100,15 +100,6 @@
   // it does not hurt to have it as a sanity check.
   DCHECK(U_SUCCESS(error_code));
   g_icu_text_direction = UNKNOWN_DIRECTION;
-
-  // If we use Views toolkit on top of GtkWidget, then we need to keep
-  // GtkWidget's default text direction consistent with ICU's text direction.
-  // Because in this case ICU's text direction will be used instead.
-  // See IsRTL() function below.
-#if defined(TOOLKIT_USES_GTK) && !defined(TOOLKIT_GTK)
-  gtk_widget_set_default_direction(
-      ICUIsRTL() ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
-#endif
 }
 
 bool IsRTL() {
diff --git a/base/message_loop.cc b/base/message_loop.cc
index cc7faa3..f60bf69 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -30,10 +30,11 @@
 #if defined(OS_ANDROID)
 #include "base/message_pump_android.h"
 #endif
-#if defined(TOOLKIT_USES_GTK)
+
+#if defined(TOOLKIT_GTK)
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
-#endif  // defined(OS_POSIX) && !defined(OS_MACOSX)
+#endif
 
 using base::PendingTask;
 using base::TimeDelta;
diff --git a/base/message_pump_glib_unittest.cc b/base/message_pump_glib_unittest.cc
index 550c0e7..f3df012 100644
--- a/base/message_pump_glib_unittest.cc
+++ b/base/message_pump_glib_unittest.cc
@@ -17,7 +17,7 @@
 #include "base/threading/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@ -407,7 +407,7 @@
 
 namespace {
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 void AddEventsAndDrainGtk(EventInjector* injector) {
   // Add a couple of dummy events
   injector->AddDummyEvent(0);
@@ -428,7 +428,7 @@
 
 }  // namespace
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 TEST_F(MessagePumpGLibTest, TestDrainingGtk) {
   // Tests that draining events using Gtk works.
   loop()->PostTask(
@@ -454,7 +454,7 @@
   }
 
   void RunLoop() {
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
     while (!quit_) {
       gtk_main_iteration();
     }
diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc
index 6cd5945..030c30c 100644
--- a/base/nix/mime_util_xdg.cc
+++ b/base/nix/mime_util_xdg.cc
@@ -23,7 +23,7 @@
 #include "base/threading/thread_restrictions.h"
 #include "base/time.h"
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 #include <gtk/gtk.h>  // NOLINT
 
 #include "base/message_loop.h"
@@ -67,7 +67,7 @@
 
   base::TimeTicks last_check_time_;
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
   // This is set by DetectGtkTheme(). We cache it so that we can access the
   // theme name from threads that aren't allowed to call
   // gtk_settings_get_default().
@@ -536,7 +536,7 @@
     default_themes[1] = IconTheme::LoadTheme(kde_default_theme);
     default_themes[2] = IconTheme::LoadTheme(kde_fallback_theme);
   } else {
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
     // Assume it's Gnome and use GTK to figure out the theme.
     default_themes[1] = IconTheme::LoadTheme(
         MimeUtilConstants::GetInstance()->gtk_theme_name_);
@@ -599,7 +599,7 @@
   return xdg_mime_get_mime_type_for_data(data.data(), data.length(), NULL);
 }
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 void DetectGtkTheme() {
   // If the theme name is already loaded, do nothing. Chrome doesn't respond
   // to changes in the system theme, so we never need to set this more than
diff --git a/base/nix/mime_util_xdg.h b/base/nix/mime_util_xdg.h
index 94a6c06..e7d4046 100644
--- a/base/nix/mime_util_xdg.h
+++ b/base/nix/mime_util_xdg.h
@@ -25,7 +25,7 @@
 // Get the mime type for a byte vector.
 BASE_EXPORT std::string GetDataMimeType(const std::string& data);
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 // This detects the current GTK theme by calling gtk_settings_get_default().
 // It should only be executed on the UI thread and must be called before
 // GetMimeIcon().
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 3416cd1..7df146f 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -31,7 +31,7 @@
 #include "base/test/test_stub_android.h"
 #endif
 
-#if defined(TOOLKIT_USES_GTK)
+#if defined(TOOLKIT_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@ -98,9 +98,9 @@
   // have the locale set. In the absence of such a call the "C" locale is the
   // default. In the gtk code (below) gtk_init() implicitly sets a locale.
   setlocale(LC_ALL, "");
-#elif defined(TOOLKIT_USES_GTK)
+#elif defined(TOOLKIT_GTK)
   gtk_init_check(&argc, &argv);
-#endif  // defined(TOOLKIT_USES_GTK)
+#endif  // defined(TOOLKIT_GTK)
   if (create_at_exit_manager)
     at_exit_manager_.reset(new base::AtExitManager);