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

Issue 2007503002: Views: Replace resource ids with ui::TextEditCommand enum for text editing commands in Textfield. (Closed)

Created:
4 years, 7 months ago by karandeepb
Modified:
4 years, 6 months ago
Reviewers:
tapted
CC:
chromium-reviews, yusukes+watch_chromium.org, sievers+watch_chromium.org, nyquist+watch-blimp_chromium.org, kmarshall+watch-blimp_chromium.org, hidehiko+watch_chomium.org, maniscalco+watch-blimp_chromium.org, jam, shaktisahu+watch-blimp_chromium.org, jbauman+watch_chromium.org, nona+watch_chromium.org, marcinjb+watch-blimp_chromium.org, jessicag+watch-blimp_chromium.org, darin-cc_chromium.org, lethalantidote+watch-blimp_chromium.org, kalyank, dtrainor+watch-blimp_chromium.org, tdresser+watch_chromium.org, piman+watch_chromium.org, khushalsagar+watch-blimp_chromium.org, elijahtaylor+arcwatch_chromium.org, anandc+watch-blimp_chromium.org, sriramsr+watch-blimp_chromium.org, tfarina, shuchen+watch_chromium.org, lhchavez+watch_chromium.org, danakj+watch_chromium.org, James Su, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Views: Replace resource ids with ui::TextEditCommand enum for text editing commands in Textfield. This CL replaces resource ids with a newly added ui::TextEditCommand enum for text editing commands in views::Textfield. The TextInputClient API is modified to accept TextEditCommand enum in place of command ids. In Textfield and OmniboxViewViews, menu action commands and text editing commands are decoupled to ensure that all menu action commands are handled using ExecuteCommand(..) and IsCommandIdEnabled(..) functions. To handle text editing commands, IsEditCommandEnabled() is used along with a newly added ExecuteEditCommand protected virtual method. Other changes- - Added protected accessors for Textfield::scheduled_edit_command to fix crbug.com/613948. - Made TextInputClient::IsEditCommandEnabled() const. - BridgedContentView now uses MOVE_UP, MOVE_DOWN, MOVE_PAGE_UP, MOVE_PAGE_DOWN commands instead of directly using the corresponding MOVE_TO_BEGINNING/END_OF_LINE command. - Removed the now reduntant resource ids from ui_strings.grd. BUG=586985, 613948

Patch Set 1 : #

Patch Set 2 : Added file deleted during rename. #

Total comments: 11
Unified diffs Side-by-side diffs Delta from patch set Stats (+637 lines, -485 lines) Patch
M blimp/engine/feature/engine_render_widget_feature_unittest.cc View 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_view_views.h View 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_view_views.cc View 8 chunks +93 lines, -43 lines 2 comments Download
M components/arc/ime/arc_ime_service.h View 1 chunk +2 lines, -2 lines 0 comments Download
M components/arc/ime/arc_ime_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.h View 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M ui/base/ime/dummy_text_input_client.h View 1 chunk +2 lines, -2 lines 0 comments Download
M ui/base/ime/dummy_text_input_client.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M ui/base/ime/text_input_client.h View 2 chunks +9 lines, -8 lines 0 comments Download
M ui/events/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M ui/events/events.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A ui/events/text_edit_commands.h View 1 1 chunk +52 lines, -0 lines 3 comments Download
M ui/strings/ui_strings.grd View 1 chunk +0 lines, -66 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 16 chunks +87 lines, -76 lines 0 comments Download
M ui/views/controls/prefix_selector.h View 1 chunk +2 lines, -2 lines 0 comments Download
M ui/views/controls/prefix_selector.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M ui/views/controls/textfield/textfield.h View 4 chunks +19 lines, -10 lines 0 comments Download
M ui/views/controls/textfield/textfield.cc View 15 chunks +333 lines, -252 lines 6 comments Download
M ui/views/view_unittest.cc View 3 chunks +10 lines, -10 lines 0 comments Download

Messages

Total messages: 25 (21 generated)
karandeepb
PTAL Trent. The patch has some inline comments with my doubts and todos. Will remove ...
4 years, 6 months ago (2016-05-27 08:37:55 UTC) #22
karandeepb
ping Trent.
4 years, 6 months ago (2016-05-30 10:03:13 UTC) #23
tapted
the omnibox changes need to be split out Also it doesn't make sense to have ...
4 years, 6 months ago (2016-05-31 04:18:17 UTC) #24
karandeepb
4 years, 6 months ago (2016-05-31 05:12:33 UTC) #25
Will try to split this into smaller CLs. Will also contact one of the owner's to
get their opinion on these changes.

https://codereview.chromium.org/2007503002/diff/350001/chrome/browser/ui/view...
File chrome/browser/ui/views/omnibox/omnibox_view_views.cc (right):

https://codereview.chromium.org/2007503002/diff/350001/chrome/browser/ui/view...
chrome/browser/ui/views/omnibox/omnibox_view_views.cc:957: // What about
IDC_EDIT_SEARCH_ENGINES?
On 2016/05/31 04:18:16, tapted wrote:
> What's the context for this? I think this is deprecated anyway - see
> http://crbug.com/542487 http://crrev.com/392688 . Maybe there's more code to
> tear out.

Edit Search Engines still remains as a context menu action on the omnibox, but
doesn't appear in IsCommandIDEnabled
(https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/...).

https://codereview.chromium.org/2007503002/diff/350001/ui/views/controls/text...
File ui/views/controls/textfield/textfield.cc (right):

https://codereview.chromium.org/2007503002/diff/350001/ui/views/controls/text...
ui/views/controls/textfield/textfield.cc:170: ui::TextEditCommand
GetViewsCommand(const ui::TextEditCommandAuraLinux& command,
On 2016/05/31 04:18:16, tapted wrote:
> Can we delete TextEditCommandAuraLinux::CommandId entirely? This function
should
> become a lot simpler -- maybe something like 
> 
> AdjustEditCommandForRTL(..)
> 
> It does raise the question of what to do with the |extend_selection| boolean
--
> we should either remove it from TextEditCommandAuraLinux or incorporate the
> concept into ui::TextEditCommand

Yeah I thought it might be easier to unify the two in a follow-up, since
TextEditCommandAuraLinux commands are sent to blink, and we'll have to be
careful to not cause any changes with that.

https://codereview.chromium.org/2007503002/diff/350001/ui/views/controls/text...
ui/views/controls/textfield/textfield.cc:1310: void
Textfield::ExecuteCommand(int command_id, int event_flags) {
On 2016/05/31 04:18:17, tapted wrote:
> What's still calling this? (can it be replaced with ExecuteEditCommand?)
> 
> It would be nice for review if we could just change the signature of this
method
> in-place. It's tricky to review when the body is also moving.

IsCommandIdEnabled and ExecuteCommand(command id, event_flags) are
ui::SimpleMenuModel::Delegate overrides. These are used for context menu actions
which can be seen when you right click on textfield/omnibox. Hence I don't think
that this can be removed. 

The problem currently is that all text editing commands in Textfield and
OmniboxViewsView are being routed through these two functions, while they were
probably meant to be used only for menu actions. So this CL is trying to
decouple text edit commands from menu commands, by using IsEditCommandEnabled
(ui::TextInputClient override) and ExecuteEditCommand (new virtual function) for
text editing.

Powered by Google App Engine
This is Rietveld 408576698