summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 20:28:54 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 20:28:54 +0000
commit7558a3309895ffe00426650e7d634e7ef48c7e5b (patch)
tree23ac43e674ce13480f3ffedf7c39809433274c66 /views/controls
parentc2207a064d587a32057ccb07a8bef9b638f11878 (diff)
downloadchromium_src-7558a3309895ffe00426650e7d634e7ef48c7e5b.zip
chromium_src-7558a3309895ffe00426650e7d634e7ef48c7e5b.tar.gz
chromium_src-7558a3309895ffe00426650e7d634e7ef48c7e5b.tar.bz2
Add view class names to some classes used in the Wrench menu.
BUG=none TEST=none Review URL: http://codereview.chromium.org/2832106 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/button/text_button.cc8
-rw-r--r--views/controls/button/text_button.h8
-rw-r--r--views/controls/menu/menu_item_view.cc7
-rw-r--r--views/controls/menu/menu_item_view.h7
-rw-r--r--views/controls/menu/submenu_view.cc7
-rw-r--r--views/controls/menu/submenu_view.h8
6 files changed, 45 insertions, 0 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index 5c1ec29..2125a02 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -34,6 +34,9 @@ const SkColor TextButton::kHoverColor = TextButton::kEnabledColor;
// How long the hover fade animation should last.
static const int kHoverAnimationDurationMs = 170;
+// static
+const char TextButton::kViewClassName[] = "views/TextButton";
+
static int PrefixTypeToCanvasType(TextButton::PrefixType type) {
switch (type) {
case TextButton::PREFIX_HIDE:
@@ -203,6 +206,7 @@ TextButton::~TextButton() {
void TextButton::SetText(const std::wstring& text) {
text_ = text;
+ SetAccessibleName(text);
UpdateTextSize();
}
@@ -427,6 +431,10 @@ void TextButton::SetEnabled(bool enabled) {
SchedulePaint();
}
+std::string TextButton::GetClassName() const {
+ return kViewClassName;
+}
+
void TextButton::Paint(gfx::Canvas* canvas) {
Paint(canvas, false);
}
diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h
index 310bbda..d37f1aa 100644
--- a/views/controls/button/text_button.h
+++ b/views/controls/button/text_button.h
@@ -6,6 +6,8 @@
#define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
#pragma once
+#include <string>
+
#include "gfx/font.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -72,6 +74,9 @@ class TextButtonBorder : public Border {
////////////////////////////////////////////////////////////////////////////////
class TextButton : public CustomButton {
public:
+ // The menu button's class name.
+ static const char kViewClassName[];
+
// Enumeration of how the prefix ('&') character is processed. The default
// is |PREFIX_NONE|.
enum PrefixType {
@@ -153,6 +158,9 @@ class TextButton : public CustomButton {
static const SkColor kDisabledColor;
static const SkColor kHoverColor;
+ // Returns views/TextButton.
+ virtual std::string GetClassName() const;
+
protected:
SkBitmap icon() const { return icon_; }
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index e0ca73d..ddefa2a 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -66,6 +66,9 @@ int MenuItemView::item_right_margin_;
// static
int MenuItemView::pref_menu_height_;
+// static
+const char MenuItemView::kViewClassName[] = "views/MenuItemView";
+
MenuItemView::MenuItemView(MenuDelegate* delegate)
: delegate_(delegate),
controller_(NULL),
@@ -401,6 +404,10 @@ MenuItemView::MenuItemView(MenuItemView* parent,
Init(parent, command, type, NULL);
}
+std::string MenuItemView::GetClassName() const {
+ return kViewClassName;
+}
+
// Calculates all sizes that we can from the OS.
//
// This is invoked prior to Running a menu.
diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h
index 6c3848b..9441c84 100644
--- a/views/controls/menu/menu_item_view.h
+++ b/views/controls/menu/menu_item_view.h
@@ -6,6 +6,8 @@
#define VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
#pragma once
+#include <string>
+
#if defined(OS_WIN)
#include <windows.h>
#endif
@@ -54,6 +56,9 @@ class MenuItemView : public View {
public:
friend class MenuController;
+ // The menu item view's class name.
+ static const char kViewClassName[];
+
// ID used to identify menu items.
static const int kMenuItemViewID;
@@ -265,6 +270,8 @@ class MenuItemView : public View {
// Creates a MenuItemView. This is used by the various AddXXX methods.
MenuItemView(MenuItemView* parent, int command, Type type);
+ virtual std::string GetClassName() const;
+
private:
// Calculates all sizes that we can from the OS.
//
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index d7cf64c..de74aa1 100644
--- a/views/controls/menu/submenu_view.cc
+++ b/views/controls/menu/submenu_view.cc
@@ -22,6 +22,9 @@ namespace views {
// static
const int SubmenuView::kSubmenuBorderSize = 3;
+// static
+const char SubmenuView::kViewClassName[] = "views/SubmenuView";
+
SubmenuView::SubmenuView(MenuItemView* parent)
: parent_menu_item_(parent),
host_(NULL),
@@ -298,6 +301,10 @@ void SubmenuView::MenuHostDestroyed() {
GetMenuItem()->GetMenuController()->Cancel(MenuController::EXIT_DESTROYED);
}
+std::string SubmenuView::GetClassName() const {
+ return kViewClassName;
+}
+
void SubmenuView::PaintDropIndicator(gfx::Canvas* canvas,
MenuItemView* item,
MenuDelegate::DropPosition position) {
diff --git a/views/controls/menu/submenu_view.h b/views/controls/menu/submenu_view.h
index a2ac7f5..85cf95bc 100644
--- a/views/controls/menu/submenu_view.h
+++ b/views/controls/menu/submenu_view.h
@@ -6,6 +6,8 @@
#define VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_
#pragma once
+#include <string>
+
#include "views/controls/menu/menu_delegate.h"
#include "views/view.h"
@@ -32,6 +34,9 @@ class MenuScrollViewContainer;
// are provided that allow the user to see all the menu items.
class SubmenuView : public View {
public:
+ // The submenu's class name.
+ static const char kViewClassName[];
+
// Creates a SubmenuView for the specified menu item.
explicit SubmenuView(MenuItemView* parent);
~SubmenuView();
@@ -133,6 +138,9 @@ class SubmenuView : public View {
// Padding around the edges of the submenu.
static const int kSubmenuBorderSize;
+ protected:
+ virtual std::string GetClassName() const;
+
private:
// Paints the drop indicator. This is only invoked if item is non-NULL and
// position is not DROP_NONE.