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

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_border.cc

Issue 298813002: views: Move MenuButton from TextButton to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable DragDirectlyToSecondWindow. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtk2ui/gtk2_border.cc
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_border.cc b/chrome/browser/ui/libgtk2ui/gtk2_border.cc
index 0863bcf3af094f6ae725d14f16d3a2ca4aaae51a..0859637fc3d94caee95431163c0bd4b7b7029ac2 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_border.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_border.cc
@@ -17,6 +17,7 @@
#include "ui/gfx/rect.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/controls/button/label_button.h"
+#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/native_theme_delegate.h"
using views::Button;
@@ -63,7 +64,7 @@ class ButtonImageSkiaSource : public gfx::ImageSkiaSource {
Gtk2Border::Gtk2Border(Gtk2UI* gtk2_ui,
views::LabelButton* owning_button,
- scoped_ptr<views::Border> border)
+ scoped_ptr<views::LabelButtonBorder> border)
: gtk2_ui_(gtk2_ui),
owning_button_(owning_button),
border_(border.Pass()),
@@ -132,7 +133,8 @@ void Gtk2Border::PaintState(const ui::NativeTheme::State state,
bool focused = extra.button.is_focused;
Button::ButtonState views_state = Button::GetButtonStateFrom(state);
- if (ShouldDrawBorder(focused, views_state)) {
+ if (border_->GetPainter(focused, views_state) ||
+ (focused && border_->GetPainter(false, views_state))) {
gfx::ImageSkia* image = &button_images_[focused][views_state];
if (image->isNull() || image->size() != rect.size()) {
@@ -145,17 +147,4 @@ void Gtk2Border::PaintState(const ui::NativeTheme::State state,
}
}
-bool Gtk2Border::ShouldDrawBorder(bool focused,
- views::Button::ButtonState state) {
- // This logic should be kept in sync with the LabelButtonBorder constructor.
- if (owning_button_->style() == Button::STYLE_BUTTON) {
- return true;
- } else if (owning_button_->style() == Button::STYLE_TEXTBUTTON) {
- return focused == false && (state == Button::STATE_HOVERED ||
- state == Button::STATE_PRESSED);
- }
-
- return false;
-}
-
} // namespace libgtk2ui
« 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