| 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/environment.h" |
| 10 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/nix/mime_util_xdg.h" | 13 #include "base/nix/mime_util_xdg.h" |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 #include "chrome/browser/themes/theme_properties.h" | 15 #include "chrome/browser/themes/theme_properties.h" |
| 15 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h" | 16 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h" |
| 16 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" | 17 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" |
| 17 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h" | 18 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h" |
| 18 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h" | 19 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h" |
| 19 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" | 20 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 bool Gtk2UI::GetColor(int id, SkColor* color) const { | 336 bool Gtk2UI::GetColor(int id, SkColor* color) const { |
| 336 ColorMap::const_iterator it = colors_.find(id); | 337 ColorMap::const_iterator it = colors_.find(id); |
| 337 if (it != colors_.end()) { | 338 if (it != colors_.end()) { |
| 338 *color = it->second; | 339 *color = it->second; |
| 339 return true; | 340 return true; |
| 340 } | 341 } |
| 341 | 342 |
| 342 return false; | 343 return false; |
| 343 } | 344 } |
| 344 | 345 |
| 346 bool Gtk2UI::HasCustomImage(int id) const { |
| 347 return IsOverridableImage(id); |
| 348 } |
| 349 |
| 345 ui::NativeTheme* Gtk2UI::GetNativeTheme() const { | 350 ui::NativeTheme* Gtk2UI::GetNativeTheme() const { |
| 346 return NativeThemeGtk2::instance(); | 351 return NativeThemeGtk2::instance(); |
| 347 } | 352 } |
| 348 | 353 |
| 354 bool Gtk2UI::GetDefaultUsesSystemTheme() const { |
| 355 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 356 |
| 357 switch (base::nix::GetDesktopEnvironment(env.get())) { |
| 358 case base::nix::DESKTOP_ENVIRONMENT_GNOME: |
| 359 case base::nix::DESKTOP_ENVIRONMENT_UNITY: |
| 360 case base::nix::DESKTOP_ENVIRONMENT_XFCE: |
| 361 return true; |
| 362 case base::nix::DESKTOP_ENVIRONMENT_KDE3: |
| 363 case base::nix::DESKTOP_ENVIRONMENT_KDE4: |
| 364 case base::nix::DESKTOP_ENVIRONMENT_OTHER: |
| 365 return false; |
| 366 } |
| 367 // Unless GetDesktopEnvironment() badly misbehaves, this should never happen. |
| 368 NOTREACHED(); |
| 369 return false; |
| 370 } |
| 371 |
| 349 ui::SelectFileDialog* Gtk2UI::CreateSelectFileDialog( | 372 ui::SelectFileDialog* Gtk2UI::CreateSelectFileDialog( |
| 350 ui::SelectFileDialog::Listener* listener, | 373 ui::SelectFileDialog::Listener* listener, |
| 351 ui::SelectFilePolicy* policy) const { | 374 ui::SelectFilePolicy* policy) const { |
| 352 return SelectFileDialogImpl::Create(listener, policy); | 375 return SelectFileDialogImpl::Create(listener, policy); |
| 353 } | 376 } |
| 354 | 377 |
| 355 void Gtk2UI::GetScrollbarColors(GdkColor* thumb_active_color, | 378 void Gtk2UI::GetScrollbarColors(GdkColor* thumb_active_color, |
| 356 GdkColor* thumb_inactive_color, | 379 GdkColor* thumb_inactive_color, |
| 357 GdkColor* track_color) { | 380 GdkColor* track_color) { |
| 358 const GdkColor* theme_thumb_active = NULL; | 381 const GdkColor* theme_thumb_active = NULL; |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 | 1003 |
| 981 void Gtk2UI::ClearAllThemeData() { | 1004 void Gtk2UI::ClearAllThemeData() { |
| 982 gtk_images_.clear(); | 1005 gtk_images_.clear(); |
| 983 } | 1006 } |
| 984 | 1007 |
| 985 } // namespace libgtk2ui | 1008 } // namespace libgtk2ui |
| 986 | 1009 |
| 987 ui::LinuxUI* BuildGtk2UI() { | 1010 ui::LinuxUI* BuildGtk2UI() { |
| 988 return new libgtk2ui::Gtk2UI; | 1011 return new libgtk2ui::Gtk2UI; |
| 989 } | 1012 } |
| OLD | NEW |