summaryrefslogtreecommitdiffstats
path: root/views/controls/link.cc
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 17:30:23 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 17:30:23 +0000
commit5168c72cdf678fe73cb6cca42330c9398355ed68 (patch)
tree571819bf8181ecd971059d8d768c1a47b68527a6 /views/controls/link.cc
parent39f8389fea86381271c2966ca17f947ec4e8dcb6 (diff)
downloadchromium_src-5168c72cdf678fe73cb6cca42330c9398355ed68.zip
chromium_src-5168c72cdf678fe73cb6cca42330c9398355ed68.tar.gz
chromium_src-5168c72cdf678fe73cb6cca42330c9398355ed68.tar.bz2
views: Move LinkController into its own header file.
While I'm here, did some changes: - Rename the LinkController interface to LinkListener. - Move the interface to link_listener.h - Rename the event from LinkActivated to LinkClicked. - Changed the get/set accessors to listener()/set_listener(). - Add OVERRIDE to LinkClicked methods. BUG=None TEST=None R=sky@chromium.org Review URL: http://codereview.chromium.org/6881099 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82885 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/link.cc')
-rw-r--r--views/controls/link.cc23
1 files changed, 9 insertions, 14 deletions
diff --git a/views/controls/link.cc b/views/controls/link.cc
index 0112952..fbb1c9b 100644
--- a/views/controls/link.cc
+++ b/views/controls/link.cc
@@ -4,6 +4,8 @@
#include "views/controls/link.h"
+#include "build/build_config.h"
+
#if defined(OS_LINUX)
#include <gdk/gdk.h>
#endif
@@ -13,6 +15,7 @@
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/font.h"
+#include "views/controls/link_listener.h"
#include "views/events/event.h"
#if defined(OS_LINUX)
@@ -67,14 +70,14 @@ static HCURSOR g_hand_cursor = NULL;
const char Link::kViewClassName[] = "views/Link";
Link::Link() : Label(L""),
- controller_(NULL),
+ listener_(NULL),
highlighted_(false) {
Init();
SetFocusable(true);
}
Link::Link(const std::wstring& title) : Label(title),
- controller_(NULL),
+ listener_(NULL),
highlighted_(false) {
Init();
SetFocusable(true);
@@ -89,14 +92,6 @@ void Link::Init() {
Link::~Link() {
}
-void Link::SetController(LinkController* controller) {
- controller_ = controller;
-}
-
-const LinkController* Link::GetController() {
- return controller_;
-}
-
bool Link::OnMousePressed(const MouseEvent& event) {
if (!enabled_ || (!event.IsLeftMouseButton() && !event.IsMiddleMouseButton()))
return false;
@@ -120,8 +115,8 @@ void Link::OnMouseReleased(const MouseEvent& event) {
// Focus the link on click.
RequestFocus();
- if (controller_)
- controller_->LinkActivated(this, event.flags());
+ if (listener_)
+ listener_->LinkClicked(this, event.flags());
}
}
@@ -140,8 +135,8 @@ bool Link::OnKeyPressed(const KeyEvent& event) {
// Focus the link on key pressed.
RequestFocus();
- if (controller_)
- controller_->LinkActivated(this, event.flags());
+ if (listener_)
+ listener_->LinkClicked(this, event.flags());
return true;
}