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

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_border.cc

Issue 145033006: views: Make View::set_border() take a scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_border.h ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_border.h" 5 #include "chrome/browser/ui/libgtk2ui/gtk2_border.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" 9 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE { 44 virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE {
45 int w = size_.width() * scale; 45 int w = size_.width() * scale;
46 int h = size_.height() * scale; 46 int h = size_.height() * scale;
47 return gfx::ImageSkiaRep( 47 return gfx::ImageSkiaRep(
48 gtk2_ui_->DrawGtkButtonBorder(state_, w, h), scale); 48 gtk2_ui_->DrawGtkButtonBorder(state_, w, h), scale);
49 } 49 }
50 50
51 private: 51 private:
52 const Gtk2UI* gtk2_ui_; 52 const Gtk2UI* gtk2_ui_;
53 GtkStateType state_; 53 const GtkStateType state_;
54 gfx::Size size_; 54 const gfx::Size size_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(ButtonImageSkiaSource); 56 DISALLOW_COPY_AND_ASSIGN(ButtonImageSkiaSource);
57 }; 57 };
58 58
59 } // namespace 59 } // namespace
60 60
61 Gtk2Border::Gtk2Border(Gtk2UI* gtk2_ui, 61 Gtk2Border::Gtk2Border(Gtk2UI* gtk2_ui,
62 views::CustomButton* owning_button, 62 views::CustomButton* owning_button,
63 views::Border* border) 63 scoped_ptr<views::Border> border)
64 : gtk2_ui_(gtk2_ui), 64 : gtk2_ui_(gtk2_ui),
65 use_gtk_(gtk2_ui_->GetUseSystemTheme()), 65 use_gtk_(gtk2_ui_->GetUseSystemTheme()),
66 owning_button_(owning_button), 66 owning_button_(owning_button),
67 border_(border) { 67 border_(border.Pass()) {
68 gtk2_ui_->AddGtkBorder(this); 68 gtk2_ui_->AddGtkBorder(this);
69 } 69 }
70 70
71 Gtk2Border::~Gtk2Border() { 71 Gtk2Border::~Gtk2Border() {
72 gtk2_ui_->RemoveGtkBorder(this); 72 gtk2_ui_->RemoveGtkBorder(this);
73 } 73 }
74 74
75 void Gtk2Border::InvalidateAndSetUsesGtk(bool use_gtk) { 75 void Gtk2Border::InvalidateAndSetUsesGtk(bool use_gtk) {
76 hovered_ = gfx::ImageSkia(); 76 hovered_ = gfx::ImageSkia();
77 pressed_ = gfx::ImageSkia(); 77 pressed_ = gfx::ImageSkia();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 gfx::Size Gtk2Border::GetMinimumSize() const { 119 gfx::Size Gtk2Border::GetMinimumSize() const {
120 if (!use_gtk_) 120 if (!use_gtk_)
121 return border_->GetMinimumSize(); 121 return border_->GetMinimumSize();
122 122
123 gfx::Insets insets = GetInsets(); 123 gfx::Insets insets = GetInsets();
124 return gfx::Size(insets.width(), insets.height()); 124 return gfx::Size(insets.width(), insets.height());
125 } 125 }
126 126
127 } // namespace libgtk2ui 127 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_border.h ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698