summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 07:05:04 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 07:05:04 +0000
commit2de6ec6b5dc6cd6c15b21829214da4c1415a5495 (patch)
tree1089b98628d896c3b07402c4fdb339d5255e4daf /ui
parent6428585591bdc8b9ca9f4655179c58d95a6df344 (diff)
downloadchromium_src-2de6ec6b5dc6cd6c15b21829214da4c1415a5495.zip
chromium_src-2de6ec6b5dc6cd6c15b21829214da4c1415a5495.tar.gz
chromium_src-2de6ec6b5dc6cd6c15b21829214da4c1415a5495.tar.bz2
Allow IDS_PASTE_AND_SEARCH label in omnibox_view_views too.
BUG=135541 TEST=manually verified with copying some text or URL and see the context menu labels Review URL: https://chromiumcodereview.appspot.com/10696137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146532 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/controls/textfield/native_textfield_views.cc10
-rw-r--r--ui/views/controls/textfield/native_textfield_views.h2
-rw-r--r--ui/views/controls/textfield/textfield_controller.cc8
-rw-r--r--ui/views/controls/textfield/textfield_controller.h7
4 files changed, 27 insertions, 0 deletions
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index beb1437..6372aaf 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -598,6 +598,16 @@ bool NativeTextfieldViews::GetAcceleratorForCommandId(int command_id,
return false;
}
+bool NativeTextfieldViews::IsItemForCommandIdDynamic(int command_id) const {
+ const TextfieldController* controller = textfield_->GetController();
+ return controller && controller->IsItemForCommandIdDynamic(command_id);
+}
+
+string16 NativeTextfieldViews::GetLabelForCommandId(int command_id) const {
+ const TextfieldController* controller = textfield_->GetController();
+ return controller ? controller->GetLabelForCommandId(command_id) : string16();
+}
+
void NativeTextfieldViews::ExecuteCommand(int command_id) {
if (!IsCommandIdEnabled(command_id))
return;
diff --git a/ui/views/controls/textfield/native_textfield_views.h b/ui/views/controls/textfield/native_textfield_views.h
index 9142c5a..1bcc9cd 100644
--- a/ui/views/controls/textfield/native_textfield_views.h
+++ b/ui/views/controls/textfield/native_textfield_views.h
@@ -132,6 +132,8 @@ class VIEWS_EXPORT NativeTextfieldViews : public TouchSelectionClientView,
virtual bool GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) OVERRIDE;
+ virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
+ virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
virtual void ExecuteCommand(int command_id) OVERRIDE;
// class name of internal
diff --git a/ui/views/controls/textfield/textfield_controller.cc b/ui/views/controls/textfield/textfield_controller.cc
index 118ce0a..7d2205c 100644
--- a/ui/views/controls/textfield/textfield_controller.cc
+++ b/ui/views/controls/textfield/textfield_controller.cc
@@ -10,4 +10,12 @@ bool TextfieldController::IsCommandIdEnabled(int command_id) const {
return false;
}
+bool TextfieldController::IsItemForCommandIdDynamic(int command_id) const {
+ return false;
+}
+
+string16 TextfieldController::GetLabelForCommandId(int command_id) const {
+ return string16();
+}
+
} // namespace views
diff --git a/ui/views/controls/textfield/textfield_controller.h b/ui/views/controls/textfield/textfield_controller.h
index bacf768..8932e2a 100644
--- a/ui/views/controls/textfield/textfield_controller.h
+++ b/ui/views/controls/textfield/textfield_controller.h
@@ -55,6 +55,13 @@ class VIEWS_EXPORT TextfieldController {
// Returns true if the |command_id| should be enabled in the context menu.
virtual bool IsCommandIdEnabled(int command_id) const;
+ // Returns true if the item label for the |command_id| is dynamic in the
+ // context menu.
+ virtual bool IsItemForCommandIdDynamic(int command_id) const;
+
+ // Returns the label string for the |coomand_id|.
+ virtual string16 GetLabelForCommandId(int command_id) const;
+
// Execute context menu command specified by |command_id|.
virtual void ExecuteCommand(int command_id) {}