Skip to content

Commit

Permalink
Remove TOOLKIT_USES_GTK and consolidate it into TOOLKIT_GTK
Browse files Browse the repository at this point in the history
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
  • Loading branch information
oshima@chromium.org committed Apr 5, 2012
1 parent b09be0a commit a13283c
Show file tree
Hide file tree
Showing 111 changed files with 243 additions and 296 deletions.
6 changes: 4 additions & 2 deletions base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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"', {
Expand Down
11 changes: 1 addition & 10 deletions base/i18n/rtl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -100,15 +100,6 @@ void SetICUDefaultLocale(const std::string& locale_string) {
// 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() {
Expand Down
5 changes: 3 additions & 2 deletions base/message_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions base/message_pump_glib_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -407,7 +407,7 @@ TEST_F(MessagePumpGLibTest, TestDrainingGLib) {

namespace {

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
void AddEventsAndDrainGtk(EventInjector* injector) {
// Add a couple of dummy events
injector->AddDummyEvent(0);
Expand All @@ -428,7 +428,7 @@ void AddEventsAndDrainGtk(EventInjector* injector) {

} // namespace

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
TEST_F(MessagePumpGLibTest, TestDrainingGtk) {
// Tests that draining events using Gtk works.
loop()->PostTask(
Expand All @@ -454,7 +454,7 @@ class GLibLoopRunner : public base::RefCounted<GLibLoopRunner> {
}

void RunLoop() {
#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
while (!quit_) {
gtk_main_iteration();
}
Expand Down
8 changes: 4 additions & 4 deletions base/nix/mime_util_xdg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -67,7 +67,7 @@ class MimeUtilConstants {

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().
Expand Down Expand Up @@ -536,7 +536,7 @@ void InitDefaultThemes() {
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_);
Expand Down Expand Up @@ -599,7 +599,7 @@ std::string GetDataMimeType(const std::string& data) {
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
Expand Down
2 changes: 1 addition & 1 deletion base/nix/mime_util_xdg.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath);
// 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().
Expand Down
6 changes: 3 additions & 3 deletions base/test/test_suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -98,9 +98,9 @@ void TestSuite::PreInitialize(int argc, char** argv,
// 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);

Expand Down
3 changes: 0 additions & 3 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1175,9 +1175,6 @@
['enable_one_click_signin==1', {
'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
}],
['toolkit_uses_gtk==1', {
'defines': ['TOOLKIT_USES_GTK=1'],
}],
['toolkit_uses_gtk==1 and toolkit_views==0', {
# TODO(erg): We are progressively sealing up use of deprecated features
# in gtk in preparation for an eventual porting to gtk3.
Expand Down
2 changes: 1 addition & 1 deletion chrome/app/chrome_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#include "chrome/browser/chromeos/boot_times_loader.h"
#endif

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
#include <gdk/gdk.h>
#include <glib.h>
#include <gtk/gtk.h>
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/browser_focus_uitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
#endif

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
#include "chrome/browser/ui/gtk/view_id_util.h"
#endif

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chrome_browser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
#include "ui/views/focus/accelerator_handler.h"
#endif

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "ui/gfx/gtk_util.h"
#endif
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/chrome_browser_main_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <asm/page.h> // for PAGE_SIZE needed by PTHREAD_STACK_MIN
#endif

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
#include "chrome/browser/chrome_browser_main_extra_parts_gtk.h"
#include "chrome/browser/printing/print_dialog_gtk.h"
#endif
Expand Down Expand Up @@ -268,7 +268,7 @@ void ChromeBrowserMainPartsPosix::PostMainMessageLoopStart() {
action.sa_handler = SIGHUPHandler;
CHECK(sigaction(SIGHUP, &action, NULL) == 0);

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
printing::PrintingContextGtk::SetCreatePrintDialogFunction(
&PrintDialogGtk::CreatePrintDialog);
#endif
Expand All @@ -285,7 +285,7 @@ void ChromeBrowserMainPartsPosix::ShowMissingLocaleMessageBox() {
#elif defined(OS_MACOSX)
// Not called on Mac because we load the locale files differently.
NOTREACHED();
#elif defined(TOOLKIT_USES_GTK)
#elif defined(TOOLKIT_GTK)
ChromeBrowserMainExtraPartsGtk::ShowMessageBox(
chrome_browser::kMissingLocaleDataMessage);
#elif defined(USE_AURA)
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
#include "chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.h"
#endif

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
#include "chrome/browser/chrome_browser_main_extra_parts_gtk.h"
#endif

Expand Down Expand Up @@ -343,7 +343,7 @@ content::BrowserMainParts* ChromeContentBrowserClient::CreateBrowserMainParts(

// Construct additional browser parts. Stages are called in the order in
// which they are added.
#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
main_parts->AddParts(new ChromeBrowserMainExtraPartsGtk());
#endif

Expand Down
1 change: 0 additions & 1 deletion chrome/browser/chromeos/chrome_browser_main_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() {
chromeos::input_method::InputMethodManager::GetInstance()->
GetXKeyboard()->SetNumLockEnabled(true);
#endif

initial_browser_window_observer_.reset(
new chromeos::InitialBrowserWindowObserver);
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/defaults.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const bool kOSSupportsOtherBrowsers = false;
const bool kOSSupportsOtherBrowsers = true;
#endif

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
const bool kShowCancelButtonInTaskManager = true;
#else
const bool kShowCancelButtonInTaskManager = false;
Expand All @@ -36,7 +36,7 @@ const bool kSyncAutoStarts = true;
const bool kShowOtherBrowsersInAboutMemory = false;
const bool kAlwaysOpenIncognitoWindow = true;

#elif defined(TOOLKIT_USES_GTK)
#elif defined(TOOLKIT_GTK)

// 14px = 10.5pt @ 96dpi.
const int kAutocompleteEditFontPixelSize = 14;
Expand Down
13 changes: 3 additions & 10 deletions chrome/browser/download/download_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,15 @@
#if defined(TOOLKIT_VIEWS)
#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#if !defined(TOOLKIT_USES_GTK)
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
#endif
#endif

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_VIEWS)
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/views/widget/native_widget_gtk.h"
#elif defined(TOOLKIT_GTK)
#if defined(TOOLKIT_GTK)
#include "chrome/browser/ui/gtk/custom_drag.h"
#include "chrome/browser/ui/gtk/unity_service.h"
#endif // defined(TOOLKIT_GTK)
#endif // defined(TOOLKIT_USES_GTK)

#if defined(OS_WIN) && !defined(USE_AURA)
#include "base/win/scoped_comptr.h"
Expand Down Expand Up @@ -396,7 +389,7 @@ void DragDownload(const DownloadItem* download,
download->GetFileNameToReportUser().LossyDisplayName());
}

#if !defined(TOOLKIT_USES_GTK)
#if !defined(TOOLKIT_GTK)
views::Widget* widget = views::Widget::GetWidgetForNativeView(view);
// TODO(varunjain): Widget should not be NULL here. But its causing the crash
// in http://code.google.com/p/chromium/issues/detail?id=120430 Find out why.
Expand All @@ -421,7 +414,7 @@ void DragDownload(const DownloadItem* download,

widget->DoDrag(data,
ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK);
#endif // TOOLKIT_USES_GTK
#endif // TOOLKIT_GTK
}
#elif defined(USE_X11)
void DragDownload(const DownloadItem* download,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/extension_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void ExtensionHost::CreateView(Browser* browser) {
#elif defined(OS_MACOSX)
view_.reset(new ExtensionViewMac(this, browser));
view_->Init();
#elif defined(TOOLKIT_USES_GTK)
#elif defined(TOOLKIT_GTK)
view_.reset(new ExtensionViewGtk(this, browser));
view_->Init();
#else
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/icon_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "content/public/browser/browser_thread.h"
#include "third_party/skia/include/core/SkBitmap.h"

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
#include "base/nix/mime_util_xdg.h"
#endif

Expand All @@ -30,7 +30,7 @@ IconLoader::~IconLoader() {
void IconLoader::Start() {
target_message_loop_ = base::MessageLoopProxy::current();

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
// This call must happen on the UI thread before we can start loading icons.
base::nix::DetectGtkTheme();
#endif
Expand Down
4 changes: 0 additions & 4 deletions chrome/browser/icon_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
#include "base/message_loop_proxy.h"
#include "ui/gfx/image/image.h"

#if defined(TOOLKIT_USES_GTK)
#include "base/file_path.h"
#endif

#if defined(OS_WIN)
// On Windows, we group files by their extension, with several exceptions:
// .dll, .exe, .ico. See IconManager.h for explanation.
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/jankometer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/browser_thread.h"

#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
#include "chrome/browser/ui/gtk/gtk_util.h"
#endif

Expand Down Expand Up @@ -339,7 +339,7 @@ class UIJankObserver : public base::RefCountedThreadSafe<UIJankObserver>,

virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
}
#elif defined(TOOLKIT_USES_GTK)
#elif defined(TOOLKIT_GTK)
virtual void WillProcessEvent(GdkEvent* event) {
if (!helper_.MessageWillBeMeasured())
return;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/notifications/balloon_collection_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class BalloonCollectionImpl : public BalloonCollection,
virtual base::EventStatus WillProcessEvent(
const base::NativeEvent& event) OVERRIDE;
virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
#elif defined(TOOLKIT_USES_GTK)
#elif defined(TOOLKIT_GTK)
virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
#endif
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/prefs/pref_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class PrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness {

// Set some (WebKit) user preferences.
TestingPrefService* pref_services = profile()->GetTestingPrefService();
#if defined(TOOLKIT_USES_GTK)
#if defined(TOOLKIT_GTK)
pref_services->SetUserPref(prefs::kUsesSystemTheme,
Value::CreateBooleanValue(false));
#endif
Expand Down
Loading

0 comments on commit a13283c

Please sign in to comment.