| 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 <math.h> | 7 #include <math.h> |
| 8 #include <pango/pango.h> |
| 8 #include <set> | 9 #include <set> |
| 9 | 10 #include <utility> |
| 10 #include <pango/pango.h> | |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/debug/leak_annotations.h" | 13 #include "base/debug/leak_annotations.h" |
| 14 #include "base/environment.h" | 14 #include "base/environment.h" |
| 15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/nix/mime_util_xdg.h" | 18 #include "base/nix/mime_util_xdg.h" |
| 19 #include "base/nix/xdg_util.h" | 19 #include "base/nix/xdg_util.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 image_skia.MakeThreadSafe(); | 721 image_skia.MakeThreadSafe(); |
| 722 return gfx::Image(image_skia); | 722 return gfx::Image(image_skia); |
| 723 } | 723 } |
| 724 return gfx::Image(); | 724 return gfx::Image(); |
| 725 } | 725 } |
| 726 | 726 |
| 727 scoped_ptr<views::Border> Gtk2UI::CreateNativeBorder( | 727 scoped_ptr<views::Border> Gtk2UI::CreateNativeBorder( |
| 728 views::LabelButton* owning_button, | 728 views::LabelButton* owning_button, |
| 729 scoped_ptr<views::LabelButtonBorder> border) { | 729 scoped_ptr<views::LabelButtonBorder> border) { |
| 730 if (owning_button->GetNativeTheme() != NativeThemeGtk2::instance()) | 730 if (owning_button->GetNativeTheme() != NativeThemeGtk2::instance()) |
| 731 return border.Pass(); | 731 return std::move(border); |
| 732 | 732 |
| 733 scoped_ptr<views::LabelButtonAssetBorder> gtk_border( | 733 scoped_ptr<views::LabelButtonAssetBorder> gtk_border( |
| 734 new views::LabelButtonAssetBorder(owning_button->style())); | 734 new views::LabelButtonAssetBorder(owning_button->style())); |
| 735 | 735 |
| 736 gtk_border->set_insets(border->GetInsets()); | 736 gtk_border->set_insets(border->GetInsets()); |
| 737 | 737 |
| 738 static struct { | 738 static struct { |
| 739 const char* idr; | 739 const char* idr; |
| 740 const char* idr_blue; | 740 const char* idr_blue; |
| 741 bool focus; | 741 bool focus; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 views::Painter* painter = nullptr; | 775 views::Painter* painter = nullptr; |
| 776 | 776 |
| 777 if (border->PaintsButtonState(paintstate[i].focus, paintstate[i].state)) { | 777 if (border->PaintsButtonState(paintstate[i].focus, paintstate[i].state)) { |
| 778 std::string idr = is_blue ? paintstate[i].idr_blue : paintstate[i].idr; | 778 std::string idr = is_blue ? paintstate[i].idr_blue : paintstate[i].idr; |
| 779 painter = new GtkButtonPainter(idr); | 779 painter = new GtkButtonPainter(idr); |
| 780 } | 780 } |
| 781 | 781 |
| 782 gtk_border->SetPainter(paintstate[i].focus, paintstate[i].state, painter); | 782 gtk_border->SetPainter(paintstate[i].focus, paintstate[i].state, painter); |
| 783 } | 783 } |
| 784 | 784 |
| 785 return gtk_border.Pass();; | 785 return std::move(gtk_border); |
| 786 ; |
| 786 } | 787 } |
| 787 | 788 |
| 788 void Gtk2UI::AddWindowButtonOrderObserver( | 789 void Gtk2UI::AddWindowButtonOrderObserver( |
| 789 views::WindowButtonOrderObserver* observer) { | 790 views::WindowButtonOrderObserver* observer) { |
| 790 if (!leading_buttons_.empty() || !trailing_buttons_.empty()) { | 791 if (!leading_buttons_.empty() || !trailing_buttons_.empty()) { |
| 791 observer->OnWindowButtonOrderingChange(leading_buttons_, | 792 observer->OnWindowButtonOrderingChange(leading_buttons_, |
| 792 trailing_buttons_); | 793 trailing_buttons_); |
| 793 } | 794 } |
| 794 | 795 |
| 795 observer_list_.AddObserver(observer); | 796 observer_list_.AddObserver(observer); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 const float rounded = roundf(scale * 10) / 10; | 1383 const float rounded = roundf(scale * 10) / 10; |
| 1383 // See crbug.com/484400 | 1384 // See crbug.com/484400 |
| 1384 return rounded < 1.3 ? 1.0 : rounded; | 1385 return rounded < 1.3 ? 1.0 : rounded; |
| 1385 } | 1386 } |
| 1386 | 1387 |
| 1387 } // namespace libgtk2ui | 1388 } // namespace libgtk2ui |
| 1388 | 1389 |
| 1389 views::LinuxUI* BuildGtk2UI() { | 1390 views::LinuxUI* BuildGtk2UI() { |
| 1390 return new libgtk2ui::Gtk2UI; | 1391 return new libgtk2ui::Gtk2UI; |
| 1391 } | 1392 } |
| OLD | NEW |