OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 442 |
443 gint cursor_blink_time = kGtkDefaultCursorBlinkTime; | 443 gint cursor_blink_time = kGtkDefaultCursorBlinkTime; |
444 gboolean cursor_blink = TRUE; | 444 gboolean cursor_blink = TRUE; |
445 g_object_get(gtk_settings_get_default(), | 445 g_object_get(gtk_settings_get_default(), |
446 "gtk-cursor-blink-time", &cursor_blink_time, | 446 "gtk-cursor-blink-time", &cursor_blink_time, |
447 "gtk-cursor-blink", &cursor_blink, | 447 "gtk-cursor-blink", &cursor_blink, |
448 NULL); | 448 NULL); |
449 return cursor_blink ? (cursor_blink_time / kGtkCursorBlinkCycleFactor) : 0.0; | 449 return cursor_blink ? (cursor_blink_time / kGtkCursorBlinkCycleFactor) : 0.0; |
450 } | 450 } |
451 | 451 |
452 ui::NativeTheme* Gtk2UI::GetNativeTheme() const { | 452 ui::NativeTheme* Gtk2UI::GetNativeTheme(aura::Window* window) const { |
| 453 ui::NativeTheme* native_theme_override = NULL; |
| 454 if (!native_theme_overrider_.is_null()) |
| 455 native_theme_override = native_theme_overrider_.Run(window); |
| 456 |
| 457 if (native_theme_override) |
| 458 return native_theme_override; |
| 459 |
453 return NativeThemeGtk2::instance(); | 460 return NativeThemeGtk2::instance(); |
454 } | 461 } |
455 | 462 |
| 463 void Gtk2UI::SetNativeThemeOverride(const NativeThemeGetter& callback) { |
| 464 native_theme_overrider_ = callback; |
| 465 } |
| 466 |
456 bool Gtk2UI::GetDefaultUsesSystemTheme() const { | 467 bool Gtk2UI::GetDefaultUsesSystemTheme() const { |
457 scoped_ptr<base::Environment> env(base::Environment::Create()); | 468 scoped_ptr<base::Environment> env(base::Environment::Create()); |
458 | 469 |
459 switch (base::nix::GetDesktopEnvironment(env.get())) { | 470 switch (base::nix::GetDesktopEnvironment(env.get())) { |
460 case base::nix::DESKTOP_ENVIRONMENT_GNOME: | 471 case base::nix::DESKTOP_ENVIRONMENT_GNOME: |
461 case base::nix::DESKTOP_ENVIRONMENT_UNITY: | 472 case base::nix::DESKTOP_ENVIRONMENT_UNITY: |
462 case base::nix::DESKTOP_ENVIRONMENT_XFCE: | 473 case base::nix::DESKTOP_ENVIRONMENT_XFCE: |
463 return true; | 474 return true; |
464 case base::nix::DESKTOP_ENVIRONMENT_KDE3: | 475 case base::nix::DESKTOP_ENVIRONMENT_KDE3: |
465 case base::nix::DESKTOP_ENVIRONMENT_KDE4: | 476 case base::nix::DESKTOP_ENVIRONMENT_KDE4: |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 | 1391 |
1381 FOR_EACH_OBSERVER(views::NativeThemeChangeObserver, theme_change_observers_, | 1392 FOR_EACH_OBSERVER(views::NativeThemeChangeObserver, theme_change_observers_, |
1382 OnNativeThemeChanged()); | 1393 OnNativeThemeChanged()); |
1383 } | 1394 } |
1384 | 1395 |
1385 } // namespace libgtk2ui | 1396 } // namespace libgtk2ui |
1386 | 1397 |
1387 views::LinuxUI* BuildGtk2UI() { | 1398 views::LinuxUI* BuildGtk2UI() { |
1388 return new libgtk2ui::Gtk2UI; | 1399 return new libgtk2ui::Gtk2UI; |
1389 } | 1400 } |
OLD | NEW |