Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/browser/ui/libgtkui/gtk_ui.cc

Issue 2637383003: Change Painter factory functions to unique_ptr (Closed)
Patch Set: msw review Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/libgtkui/gtk_ui.h" 5 #include "chrome/browser/ui/libgtkui/gtk_ui.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <pango/pango.h> 8 #include <pango/pango.h>
9 #include <X11/Xcursor/Xcursor.h> 9 #include <X11/Xcursor/Xcursor.h>
10 10
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 { 680 {
681 "IDR_BUTTON_DISABLED", "IDR_BLUE_BUTTON_DISABLED", true, 681 "IDR_BUTTON_DISABLED", "IDR_BLUE_BUTTON_DISABLED", true,
682 views::Button::STATE_DISABLED, 682 views::Button::STATE_DISABLED,
683 }, 683 },
684 }; 684 };
685 685
686 bool is_blue = 686 bool is_blue =
687 owning_button->GetClassName() == views::BlueButton::kViewClassName; 687 owning_button->GetClassName() == views::BlueButton::kViewClassName;
688 688
689 for (unsigned i = 0; i < arraysize(paintstate); i++) { 689 for (unsigned i = 0; i < arraysize(paintstate); i++) {
690 views::Painter* painter = nullptr;
691
692 if (border->PaintsButtonState(paintstate[i].focus, paintstate[i].state)) { 690 if (border->PaintsButtonState(paintstate[i].focus, paintstate[i].state)) {
693 std::string idr = is_blue ? paintstate[i].idr_blue : paintstate[i].idr; 691 std::string idr = is_blue ? paintstate[i].idr_blue : paintstate[i].idr;
694 painter = new GtkButtonPainter(idr); 692 gtk_border->SetPainter(paintstate[i].focus, paintstate[i].state,
693 base::MakeUnique<GtkButtonPainter>(idr));
695 } 694 }
696
697 gtk_border->SetPainter(paintstate[i].focus, paintstate[i].state, painter);
698 } 695 }
699 696
700 return std::move(gtk_border); 697 return gtk_border;
701 } 698 }
702 699
703 void GtkUi::AddWindowButtonOrderObserver( 700 void GtkUi::AddWindowButtonOrderObserver(
704 views::WindowButtonOrderObserver* observer) { 701 views::WindowButtonOrderObserver* observer) {
705 if (!leading_buttons_.empty() || !trailing_buttons_.empty()) { 702 if (!leading_buttons_.empty() || !trailing_buttons_.empty()) {
706 observer->OnWindowButtonOrderingChange(leading_buttons_, trailing_buttons_); 703 observer->OnWindowButtonOrderingChange(leading_buttons_, trailing_buttons_);
707 } 704 }
708 705
709 observer_list_.AddObserver(observer); 706 observer_list_.AddObserver(observer);
710 } 707 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 1050
1054 float GtkUi::GetDeviceScaleFactor() const { 1051 float GtkUi::GetDeviceScaleFactor() const {
1055 return device_scale_factor_; 1052 return device_scale_factor_;
1056 } 1053 }
1057 1054
1058 } // namespace libgtkui 1055 } // namespace libgtkui
1059 1056
1060 views::LinuxUI* BuildGtkUi() { 1057 views::LinuxUI* BuildGtkUi() {
1061 return new libgtkui::GtkUi; 1058 return new libgtkui::GtkUi;
1062 } 1059 }
OLDNEW
« no previous file with comments | « ash/common/wm/workspace/phantom_window_controller.cc ('k') | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698