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

Unified Diff: chrome/browser/chromeos/login/username_view.cc

Issue 5966008: Show hand cursor only on small user pods and labels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
Index: chrome/browser/chromeos/login/username_view.cc
diff --git a/chrome/browser/chromeos/login/username_view.cc b/chrome/browser/chromeos/login/username_view.cc
index 5aead72e5af7846d83e79f7fbbd550410e1d8c5e..78bbd5c41fac081dc655fc8918253b01066c51bd 100644
--- a/chrome/browser/chromeos/login/username_view.cc
+++ b/chrome/browser/chromeos/login/username_view.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/chromeos/login/rounded_view.h"
#include "gfx/canvas.h"
#include "gfx/canvas_skia.h"
+#include "gfx/gtk_util.h"
#include "gfx/rect.h"
#include "third_party/skia/include/core/SkColorShader.h"
#include "third_party/skia/include/core/SkComposeShader.h"
@@ -31,13 +32,14 @@ template<typename C>
class HalfRoundedView : public RoundedView<C> {
public:
HalfRoundedView(const std::wstring &text, bool use_small_shape)
- : RoundedView<C>(text), use_small_shape_(use_small_shape) {
+ : RoundedView<C>(text) {
+ C::set_use_small_shape(use_small_shape);
Dmitry Polukhin 2010/12/27 08:25:06 I would prefer passing this in constructor as argu
glotov 2010/12/30 15:54:52 I would prefer this too, but to do that I need to
Dmitry Polukhin 2011/01/11 10:14:07 I see the problem. Let's keep it as is. There is n
glotov 2011/01/11 12:49:14 Yes, I just added RoundedView<C>(val1, val2) : C(v
}
protected:
// Overrides ViewFilter.
virtual SkPath GetClipPath() const {
- if (!use_small_shape_) {
+ if (!C::get_use_small_shape()) {
return RoundedView<C>::GetClipPath();
} else {
SkPath path;
@@ -66,10 +68,6 @@ class HalfRoundedView : public RoundedView<C> {
this->y() + this->height());
return view_rect;
}
-
- private:
- // Whether the shape for the smaller view should be used.
- bool use_small_shape_;
};
} // namespace
@@ -94,6 +92,13 @@ UsernameView* UsernameView::CreateShapedUsernameView(
return new HalfRoundedView<UsernameView>(username, use_small_shape);
}
+gfx::NativeCursor UsernameView::GetCursorForPoint(
+ views::Event::EventType event_type,
+ const gfx::Point& p) {
+
+ return use_small_shape_ ? gfx::GetCursor(GDK_HAND2) : NULL;
+}
+
void UsernameView::PaintUsername(const gfx::Rect& bounds) {
margin_width_ = bounds.height() * kMarginRatio;
gfx::CanvasSkia canvas(bounds.width(), bounds.height(), false);

Powered by Google App Engine
This is Rietveld 408576698