summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/login/eula_view.cc12
-rw-r--r--chrome/browser/chromeos/login/eula_view.h10
-rw-r--r--chrome/browser/chromeos/login/message_bubble.cc5
-rw-r--r--chrome/browser/chromeos/login/message_bubble.h10
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.cc9
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.h10
-rw-r--r--chrome/browser/chromeos/login/new_user_view.cc19
-rw-r--r--chrome/browser/chromeos/login/new_user_view.h9
-rw-r--r--chrome/browser/chromeos/login/user_view.cc7
-rw-r--r--chrome/browser/chromeos/login/user_view.h10
-rw-r--r--chrome/browser/external_tab_container_win.cc6
-rw-r--r--chrome/browser/first_run/try_chrome_dialog_view.cc7
-rw-r--r--chrome/browser/first_run/try_chrome_dialog_view.h10
-rw-r--r--chrome/browser/speech/speech_input_bubble_views.cc11
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc13
-rw-r--r--chrome/browser/ui/views/about_chrome_view.h11
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc21
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h12
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc39
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h8
-rw-r--r--chrome/browser/ui/views/content_setting_bubble_contents.cc13
-rw-r--r--chrome/browser/ui/views/content_setting_bubble_contents.h10
-rw-r--r--chrome/browser/ui/views/download/download_item_view.cc5
-rw-r--r--chrome/browser/ui/views/download/download_shelf_view.cc5
-rw-r--r--chrome/browser/ui/views/download/download_shelf_view.h10
-rw-r--r--chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc2
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.cc5
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.h29
-rw-r--r--chrome/browser/ui/views/infobars/confirm_infobar.cc3
-rw-r--r--chrome/browser/ui/views/infobars/confirm_infobar.h11
-rw-r--r--chrome/browser/ui/views/infobars/infobar_view.cc4
-rw-r--r--chrome/browser/ui/views/infobars/infobar_view.h4
-rw-r--r--chrome/browser/ui/views/infobars/link_infobar.cc4
-rw-r--r--chrome/browser/ui/views/infobars/link_infobar.h10
-rw-r--r--chrome/browser/ui/views/instant_confirm_view.cc5
-rw-r--r--chrome/browser/ui/views/instant_confirm_view.h15
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.cc17
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.h8
-rw-r--r--chrome/browser/ui/views/sad_tab_view.cc5
-rw-r--r--chrome/browser/ui/views/sad_tab_view.h10
-rw-r--r--chrome/browser/ui/views/task_manager_view.cc12
-rw-r--r--views/controls/link.cc23
-rw-r--r--views/controls/link.h22
-rw-r--r--views/controls/link_listener.h24
-rw-r--r--views/examples/link_example.cc5
-rw-r--r--views/examples/link_example.h8
-rw-r--r--views/views.gyp1
47 files changed, 278 insertions, 231 deletions
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc
index 80d2c5e..6201ac5 100644
--- a/chrome/browser/chromeos/login/eula_view.cc
+++ b/chrome/browser/chromeos/login/eula_view.cc
@@ -6,6 +6,7 @@
#include <signal.h>
#include <sys/types.h>
+
#include <string>
#include "base/basictypes.h"
@@ -40,6 +41,7 @@
#include "views/controls/button/checkbox.h"
#include "views/controls/button/native_button_gtk.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
#include "views/controls/throbber.h"
#include "views/events/event.h"
#include "views/layout/grid_layout.h"
@@ -49,8 +51,6 @@
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
-using views::WidgetGtk;
-
namespace {
const int kBorderSize = 10;
@@ -385,7 +385,7 @@ void EulaView::Init() {
layout->StartRow(0, SINGLE_LINK_WITH_SHIFT_ROW);
learn_more_link_ = new views::Link();
- learn_more_link_->SetController(this);
+ learn_more_link_->set_listener(this);
layout->AddView(learn_more_link_);
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
@@ -410,7 +410,7 @@ void EulaView::Init() {
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
layout->StartRow(0, LAST_ROW);
system_security_settings_link_ = new views::Link();
- system_security_settings_link_->SetController(this);
+ system_security_settings_link_->set_listener(this);
if (!chromeos::CrosLibrary::Get()->EnsureLoaded() ||
!chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()->
@@ -487,9 +487,9 @@ void EulaView::ButtonPressed(views::Button* sender, const views::Event& event) {
}
////////////////////////////////////////////////////////////////////////////////
-// views::LinkController implementation:
+// views::LinkListener implementation:
-void EulaView::LinkActivated(views::Link* source, int event_flags) {
+void EulaView::LinkClicked(views::Link* source, int event_flags) {
gfx::NativeWindow parent_window =
LoginUtils::Get()->GetBackgroundView()->GetNativeWindow();
if (source == learn_more_link_) {
diff --git a/chrome/browser/chromeos/login/eula_view.h b/chrome/browser/chromeos/login/eula_view.h
index dca2c84..7751dd1 100644
--- a/chrome/browser/chromeos/login/eula_view.h
+++ b/chrome/browser/chromeos/login/eula_view.h
@@ -6,13 +6,15 @@
#define CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/chromeos/login/message_bubble.h"
#include "chrome/browser/chromeos/login/view_screen.h"
#include "content/browser/tab_contents/tab_contents_delegate.h"
#include "ui/gfx/native_widget_types.h"
#include "views/controls/button/button.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
namespace views {
@@ -74,7 +76,7 @@ class EULATabContentsDelegate : public TabContentsDelegate {
class EulaView
: public views::View,
public views::ButtonListener,
- public views::LinkController,
+ public views::LinkListener,
public MessageBubbleDelegate,
public EULATabContentsDelegate {
public:
@@ -94,8 +96,8 @@ class EulaView
// views::ButtonListener implementation.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // views::LinkController implementation.
- void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener implementation.
+ void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
private:
// views::View implementation.
diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc
index ea4b4a2..e7a099c 100644
--- a/chrome/browser/chromeos/login/message_bubble.cc
+++ b/chrome/browser/chromeos/login/message_bubble.cc
@@ -12,6 +12,7 @@
#include "views/controls/button/image_button.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
#include "views/layout/grid_layout.h"
#include "views/widget/widget.h"
@@ -78,7 +79,7 @@ MessageBubble::MessageBubble(views::WidgetGtk::Type type,
if (!help.empty()) {
layout->StartRowWithPadding(0, 1, 0, kBorderSize);
help_link_ = new views::Link(help);
- help_link_->SetController(this);
+ help_link_->set_listener(this);
help_link_->SetNormalColor(login::kLinkColor);
help_link_->SetHighlightedColor(login::kLinkColor);
layout->AddView(help_link_);
@@ -94,7 +95,7 @@ void MessageBubble::ButtonPressed(views::Button* sender,
}
}
-void MessageBubble::LinkActivated(views::Link* source, int event_flags) {
+void MessageBubble::LinkClicked(views::Link* source, int event_flags) {
if (source == help_link_) {
if (message_delegate_)
message_delegate_->OnHelpLinkActivated();
diff --git a/chrome/browser/chromeos/login/message_bubble.h b/chrome/browser/chromeos/login/message_bubble.h
index c27c58b..0b22697 100644
--- a/chrome/browser/chromeos/login/message_bubble.h
+++ b/chrome/browser/chromeos/login/message_bubble.h
@@ -6,9 +6,11 @@
#define CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/ui/views/bubble/bubble.h"
#include "views/controls/button/button.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
#include "views/widget/widget_gtk.h"
@@ -31,7 +33,7 @@ class MessageBubbleDelegate : public BubbleDelegate {
// MessageBubble is used to show error and info messages on OOBE screens.
class MessageBubble : public Bubble,
public views::ButtonListener,
- public views::LinkController {
+ public views::LinkListener {
public:
// Create and show bubble. position_relative_to must be in screen coordinates.
static MessageBubble* Show(views::Widget* parent,
@@ -67,8 +69,8 @@ class MessageBubble : public Bubble,
virtual void ButtonPressed(views::Button* sender,
const views::Event& event);
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // Overridden from views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// Overridden from WidgetGtk.
virtual void IsActiveChanged();
diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc
index 9d6d1bc..6ce4fca 100644
--- a/chrome/browser/chromeos/login/network_selection_view.cc
+++ b/chrome/browser/chromeos/login/network_selection_view.cc
@@ -6,6 +6,7 @@
#include <signal.h>
#include <sys/types.h>
+
#include <string>
#include "base/utf_string_conversions.h"
@@ -23,6 +24,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/size.h"
+#include "views/controls/link.h"
#include "views/controls/label.h"
#include "views/controls/throbber.h"
#include "views/layout/fill_layout.h"
@@ -318,7 +320,7 @@ void NetworkSelectionView::Init() {
connecting_network_label_->SetVisible(false);
proxy_settings_link_ = new views::Link();
- proxy_settings_link_->SetController(this);
+ proxy_settings_link_->set_listener(this);
proxy_settings_link_->SetVisible(true);
proxy_settings_link_->SetFocusable(true);
proxy_settings_link_->SetNormalColor(login::kLinkColor);
@@ -440,9 +442,8 @@ bool NetworkSelectionView::IsContinueEnabled() const {
}
////////////////////////////////////////////////////////////////////////////////
-// views::LinkController implementation:
-
-void NetworkSelectionView::LinkActivated(views::Link* source, int) {
+// views::LinkListener implementation:
+void NetworkSelectionView::LinkClicked(views::Link* source, int) {
delegate_->ClearErrors();
if (source == proxy_settings_link_) {
if (!proxy_settings_dialog_.get()) {
diff --git a/chrome/browser/chromeos/login/network_selection_view.h b/chrome/browser/chromeos/login/network_selection_view.h
index 822c4a1..eac9574 100644
--- a/chrome/browser/chromeos/login/network_selection_view.h
+++ b/chrome/browser/chromeos/login/network_selection_view.h
@@ -6,11 +6,13 @@
#define CHROME_BROWSER_CHROMEOS_LOGIN_NETWORK_SELECTION_VIEW_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "chrome/browser/chromeos/login/login_html_dialog.h"
#include "chrome/browser/chromeos/views/dropdown_button.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
#include "views/widget/widget_gtk.h"
#include "views/window/window_delegate.h"
@@ -35,7 +37,7 @@ class ScreenObserver;
// View for the network selection/initial welcome screen.
class NetworkSelectionView : public views::View,
- public views::LinkController,
+ public views::LinkListener,
public LoginHtmlDialog::Delegate {
public:
explicit NetworkSelectionView(NetworkScreenDelegate* delegate);
@@ -65,8 +67,8 @@ class NetworkSelectionView : public views::View,
// Returns whether continue button is enabled.
bool IsContinueEnabled() const;
- // views::LinkController implementation.
- virtual void LinkActivated(views::Link* source, int);
+ // views::LinkListener implementation.
+ virtual void LinkClicked(views::Link* source, int) OVERRIDE;
// Returns true if any dialog box is currently open?
bool is_dialog_open() const {
diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc
index dc83324..bfd0685 100644
--- a/chrome/browser/chromeos/login/new_user_view.cc
+++ b/chrome/browser/chromeos/login/new_user_view.cc
@@ -34,6 +34,7 @@
#include "ui/gfx/font.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
#include "views/controls/textfield/textfield.h"
#include "views/controls/throbber.h"
#include "views/widget/widget_gtk.h"
@@ -462,14 +463,7 @@ void NewUserView::Login() {
delegate_->OnLogin(username, password);
}
-// Sign in button causes a login attempt.
-void NewUserView::ButtonPressed(views::Button* sender,
- const views::Event& event) {
- DCHECK(sender == sign_in_button_);
- Login();
-}
-
-void NewUserView::LinkActivated(views::Link* source, int event_flags) {
+void NewUserView::LinkClicked(views::Link* source, int event_flags) {
if (source == create_account_link_) {
delegate_->OnCreateAccount();
} else if (source == guest_link_) {
@@ -477,6 +471,13 @@ void NewUserView::LinkActivated(views::Link* source, int event_flags) {
}
}
+// Sign in button causes a login attempt.
+void NewUserView::ButtonPressed(views::Button* sender,
+ const views::Event& event) {
+ DCHECK(sender == sign_in_button_);
+ Login();
+}
+
void NewUserView::ClearAndFocusControls() {
login_in_process_ = false;
SetUsername(std::string());
@@ -565,7 +566,7 @@ bool NewUserView::NavigateAway() {
void NewUserView::InitLink(views::Link** link) {
*link = new views::Link(std::wstring());
- (*link)->SetController(this);
+ (*link)->set_listener(this);
(*link)->SetNormalColor(login::kLinkColor);
(*link)->SetHighlightedColor(login::kLinkColor);
AddChildView(*link);
diff --git a/chrome/browser/chromeos/login/new_user_view.h b/chrome/browser/chromeos/login/new_user_view.h
index 1cba9e7..d286189 100644
--- a/chrome/browser/chromeos/login/new_user_view.h
+++ b/chrome/browser/chromeos/login/new_user_view.h
@@ -14,7 +14,7 @@
#include "chrome/browser/chromeos/login/user_input.h"
#include "views/accelerator.h"
#include "views/controls/button/button.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
@@ -31,7 +31,7 @@ namespace chromeos {
class NewUserView : public ThrobberHostView,
public UserInput,
public views::TextfieldController,
- public views::LinkController,
+ public views::LinkListener,
public views::ButtonListener {
public:
// Delegate class to get notifications from the view.
@@ -97,11 +97,12 @@ class NewUserView : public ThrobberHostView,
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
+ // views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
+
// views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
// ThrobberHostView:
diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc
index 85ef9df..e20d660 100644
--- a/chrome/browser/chromeos/login/user_view.cc
+++ b/chrome/browser/chromeos/login/user_view.cc
@@ -22,6 +22,7 @@
#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/painter.h"
namespace {
@@ -66,7 +67,7 @@ using login::kUserImageSize;
// The view that shows the Sign out button below the user's image.
class SignoutView : public views::View {
public:
- explicit SignoutView(views::LinkController* link_controller) {
+ explicit SignoutView(views::LinkListener* link_listener) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Font& font = rb.GetFont(ResourceBundle::SmallFont);
@@ -77,7 +78,7 @@ class SignoutView : public views::View {
signout_link_ = new views::Link(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_SIGN_OUT)));
- signout_link_->SetController(link_controller);
+ signout_link_->set_listener(link_listener);
signout_link_->SetFont(font);
signout_link_->SetColor(kTextColor);
signout_link_->SetFocusable(true);
@@ -321,7 +322,7 @@ void UserView::SetSignoutEnabled(bool enabled) {
Layout();
}
-void UserView::LinkActivated(views::Link* source, int event_flags) {
+void UserView::LinkClicked(views::Link* source, int event_flags) {
DCHECK(delegate_);
DCHECK(signout_view_);
if (signout_view_->signout_link() == source)
diff --git a/chrome/browser/chromeos/login/user_view.h b/chrome/browser/chromeos/login/user_view.h
index d95b849..9afa8ab 100644
--- a/chrome/browser/chromeos/login/user_view.h
+++ b/chrome/browser/chromeos/login/user_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,7 @@
#include <string>
#include "views/controls/button/button.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
class SkBitmap;
@@ -26,7 +26,7 @@ class SignoutView;
class PodImageView;
class UserView : public views::View,
- public views::LinkController,
+ public views::LinkListener,
public views::ButtonListener {
public:
class Delegate {
@@ -71,9 +71,9 @@ class UserView : public views::View,
// Enable/Disable sign-out button.
void SetSignoutEnabled(bool enabled);
- // Implements LinkController.
+ // Implements views::LinkListener.
// Called when a signout link is clicked.
- virtual void LinkActivated(views::Link* source, int event_flags);
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// Overridden from views::ButtonListener.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 59950d1..bba5e8e 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -54,7 +54,7 @@ using ui::ViewProp;
static const char kWindowObjectKey[] = "ChromeWindowObject";
-// This class overrides the LinkActivated function in the PageInfoBubbleView
+// This class overrides the LinkClicked function in the PageInfoBubbleView
// class and routes the help center link navigation to the host browser.
class ExternalTabPageInfoBubbleView : public PageInfoBubbleView {
public:
@@ -71,8 +71,8 @@ class ExternalTabPageInfoBubbleView : public PageInfoBubbleView {
virtual ~ExternalTabPageInfoBubbleView() {
DVLOG(1) << __FUNCTION__;
}
- // LinkController methods:
- virtual void LinkActivated(views::Link* source, int event_flags) {
+ // LinkListener methods:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE {
GURL url = google_util::AppendGoogleLocaleParam(
GURL(chrome::kPageInfoHelpCenterURL));
container_->OpenURLFromTab(container_->tab_contents(), url, GURL(),
diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc
index b4f4b68..d9b3d88 100644
--- a/chrome/browser/first_run/try_chrome_dialog_view.cc
+++ b/chrome/browser/first_run/try_chrome_dialog_view.cc
@@ -14,15 +14,16 @@
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/button/image_button.h"
#include "views/controls/button/radio_button.h"
#include "views/controls/image_view.h"
+#include "views/controls/link.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-#include "ui/base/l10n/l10n_util.h"
namespace {
@@ -186,7 +187,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal(
// Fifth row views.
layout->StartRowWithPadding(0, 4, 0, 10);
views::Link* link = new views::Link(why_this);
- link->SetController(this);
+ link->set_listener(this);
layout->AddView(link);
// We resize the window according to the layout manager. This takes into
@@ -255,6 +256,6 @@ void TryChromeDialogView::ButtonPressed(views::Button* sender,
MessageLoop::current()->Quit();
}
-void TryChromeDialogView::LinkActivated(views::Link* source, int event_flags) {
+void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) {
::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW);
}
diff --git a/chrome/browser/first_run/try_chrome_dialog_view.h b/chrome/browser/first_run/try_chrome_dialog_view.h
index 6f813b2..4d8be6a 100644
--- a/chrome/browser/first_run/try_chrome_dialog_view.h
+++ b/chrome/browser/first_run/try_chrome_dialog_view.h
@@ -8,9 +8,9 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "views/controls/button/button.h"
-#include "views/controls/link.h"
#include "ui/gfx/native_widget_types.h"
+#include "views/controls/button/button.h"
+#include "views/controls/link_listener.h"
class ProcessSingleton;
@@ -38,7 +38,7 @@ class Widget;
// +-----------------------------------------------+
//
class TryChromeDialogView : public views::ButtonListener,
- public views::LinkController {
+ public views::LinkListener {
public:
enum Result {
TRY_CHROME, // Launch chrome right now.
@@ -88,10 +88,10 @@ class TryChromeDialogView : public views::ButtonListener,
virtual void ButtonPressed(views::Button* sender,
const views::Event& event) OVERRIDE;
- // views::LinkController:
+ // views::LinkListener:
// If the user selects the link we need to fire off the default browser that
// by some convoluted logic should not be chrome.
- virtual void LinkActivated(views::Link* source, int event_flags) OVERRIDE;
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// Controls which version of the text to use.
size_t version_;
diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc
index 9587343..297d6f2 100644
--- a/chrome/browser/speech/speech_input_bubble_views.cc
+++ b/chrome/browser/speech/speech_input_bubble_views.cc
@@ -23,6 +23,7 @@
#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/layout/layout_constants.h"
#include "views/view.h"
@@ -36,7 +37,7 @@ const int kBubbleHeadingVertMargin = 6;
class ContentView
: public views::View,
public views::ButtonListener,
- public views::LinkController {
+ public views::LinkListener {
public:
explicit ContentView(SpeechInputBubbleDelegate* delegate);
@@ -48,8 +49,8 @@ class ContentView
// views::ButtonListener methods.
virtual void ButtonPressed(views::Button* source, const views::Event& event);
- // views::LinkController methods.
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener methods.
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// views::View overrides.
virtual gfx::Size GetPreferredSize();
@@ -109,7 +110,7 @@ ContentView::ContentView(SpeechInputBubbleDelegate* delegate)
mic_settings_ = new views::Link(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_MIC_SETTINGS)));
- mic_settings_->SetController(this);
+ mic_settings_->set_listener(this);
AddChildView(mic_settings_);
}
@@ -156,7 +157,7 @@ void ContentView::ButtonPressed(views::Button* source,
}
}
-void ContentView::LinkActivated(views::Link* source, int event_flags) {
+void ContentView::LinkClicked(views::Link* source, int event_flags) {
DCHECK_EQ(source, mic_settings_);
AudioManager::GetAudioManager()->ShowAudioInputSettings();
}
diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index 93faa2a..1b080e5 100644
--- a/chrome/browser/ui/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
@@ -35,6 +35,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
+#include "views/controls/link.h"
#include "views/controls/textfield/textfield.h"
#include "views/controls/throbber.h"
#include "views/layout/layout_constants.h"
@@ -267,14 +268,14 @@ void AboutChromeView::Init() {
StringSubRange(text, text.find(kBeginLinkChr) + wcslen(kBeginLinkChr),
text.find(kEndLinkChr)));
AddChildView(chromium_url_);
- chromium_url_->SetController(this);
+ chromium_url_->set_listener(this);
// The Open Source link within the main text of the dialog.
open_source_url_ = new views::Link(
StringSubRange(text, text.find(kBeginLinkOss) + wcslen(kBeginLinkOss),
text.find(kEndLinkOss)));
AddChildView(open_source_url_);
- open_source_url_->SetController(this);
+ open_source_url_->set_listener(this);
// Add together all the strings in the dialog for the purpose of calculating
// the height of the dialog. The space for the Terms of Service string is not
@@ -317,7 +318,7 @@ void AboutChromeView::Init() {
terms_of_service_url_ = new views::Link(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_TERMS_OF_SERVICE)));
AddChildView(terms_of_service_url_);
- terms_of_service_url_->SetController(this);
+ terms_of_service_url_->set_listener(this);
// Add the Terms of Service line and some whitespace.
height += font.GetHeight() + views::kRelatedControlVerticalSpacing;
@@ -638,10 +639,8 @@ views::View* AboutChromeView::GetContentsView() {
}
////////////////////////////////////////////////////////////////////////////////
-// AboutChromeView, views::LinkController implementation:
-
-void AboutChromeView::LinkActivated(views::Link* source,
- int event_flags) {
+// AboutChromeView, views::LinkListener implementation:
+void AboutChromeView::LinkClicked(views::Link* source, int event_flags) {
GURL url;
if (source == terms_of_service_url_) {
url = GURL(chrome::kAboutTermsURL);
diff --git a/chrome/browser/ui/views/about_chrome_view.h b/chrome/browser/ui/views/about_chrome_view.h
index 6393de0..8dca0db 100644
--- a/chrome/browser/ui/views/about_chrome_view.h
+++ b/chrome/browser/ui/views/about_chrome_view.h
@@ -6,9 +6,11 @@
#define CHROME_BROWSER_UI_VIEWS_ABOUT_CHROME_VIEW_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
@@ -36,7 +38,7 @@ class Profile;
////////////////////////////////////////////////////////////////////////////////
class AboutChromeView : public views::View,
public views::DialogDelegate,
- public views::LinkController
+ public views::LinkListener
#if defined(OS_WIN) || defined(OS_CHROMEOS)
, public GoogleUpdateStatusListener
#endif
@@ -73,8 +75,9 @@ class AboutChromeView : public views::View,
virtual bool Accept();
virtual views::View* GetContentsView();
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // Overridden from views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
+
#if defined(OS_WIN) || defined(OS_CHROMEOS)
// Overridden from GoogleUpdateStatusListener:
virtual void OnReportResults(GoogleUpdateUpgradeResult result,
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc
index 79f56ea..1a9a645 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc
@@ -10,11 +10,14 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
-using views::View;
+namespace {
// Horizontal padding, in pixels, between the link and label.
-static const int kViewPadding = 6;
+const int kViewPadding = 6;
+
+} // namespace
BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate)
: delegate_(delegate),
@@ -31,7 +34,7 @@ BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate)
UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK)));
// We don't want the link to alter tab navigation.
import_link_->SetFocusable(false);
- import_link_->SetController(this);
+ import_link_->set_listener(this);
AddChildView(import_link_);
}
}
@@ -39,7 +42,7 @@ BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate)
gfx::Size BookmarkBarInstructionsView::GetPreferredSize() {
int ascent = 0, descent = 0, height = 0, width = 0;
for (int i = 0; i < child_count(); ++i) {
- View* view = GetChildViewAt(i);
+ views::View* view = GetChildViewAt(i);
gfx::Size pref = view->GetPreferredSize();
int baseline = view->GetBaseline();
if (baseline != -1) {
@@ -60,7 +63,7 @@ void BookmarkBarInstructionsView::Layout() {
int remaining_width = width();
int x = 0;
for (int i = 0; i < child_count(); ++i) {
- View* view = GetChildViewAt(i);
+ views::View* view = GetChildViewAt(i);
gfx::Size pref = view->GetPreferredSize();
int baseline = view->GetBaseline();
int y;
@@ -80,8 +83,8 @@ void BookmarkBarInstructionsView::OnThemeChanged() {
}
void BookmarkBarInstructionsView::ViewHierarchyChanged(bool is_add,
- View* parent,
- View* child) {
+ views::View* parent,
+ views::View* child) {
if (!updated_colors_ && is_add && GetWidget())
UpdateColors();
}
@@ -91,8 +94,8 @@ void BookmarkBarInstructionsView::GetAccessibleState(
state->role = ui::AccessibilityTypes::ROLE_GROUPING;
}
-void BookmarkBarInstructionsView::LinkActivated(views::Link* source,
- int event_flags) {
+void BookmarkBarInstructionsView::LinkClicked(views::Link* source,
+ int event_flags) {
delegate_->ShowImportDialog();
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h
index 675df4a..bebb1fa 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h
@@ -6,8 +6,10 @@
#define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "ui/base/accessibility/accessible_view_state.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
namespace views {
@@ -21,7 +23,7 @@ class Link;
// with a link to import bookmarks. Clicking the link results in notifying the
// delegate.
class BookmarkBarInstructionsView : public views::View,
- public views::LinkController {
+ public views::LinkListener {
public:
// The delegate is notified once the user clicks on the link to import
// bookmarks.
@@ -35,7 +37,7 @@ class BookmarkBarInstructionsView : public views::View,
explicit BookmarkBarInstructionsView(Delegate* delegate);
- // View overrides.
+ // views::View overrides.
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
virtual void OnThemeChanged() OVERRIDE;
@@ -44,8 +46,8 @@ class BookmarkBarInstructionsView : public views::View,
views::View* child) OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
- // LinkController.
- virtual void LinkActivated(views::Link* source, int event_flags) OVERRIDE;
+ // views::LinkListener overrides.
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
private:
void UpdateColors();
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
index 33d1482..372a471 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
@@ -25,6 +25,8 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "views/controls/button/native_button.h"
+#include "views/controls/label.h"
+#include "views/controls/link.h"
#include "views/controls/textfield/textfield.h"
#include "views/events/event.h"
#include "views/focus/focus_manager.h"
@@ -33,13 +35,8 @@
#include "views/window/client_view.h"
#include "views/window/window.h"
-using views::Combobox;
using views::ColumnSet;
using views::GridLayout;
-using views::Label;
-using views::Link;
-using views::NativeButton;
-using views::View;
// Padding between "Title:" and the actual title.
static const int kTitlePadding = 4;
@@ -156,8 +153,9 @@ bool BookmarkBubbleView::AcceleratorPressed(
return true;
}
-void BookmarkBubbleView::ViewHierarchyChanged(bool is_add, View* parent,
- View* child) {
+void BookmarkBubbleView::ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child) {
if (is_add && child == this)
Init();
}
@@ -189,21 +187,21 @@ void BookmarkBubbleView::Init() {
initialized = true;
}
- remove_link_ = new Link(UTF16ToWide(l10n_util::GetStringUTF16(
+ remove_link_ = new views::Link(UTF16ToWide(l10n_util::GetStringUTF16(
IDS_BOOMARK_BUBBLE_REMOVE_BOOKMARK)));
- remove_link_->SetController(this);
+ remove_link_->set_listener(this);
- edit_button_ = new NativeButton(
+ edit_button_ = new views::NativeButton(
this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_OPTIONS)));
- close_button_ =
- new NativeButton(this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE)));
+ close_button_ = new views::NativeButton(
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE)));
close_button_->SetIsDefault(true);
- Label* combobox_label = new Label(
+ views::Label* combobox_label = new views::Label(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_FOLDER_TEXT)));
- parent_combobox_ = new Combobox(&parent_model_);
+ parent_combobox_ = new views::Combobox(&parent_model_);
parent_combobox_->SetSelectedItem(parent_model_.node_parent_index());
parent_combobox_->set_listener(this);
parent_combobox_->SetAccessibleName(
@@ -213,9 +211,10 @@ void BookmarkBubbleView::Init() {
parent_combobox_->SetEnabled(false);
#endif
- Label* title_label = new Label(UTF16ToWide(l10n_util::GetStringUTF16(
- newly_bookmarked_ ? IDS_BOOMARK_BUBBLE_PAGE_BOOKMARKED :
- IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK)));
+ views::Label* title_label = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ newly_bookmarked_ ? IDS_BOOMARK_BUBBLE_PAGE_BOOKMARKED :
+ IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK)));
title_label->SetFont(
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
title_label->SetColor(kTitleColor);
@@ -258,7 +257,7 @@ void BookmarkBubbleView::Init() {
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
layout->StartRow(0, 2);
- layout->AddView(new Label(UTF16ToWide(
+ layout->AddView(new views::Label(UTF16ToWide(
l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_TITLE_TEXT))));
title_tf_ = new views::Textfield();
title_tf_->SetText(GetTitle());
@@ -292,7 +291,7 @@ void BookmarkBubbleView::ButtonPressed(
HandleButtonPressed(sender);
}
-void BookmarkBubbleView::LinkActivated(Link* source, int event_flags) {
+void BookmarkBubbleView::LinkClicked(views::Link* source, int event_flags) {
DCHECK(source == remove_link_);
UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Unstar"),
profile_);
@@ -305,7 +304,7 @@ void BookmarkBubbleView::LinkActivated(Link* source, int event_flags) {
Close();
}
-void BookmarkBubbleView::ItemChanged(Combobox* combobox,
+void BookmarkBubbleView::ItemChanged(views::Combobox* combobox,
int prev_index,
int new_index) {
if (new_index + 1 == parent_model_.GetItemCount()) {
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h
index 5dff37d..433b198 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h
@@ -13,7 +13,7 @@
#include "ui/gfx/rect.h"
#include "views/controls/button/button.h"
#include "views/controls/combobox/combobox.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
class Profile;
@@ -31,7 +31,7 @@ class Textfield;
// bookmark it is created with. Don't create a BookmarkBubbleView directly,
// instead use the static Show method.
class BookmarkBubbleView : public views::View,
- public views::LinkController,
+ public views::LinkListener,
public views::ButtonListener,
public views::Combobox::Listener,
public BubbleDelegate {
@@ -73,9 +73,9 @@ class BookmarkBubbleView : public views::View,
// Returns the title to display.
string16 GetTitle();
- // LinkController method, either unstars the item or shows the bookmark
+ // views::LinkListener method, either unstars the item or shows the bookmark
// editor (depending upon which link was clicked).
- virtual void LinkActivated(views::Link* source, int event_flags);
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// ButtonListener method, closes the bubble or opens the edit dialog.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc
index 00d4c93..01261f3 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -24,6 +24,7 @@
#include "views/controls/button/radio_button.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
#include "views/controls/separator.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
@@ -88,7 +89,7 @@ void ContentSettingBubbleContents::Favicon::OnMouseReleased(
const views::MouseEvent& event) {
if ((event.IsLeftMouseButton() || event.IsMiddleMouseButton()) &&
HitTest(event.location())) {
- parent_->LinkActivated(link_, event.flags());
+ parent_->LinkClicked(link_, event.flags());
}
}
@@ -157,8 +158,8 @@ void ContentSettingBubbleContents::ButtonPressed(views::Button* sender,
NOTREACHED() << "unknown radio";
}
-void ContentSettingBubbleContents::LinkActivated(views::Link* source,
- int event_flags) {
+void ContentSettingBubbleContents::LinkClicked(views::Link* source,
+ int event_flags) {
if (source == custom_link_) {
content_setting_bubble_model_->OnCustomLinkClicked();
bubble_->set_fade_away_on_close(true);
@@ -245,7 +246,7 @@ void ContentSettingBubbleContents::InitControlLayout() {
layout->StartRow(0, popup_column_set_id);
views::Link* link = new views::Link(UTF8ToWide(i->title));
- link->SetController(this);
+ link->set_listener(this);
link->SetElideInMiddle(true);
popup_links_[link] = i - bubble_content.popup_items.begin();
layout->AddView(new Favicon((*i).bitmap, this, link));
@@ -304,7 +305,7 @@ void ContentSettingBubbleContents::InitControlLayout() {
if (!bubble_content.custom_link.empty()) {
custom_link_ = new views::Link(UTF8ToWide(bubble_content.custom_link));
custom_link_->SetEnabled(bubble_content.custom_link_enabled);
- custom_link_->SetController(this);
+ custom_link_->set_listener(this);
if (!bubble_content_empty)
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
layout->StartRow(0, single_column_set_id);
@@ -332,7 +333,7 @@ void ContentSettingBubbleContents::InitControlLayout() {
layout->StartRow(0, double_column_set_id);
manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link));
- manage_link_->SetController(this);
+ manage_link_->set_listener(this);
layout->AddView(manage_link_);
close_button_ =
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.h b/chrome/browser/ui/views/content_setting_bubble_contents.h
index 86b5e44..69372e2 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.h
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.h
@@ -8,11 +8,13 @@
#include <map>
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "chrome/common/content_settings_types.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "views/controls/button/button.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
// ContentSettingBubbleContents is used when the user turns on different kinds
// of content blocking (e.g. "block images"). When viewing a page with blocked
@@ -36,7 +38,7 @@ class RadioButton;
class ContentSettingBubbleContents : public views::View,
public views::ButtonListener,
- public views::LinkController,
+ public views::LinkListener,
public NotificationObserver {
public:
ContentSettingBubbleContents(
@@ -61,8 +63,8 @@ class ContentSettingBubbleContents : public views::View,
// views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// NotificationObserver:
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 471a2b2..0e68fd2 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -31,12 +31,11 @@
#include "ui/gfx/image.h"
#include "unicode/uchar.h"
#include "views/controls/button/native_button.h"
+#include "views/controls/label.h"
#include "views/controls/menu/menu_2.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-using base::TimeDelta;
-
// TODO(paulg): These may need to be adjusted when download progress
// animation is added, and also possibly to take into account
// different screen resolutions.
@@ -354,7 +353,7 @@ void DownloadItemView::StartDownloadProgress() {
if (progress_timer_.IsRunning())
return;
progress_timer_.Start(
- TimeDelta::FromMilliseconds(download_util::kProgressRateMs), this,
+ base::TimeDelta::FromMilliseconds(download_util::kProgressRateMs), this,
&DownloadItemView::UpdateDownloadProgress);
}
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc
index be94d2d..56cadbd 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -26,6 +26,7 @@
#include "views/background.h"
#include "views/controls/button/image_button.h"
#include "views/controls/image_view.h"
+#include "views/controls/link.h"
// Max number of download views we'll contain. Any time a view is added and
// we already have this many download views, one is removed.
@@ -105,7 +106,7 @@ void DownloadShelfView::Init() {
show_all_view_ = new views::Link(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)));
- show_all_view_->SetController(this);
+ show_all_view_->set_listener(this);
AddChildView(show_all_view_);
close_button_ = new views::ImageButton(this);
@@ -359,7 +360,7 @@ void DownloadShelfView::OnThemeChanged() {
UpdateButtonColors();
}
-void DownloadShelfView::LinkActivated(views::Link* source, int event_flags) {
+void DownloadShelfView::LinkClicked(views::Link* source, int event_flags) {
browser_->ShowDownloadsTab();
}
diff --git a/chrome/browser/ui/views/download/download_shelf_view.h b/chrome/browser/ui/views/download/download_shelf_view.h
index 1d6893b..76994e8 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.h
+++ b/chrome/browser/ui/views/download/download_shelf_view.h
@@ -6,11 +6,13 @@
#define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/ui/views/accessible_pane_view.h"
#include "ui/base/animation/animation_delegate.h"
#include "views/controls/button/button.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/mouse_watcher.h"
class BaseDownloadItemModel;
@@ -37,7 +39,7 @@ class DownloadShelfView : public AccessiblePaneView,
public ui::AnimationDelegate,
public DownloadShelf,
public views::ButtonListener,
- public views::LinkController,
+ public views::LinkListener,
public views::MouseWatcherListener {
public:
DownloadShelfView(Browser* browser, BrowserView* parent);
@@ -55,9 +57,9 @@ class DownloadShelfView : public AccessiblePaneView,
virtual void AnimationProgressed(const ui::Animation* animation);
virtual void AnimationEnded(const ui::Animation* animation);
- // Implementation of LinkController.
+ // Implementation of views::LinkListener.
// Invoked when the user clicks the 'show all downloads' link button.
- virtual void LinkActivated(views::Link* source, int event_flags);
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// Implementation of ButtonListener.
// Invoked when the user clicks the close button. Asks the browser to
diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
index dad519b..1e6af5d 100644
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -14,10 +14,8 @@
#include "chrome/common/extensions/extension.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-#include "views/controls/button/checkbox.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
-#include "views/controls/link.h"
#include "views/layout/layout_constants.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
index bd7e31c..98bb8c5 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
@@ -12,6 +12,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia.h"
+#include "views/controls/link.h"
#include "views/screen.h"
#include "views/widget/root_view.h"
#include "views/window/window.h"
@@ -59,7 +60,7 @@ FullscreenExitBubble::FullscreenExitView::FullscreenExitView(
link_.SetText(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)));
#endif
- link_.SetController(bubble);
+ link_.set_listener(bubble);
link_.SetFont(ResourceBundle::GetSharedInstance().GetFont(
ResourceBundle::LargeFont));
link_.SetNormalColor(SK_ColorWHITE);
@@ -166,7 +167,7 @@ FullscreenExitBubble::~FullscreenExitBubble() {
MessageLoop::current()->DeleteSoon(FROM_HERE, popup_);
}
-void FullscreenExitBubble::LinkActivated(views::Link* source, int event_flags) {
+void FullscreenExitBubble::LinkClicked(views::Link* source, int event_flags) {
delegate_->ExecuteCommand(IDC_FULLSCREEN);
}
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.h b/chrome/browser/ui/views/fullscreen_exit_bubble.h
index b8e686c..facf771 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble.h
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.h
@@ -2,31 +2,36 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
-#define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
+#ifndef CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H_
+#define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer.h"
#include "chrome/browser/command_updater.h"
#include "ui/base/animation/animation_delegate.h"
-#include "views/controls/link.h"
+#include "ui/gfx/point.h"
+#include "views/controls/link_listener.h"
+
+namespace gfx {
+class Rect;
+}
namespace ui {
class SlideAnimation;
}
-#if defined(OS_LINUX)
namespace views {
-class WidgetGtk;
+class View;
+class Widget;
}
-#endif
// FullscreenExitBubble is responsible for showing a bubble atop the screen in
// fullscreen mode, telling users how to exit and providing a click target.
// The bubble auto-hides, and re-shows when the user moves to the screen top.
-
-class FullscreenExitBubble : public views::LinkController,
+class FullscreenExitBubble : public views::LinkListener,
public ui::AnimationDelegate {
public:
explicit FullscreenExitBubble(
@@ -46,10 +51,10 @@ class FullscreenExitBubble : public views::LinkController,
static const int kSlideInDurationMs; // Duration of slide-in animation
static const int kSlideOutDurationMs; // Duration of slide-out animation
- // views::LinkController
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
- // ui::AnimationDelegate
+ // ui::AnimationDelegate:
virtual void AnimationProgressed(const ui::Animation* animation);
virtual void AnimationEnded(const ui::Animation* animation);
@@ -101,4 +106,4 @@ class FullscreenExitBubble : public views::LinkController,
DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubble);
};
-#endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
+#endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H_
diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc
index 661967a..8ed7132b 100644
--- a/chrome/browser/ui/views/infobars/confirm_infobar.cc
+++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/ui/views/event_utils.h"
#include "views/controls/button/text_button.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
// ConfirmInfoBarDelegate -----------------------------------------------------
@@ -118,7 +119,7 @@ int ConfirmInfoBar::ContentMinimumWidth() const {
(before_cancel_spacing + cancel_button_->GetPreferredSize().width()));
}
-void ConfirmInfoBar::LinkActivated(views::Link* source, int event_flags) {
+void ConfirmInfoBar::LinkClicked(views::Link* source, int event_flags) {
DCHECK(link_ != NULL);
DCHECK_EQ(link_, source);
if (GetDelegate()->LinkClicked(
diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.h b/chrome/browser/ui/views/infobars/confirm_infobar.h
index 9ba0055..ef2d37d 100644
--- a/chrome/browser/ui/views/infobars/confirm_infobar.h
+++ b/chrome/browser/ui/views/infobars/confirm_infobar.h
@@ -6,10 +6,13 @@
#define CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/ui/views/infobars/infobar_view.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
class ConfirmInfoBarDelegate;
+
namespace views {
class Label;
class TextButton;
@@ -19,7 +22,7 @@ class TextButton;
// right-aligned link. This is commonly used to do things like:
// "Would you like to do X? [Yes] [No] _Learn More_ [x]"
class ConfirmInfoBar : public InfoBarView,
- public views::LinkController {
+ public views::LinkListener {
public:
explicit ConfirmInfoBar(ConfirmInfoBarDelegate* delegate);
@@ -32,8 +35,8 @@ class ConfirmInfoBar : public InfoBarView,
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
virtual int ContentMinimumWidth() const;
- // views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
ConfirmInfoBarDelegate* GetDelegate();
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc
index 73af43d..fa721dd 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.cc
+++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -75,14 +75,14 @@ views::Label* InfoBarView::CreateLabel(const string16& text) {
// static
views::Link* InfoBarView::CreateLink(const string16& text,
- views::LinkController* controller,
+ views::LinkListener* listener,
const SkColor& background_color) {
views::Link* link = new views::Link;
link->SetText(UTF16ToWideHack(text));
link->SetFont(
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
link->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- link->SetController(controller);
+ link->set_listener(listener);
link->MakeReadableOverBackgroundColor(background_color);
return link;
}
diff --git a/chrome/browser/ui/views/infobars/infobar_view.h b/chrome/browser/ui/views/infobars/infobar_view.h
index ec32051..13596c5 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.h
+++ b/chrome/browser/ui/views/infobars/infobar_view.h
@@ -21,7 +21,7 @@ class ImageButton;
class ImageView;
class Label;
class Link;
-class LinkController;
+class LinkListener;
class MenuButton;
class TextButton;
class ViewMenuDelegate;
@@ -48,7 +48,7 @@ class InfoBarView : public InfoBar,
// Creates a link with the appropriate font and color for an infobar.
static views::Link* CreateLink(const string16& text,
- views::LinkController* controller,
+ views::LinkListener* listener,
const SkColor& background_color);
// Creates a menu button with an infobar-specific appearance.
diff --git a/chrome/browser/ui/views/infobars/link_infobar.cc b/chrome/browser/ui/views/infobars/link_infobar.cc
index 7e9c24f..accaeb6 100644
--- a/chrome/browser/ui/views/infobars/link_infobar.cc
+++ b/chrome/browser/ui/views/infobars/link_infobar.cc
@@ -6,6 +6,8 @@
#include "chrome/browser/tab_contents/link_infobar_delegate.h"
#include "chrome/browser/ui/views/event_utils.h"
+#include "views/controls/label.h"
+#include "views/controls/link.h"
// LinkInfoBarDelegate --------------------------------------------------------
@@ -68,7 +70,7 @@ void LinkInfoBar::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
InfoBarView::ViewHierarchyChanged(is_add, parent, child);
}
-void LinkInfoBar::LinkActivated(views::Link* source, int event_flags) {
+void LinkInfoBar::LinkClicked(views::Link* source, int event_flags) {
DCHECK(link_ != NULL);
DCHECK_EQ(link_, source);
if (GetDelegate()->LinkClicked(
diff --git a/chrome/browser/ui/views/infobars/link_infobar.h b/chrome/browser/ui/views/infobars/link_infobar.h
index 784fdfa..99e5d9d 100644
--- a/chrome/browser/ui/views/infobars/link_infobar.h
+++ b/chrome/browser/ui/views/infobars/link_infobar.h
@@ -6,14 +6,16 @@
#define CHROME_BROWSER_UI_VIEWS_INFOBARS_LINK_INFOBAR_H_
#pragma once
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/ui/views/infobars/infobar_view.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
class LinkInfoBarDelegate;
// An infobar that shows a string with an embedded link.
class LinkInfoBar : public InfoBarView,
- public views::LinkController {
+ public views::LinkListener {
public:
explicit LinkInfoBar(LinkInfoBarDelegate* delegate);
@@ -24,8 +26,8 @@ class LinkInfoBar : public InfoBarView,
virtual void Layout();
virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
- // views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
LinkInfoBarDelegate* GetDelegate();
diff --git a/chrome/browser/ui/views/instant_confirm_view.cc b/chrome/browser/ui/views/instant_confirm_view.cc
index b6e7c99..cd8bcb7 100644
--- a/chrome/browser/ui/views/instant_confirm_view.cc
+++ b/chrome/browser/ui/views/instant_confirm_view.cc
@@ -15,6 +15,7 @@
#include "grit/locale_settings.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/window.h"
@@ -28,7 +29,7 @@ InstantConfirmView::InstantConfirmView(Profile* profile) : profile_(profile) {
views::Link* learn_more_link = new views::Link(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
learn_more_link->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- learn_more_link->SetController(this);
+ learn_more_link->set_listener(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
@@ -77,7 +78,7 @@ bool InstantConfirmView::IsModal() const {
return true;
}
-void InstantConfirmView::LinkActivated(views::Link* source, int event_flags) {
+void InstantConfirmView::LinkClicked(views::Link* source, int event_flags) {
Browser* browser = BrowserList::GetLastActive();
browser->OpenURL(browser::InstantLearnMoreURL(), GURL(),
NEW_FOREGROUND_TAB, PageTransition::TYPED);
diff --git a/chrome/browser/ui/views/instant_confirm_view.h b/chrome/browser/ui/views/instant_confirm_view.h
index 53f72a2..13bb1d4 100644
--- a/chrome/browser/ui/views/instant_confirm_view.h
+++ b/chrome/browser/ui/views/instant_confirm_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,8 +6,9 @@
#define CHROME_BROWSER_UI_VIEWS_INSTANT_CONFIRM_VIEW_H_
#pragma once
-#include "views/controls/label.h"
-#include "views/controls/link.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
@@ -16,11 +17,11 @@ class Profile;
// The view shown in the instant confirm dialog.
class InstantConfirmView : public views::View,
public views::DialogDelegate,
- public views::LinkController {
+ public views::LinkListener {
public:
explicit InstantConfirmView(Profile* profile);
- // DialogDelegate overrides:
+ // views::DialogDelegate overrides:
virtual bool Accept(bool window_closing);
virtual bool Accept();
virtual bool Cancel();
@@ -29,8 +30,8 @@ class InstantConfirmView : public views::View,
virtual gfx::Size GetPreferredSize();
virtual bool IsModal() const;
- // LinkController overrides:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener overrides:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
private:
Profile* profile_;
diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc
index c895db0..21cd4bf 100644
--- a/chrome/browser/ui/views/page_info_bubble_view.cc
+++ b/chrome/browser/ui/views/page_info_bubble_view.cc
@@ -7,8 +7,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/bubble/bubble.h"
+#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar_view.h"
#include "chrome/common/url_constants.h"
#include "content/browser/cert_store.h"
@@ -19,6 +19,7 @@
#include "ui/gfx/image.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
+#include "views/controls/link.h"
#include "views/controls/separator.h"
#include "views/layout/grid_layout.h"
#include "views/widget/widget.h"
@@ -44,7 +45,7 @@ const int kPageInfoSlideDuration = 300;
// A section contains an image that shows a status (good or bad), a title, an
// optional head-line (in bold) and a description.
class Section : public views::View,
- public views::LinkController {
+ public views::LinkListener {
public:
Section(PageInfoBubbleView* owner,
const PageInfoModel::SectionInfo& section_info,
@@ -56,8 +57,8 @@ class Section : public views::View,
virtual int GetHeightForWidth(int w);
virtual void Layout();
- // views::LinkController methods:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener methods:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
private:
// Calculate the layout if |compute_bounds_only|, otherwise does Layout also.
@@ -157,7 +158,7 @@ void PageInfoBubbleView::LayoutSections() {
layout->StartRow(0, 1);
help_center_link_ = new views::Link(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK)));
- help_center_link_->SetController(this);
+ help_center_link_->set_listener(this);
layout->AddView(help_center_link_);
}
@@ -219,7 +220,7 @@ std::wstring PageInfoBubbleView::accessible_name() {
return L"PageInfoBubble";
}
-void PageInfoBubbleView::LinkActivated(views::Link* source, int event_flags) {
+void PageInfoBubbleView::LinkClicked(views::Link* source, int event_flags) {
// We want to make sure the info bubble closes once the link is activated. So
// we close it explicitly rather than relying on a side-effect of opening a
// new tab (see http://crosbug.com/10186).
@@ -273,7 +274,7 @@ Section::Section(PageInfoBubbleView* owner,
if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && show_cert) {
link_ = new views::Link(
UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON)));
- link_->SetController(this);
+ link_->set_listener(this);
AddChildView(link_);
}
}
@@ -289,7 +290,7 @@ void Section::Layout() {
LayoutItems(false, width());
}
-void Section::LinkActivated(views::Link* source, int event_flags) {
+void Section::LinkClicked(views::Link* source, int event_flags) {
owner_->ShowCertDialog();
}
diff --git a/chrome/browser/ui/views/page_info_bubble_view.h b/chrome/browser/ui/views/page_info_bubble_view.h
index 47b05b6..452e430 100644
--- a/chrome/browser/ui/views/page_info_bubble_view.h
+++ b/chrome/browser/ui/views/page_info_bubble_view.h
@@ -10,7 +10,7 @@
#include "chrome/browser/ui/views/bubble/bubble.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/base/animation/slide_animation.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
namespace views {
@@ -20,7 +20,7 @@ class Label;
class PageInfoBubbleView : public views::View,
public PageInfoModel::PageInfoModelObserver,
public BubbleDelegate,
- public views::LinkController,
+ public views::LinkListener,
public ui::AnimationDelegate {
public:
PageInfoBubbleView(gfx::NativeWindow parent_window,
@@ -47,8 +47,8 @@ class PageInfoBubbleView : public views::View,
virtual bool FadeInOnShow();
virtual std::wstring accessible_name();
- // LinkController methods:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener methods:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// Overridden from ui::AnimationDelegate.
virtual void AnimationEnded(const ui::Animation* animation);
diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index 435a8d9..554191e 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -19,6 +19,7 @@
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/size.h"
#include "ui/gfx/skia_util.h"
+#include "views/controls/link.h"
static const int kSadTabOffset = -64;
static const int kIconTitleSpacing = 20;
@@ -65,7 +66,7 @@ SadTabView::SadTabView(TabContents* tab_contents, Kind kind)
new views::Link(UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
learn_more_link_->SetFont(*message_font_);
learn_more_link_->SetNormalColor(kLinkColor);
- learn_more_link_->SetController(this);
+ learn_more_link_->set_listener(this);
AddChildView(learn_more_link_);
}
}
@@ -132,7 +133,7 @@ void SadTabView::Layout() {
}
}
-void SadTabView::LinkActivated(views::Link* source, int event_flags) {
+void SadTabView::LinkClicked(views::Link* source, int event_flags) {
if (tab_contents_ != NULL && source == learn_more_link_) {
GURL help_url =
google_util::AppendGoogleLocaleParam(GURL(kind_ == CRASHED ?
diff --git a/chrome/browser/ui/views/sad_tab_view.h b/chrome/browser/ui/views/sad_tab_view.h
index e87ecb4..5580013 100644
--- a/chrome/browser/ui/views/sad_tab_view.h
+++ b/chrome/browser/ui/views/sad_tab_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "ui/gfx/font.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/view.h"
class SkBitmap;
@@ -23,7 +23,7 @@ class TabContents;
//
///////////////////////////////////////////////////////////////////////////////
class SadTabView : public views::View,
- public views::LinkController {
+ public views::LinkListener {
public:
enum Kind {
CRASHED, // The tab crashed. Display the "Aw, Snap!" page.
@@ -37,8 +37,8 @@ class SadTabView : public views::View,
virtual void OnPaint(gfx::Canvas* canvas);
virtual void Layout();
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // Overridden from views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
private:
static void InitClass(Kind kind);
diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc
index b51c39c..eef260f 100644
--- a/chrome/browser/ui/views/task_manager_view.cc
+++ b/chrome/browser/ui/views/task_manager_view.cc
@@ -27,6 +27,7 @@
#include "views/background.h"
#include "views/controls/button/native_button.h"
#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/controls/menu/menu.h"
#include "views/controls/table/group_table_view.h"
#include "views/controls/table/table_view_observer.h"
@@ -257,7 +258,7 @@ class TaskManagerView : public views::View,
public views::ButtonListener,
public views::DialogDelegate,
public views::TableViewObserver,
- public views::LinkController,
+ public views::LinkListener,
public views::ContextMenuController,
public views::Menu::Delegate {
public:
@@ -293,8 +294,8 @@ class TaskManagerView : public views::View,
virtual void OnDoubleClick();
virtual void OnKeyDown(ui::KeyboardCode keycode);
- // views::LinkController implementation.
- virtual void LinkActivated(views::Link* source, int event_flags);
+ // views::LinkListener implementation.
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// Called by the column picker to pick up any new stat counters that
// may have appeared since last time.
@@ -452,7 +453,7 @@ void TaskManagerView::Init() {
kill_button_->SetAccessibleKeyboardShortcut(L"E");
about_memory_link_ = new views::Link(UTF16ToWide(
l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)));
- about_memory_link_->SetController(this);
+ about_memory_link_->set_listener(this);
// Makes sure our state is consistent.
OnSelectionChanged();
@@ -681,8 +682,7 @@ void TaskManagerView::OnKeyDown(ui::KeyboardCode keycode) {
ActivateFocusedTab();
}
-// views::LinkController implementation
-void TaskManagerView::LinkActivated(views::Link* source, int event_flags) {
+void TaskManagerView::LinkClicked(views::Link* source, int event_flags) {
DCHECK(source == about_memory_link_);
task_manager_->OpenAboutMemory();
}
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;
}
diff --git a/views/controls/link.h b/views/controls/link.h
index 7bdfe7a..79a940f 100644
--- a/views/controls/link.h
+++ b/views/controls/link.h
@@ -12,21 +12,7 @@
namespace views {
-class Link;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// LinkController defines the method that should be implemented to
-// receive a notification when a link is clicked
-//
-////////////////////////////////////////////////////////////////////////////////
-class LinkController {
- public:
- virtual void LinkActivated(Link* source, int event_flags) = 0;
-
- protected:
- virtual ~LinkController() {}
-};
+class LinkListener;
////////////////////////////////////////////////////////////////////////////////
//
@@ -42,8 +28,8 @@ class Link : public Label {
explicit Link(const std::wstring& title);
virtual ~Link();
- void SetController(LinkController* controller);
- const LinkController* GetController();
+ const LinkListener* listener() { return listener_; }
+ void set_listener(LinkListener* listener) { listener_ = listener; }
// Overridden from View:
virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE;
@@ -85,7 +71,7 @@ class Link : public Label {
void Init();
- LinkController* controller_;
+ LinkListener* listener_;
// Whether the link is currently highlighted.
bool highlighted_;
diff --git a/views/controls/link_listener.h b/views/controls/link_listener.h
new file mode 100644
index 0000000..d0d593e
--- /dev/null
+++ b/views/controls/link_listener.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef VIEWS_CONTROLS_LINK_LISTENER_H_
+#define VIEWS_CONTROLS_LINK_LISTENER_H_
+#pragma once
+
+namespace views {
+
+class Link;
+
+// An interface implemented by an object to let it know that a link was clicked.
+class LinkListener {
+ public:
+ virtual void LinkClicked(Link* source, int event_flags) = 0;
+
+ protected:
+ virtual ~LinkListener() {}
+};
+
+} // namespace views
+
+#endif // VIEWS_CONTROLS_LINK_LISTENER_H_
diff --git a/views/examples/link_example.cc b/views/examples/link_example.cc
index fd08999..458701a 100644
--- a/views/examples/link_example.cc
+++ b/views/examples/link_example.cc
@@ -4,6 +4,7 @@
#include "views/examples/link_example.h"
+#include "views/controls/link.h"
#include "views/layout/fill_layout.h"
#include "views/view.h"
@@ -21,13 +22,13 @@ std::wstring LinkExample::GetExampleTitle() {
void LinkExample::CreateExampleView(views::View* container) {
link_ = new views::Link(L"Click me!");
- link_->SetController(this);
+ link_->set_listener(this);
container->SetLayoutManager(new views::FillLayout);
container->AddChildView(link_);
}
-void LinkExample::LinkActivated(views::Link* source, int event_flags) {
+void LinkExample::LinkClicked(views::Link* source, int event_flags) {
PrintStatus(L"Link clicked");
}
diff --git a/views/examples/link_example.h b/views/examples/link_example.h
index c9ea9f81..d10994e 100644
--- a/views/examples/link_example.h
+++ b/views/examples/link_example.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "views/controls/link.h"
+#include "views/controls/link_listener.h"
#include "views/examples/example_base.h"
namespace views {
@@ -18,7 +18,7 @@ class View;
namespace examples {
class LinkExample : public ExampleBase,
- public views::LinkController {
+ public views::LinkListener {
public:
explicit LinkExample(ExamplesMain* main);
virtual ~LinkExample();
@@ -28,8 +28,8 @@ class LinkExample : public ExampleBase,
virtual void CreateExampleView(views::View* container) OVERRIDE;
private:
- // Overridden from views::LinkController:
- virtual void LinkActivated(views::Link* source, int event_flags) OVERRIDE;
+ // Overridden from views::LinkListener:
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
views::Link* link_;
diff --git a/views/views.gyp b/views/views.gyp
index 5e93293..d797cd0 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -119,6 +119,7 @@
'controls/label.h',
'controls/link.cc',
'controls/link.h',
+ 'controls/link_listener.h',
'controls/menu/menu.cc',
'controls/menu/menu.h',
'controls/menu/menu_2.cc',