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

Issue 2031433002: Views::Textfield: Decouple handling of menu and text editing commands. (Closed)

Created:
4 years, 6 months ago by karandeepb
Modified:
4 years, 6 months ago
Reviewers:
tapted, sky, msw
CC:
chromium-reviews, tfarina, James Su, shuchen+watch_chromium.org, yusukes+watch_chromium.org, nona+watch_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@refactor2_virtual_calls
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Views::Textfield: Decouple handling of menu and text editing commands. Currently, all text editing commands are routed through IsCommandIdEnabled() and ExecuteCommand(int command_id, int event_flags) which are ui::SimpleMenuModel::Delegate overrides. These were probably just meant to be used for menu actions, but are currently also being used for text editing commands. This CL modifies IsCommandIdEnabled and ExecuteCommand(int command_id, int event_flags) in views::Textfield and its subclass OmniboxViewViews, to only handle menu actions. To handle text editing commands, IsEditCommandEnabled (overriden from ui::TextInputClient) is used. Analogous to ExecuteCommand, a protected virtual method ExecuteEditCommand is added to views::Textfield to execute text editing commands. Also, since it's confusing to have both an overloaded and overriden ExecuteCommand method, the overloaded version is removed. A helper function bool `IsMenuCommand(int)` is also added which will be updated in a follow-up (crrev.com/2027133002/) to return a text editing command enum rather than a bool. (i.e. `ui::TextEditCommand GetTextEditCommandFromMenuCommand(int command_id)`). This is first in series of CLs to replace resource ids with a ui::TextEditCommand enum for text editing commands in views::Textfield. Link to complete patch - http://crrev.com/2029733003 BUG=586985 Committed: https://crrev.com/8ca173a988171b43b6686335335f816a0ff27403 Cr-Commit-Position: refs/heads/master@{#400909}

Patch Set 1 #

Patch Set 2 : #

Total comments: 7

Patch Set 3 : Rebase. #

Patch Set 4 : Address review comments. #

Total comments: 6

Patch Set 5 : #

Patch Set 6 : Address review comments. #

Total comments: 5

Patch Set 7 : Rebase. #

Patch Set 8 : DestroyTouchSelection calls. #

Patch Set 9 : #

Total comments: 7

Patch Set 10 : Address review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -199 lines) Patch
M chrome/browser/ui/views/omnibox/omnibox_view_views.h View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_view_views.cc View 1 2 3 4 5 6 7 5 chunks +47 lines, -15 lines 0 comments Download
M ui/views/controls/textfield/textfield.h View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M ui/views/controls/textfield/textfield.cc View 1 2 3 4 5 6 7 8 9 11 chunks +194 lines, -171 lines 0 comments Download
M ui/views/view_unittest.cc View 3 chunks +10 lines, -10 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 30 (13 generated)
tapted
I would also say that it's confusing having Textfield both overload and override a method ...
4 years, 6 months ago (2016-06-06 07:42:27 UTC) #3
karandeepb
PTAL Thanks. https://codereview.chromium.org/2031433002/diff/20001/chrome/browser/ui/views/omnibox/omnibox_view_views.cc File chrome/browser/ui/views/omnibox/omnibox_view_views.cc (right): https://codereview.chromium.org/2031433002/diff/20001/chrome/browser/ui/views/omnibox/omnibox_view_views.cc#newcode927 chrome/browser/ui/views/omnibox/omnibox_view_views.cc:927: case IDS_APP_PASTE: On 2016/06/06 07:42:27, tapted wrote: ...
4 years, 6 months ago (2016-06-08 03:06:58 UTC) #5
tapted
https://codereview.chromium.org/2031433002/diff/60001/ui/views/controls/textfield/textfield.cc File ui/views/controls/textfield/textfield.cc (right): https://codereview.chromium.org/2031433002/diff/60001/ui/views/controls/textfield/textfield.cc#newcode196 ui/views/controls/textfield/textfield.cc:196: // Todo why are these not mapped-- for omnibox? ...
4 years, 6 months ago (2016-06-08 03:56:45 UTC) #6
karandeepb
PTAL Trent. Thanks. https://codereview.chromium.org/2031433002/diff/60001/ui/views/controls/textfield/textfield.cc File ui/views/controls/textfield/textfield.cc (right): https://codereview.chromium.org/2031433002/diff/60001/ui/views/controls/textfield/textfield.cc#newcode196 ui/views/controls/textfield/textfield.cc:196: // Todo why are these not ...
4 years, 6 months ago (2016-06-09 03:37:38 UTC) #8
tapted
https://codereview.chromium.org/2031433002/diff/120001/ui/views/controls/textfield/textfield.cc File ui/views/controls/textfield/textfield.cc (right): https://codereview.chromium.org/2031433002/diff/120001/ui/views/controls/textfield/textfield.cc#newcode1242 ui/views/controls/textfield/textfield.cc:1242: return IsMenuCommand(command_id) && I'm still dubious about the merit ...
4 years, 6 months ago (2016-06-09 04:10:03 UTC) #9
karandeepb
https://codereview.chromium.org/2031433002/diff/120001/ui/views/controls/textfield/textfield.cc File ui/views/controls/textfield/textfield.cc (right): https://codereview.chromium.org/2031433002/diff/120001/ui/views/controls/textfield/textfield.cc#newcode1242 ui/views/controls/textfield/textfield.cc:1242: return IsMenuCommand(command_id) && On 2016/06/09 04:10:03, tapted wrote: > ...
4 years, 6 months ago (2016-06-09 04:51:43 UTC) #10
tapted
lgtm https://codereview.chromium.org/2031433002/diff/120001/ui/views/controls/textfield/textfield.cc File ui/views/controls/textfield/textfield.cc (right): https://codereview.chromium.org/2031433002/diff/120001/ui/views/controls/textfield/textfield.cc#newcode1242 ui/views/controls/textfield/textfield.cc:1242: return IsMenuCommand(command_id) && On 2016/06/09 04:51:42, karandeepb wrote: ...
4 years, 6 months ago (2016-06-09 05:02:01 UTC) #11
karandeepb
On 2016/06/09 05:02:01, tapted wrote: > lgtm > > https://codereview.chromium.org/2031433002/diff/120001/ui/views/controls/textfield/textfield.cc > File ui/views/controls/textfield/textfield.cc (right): > ...
4 years, 6 months ago (2016-06-09 05:10:57 UTC) #13
karandeepb
PTAL msw@. This is first in series of CLs to replace resource ids with a ...
4 years, 6 months ago (2016-06-09 10:47:10 UTC) #15
karandeepb
PTAL msw@. This is first in series of CLs to replace resource ids with a ...
4 years, 6 months ago (2016-06-09 10:50:02 UTC) #17
msw
lgtm with a nit. https://codereview.chromium.org/2031433002/diff/200001/ui/views/controls/textfield/textfield.cc File ui/views/controls/textfield/textfield.cc (right): https://codereview.chromium.org/2031433002/diff/200001/ui/views/controls/textfield/textfield.cc#newcode1276 ui/views/controls/textfield/textfield.cc:1276: if (!Textfield::IsCommandIdEnabled(command_id)) On 2016/06/09 10:47:10, ...
4 years, 6 months ago (2016-06-10 00:07:50 UTC) #19
karandeepb
https://codereview.chromium.org/2031433002/diff/200001/ui/views/controls/textfield/textfield.cc File ui/views/controls/textfield/textfield.cc (right): https://codereview.chromium.org/2031433002/diff/200001/ui/views/controls/textfield/textfield.cc#newcode1276 ui/views/controls/textfield/textfield.cc:1276: if (!Textfield::IsCommandIdEnabled(command_id)) On 2016/06/10 00:07:50, msw wrote: > optional ...
4 years, 6 months ago (2016-06-10 05:52:36 UTC) #20
karandeepb
+sky@ for ui/views/view_unittest.cc review.
4 years, 6 months ago (2016-06-15 06:09:39 UTC) #22
sky
LGTM
4 years, 6 months ago (2016-06-16 16:03:33 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2031433002/220001
4 years, 6 months ago (2016-06-21 05:46:26 UTC) #26
commit-bot: I haz the power
Committed patchset #10 (id:220001)
4 years, 6 months ago (2016-06-21 06:33:29 UTC) #28
commit-bot: I haz the power
4 years, 6 months ago (2016-06-21 06:35:16 UTC) #30
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/8ca173a988171b43b6686335335f816a0ff27403
Cr-Commit-Position: refs/heads/master@{#400909}

Powered by Google App Engine
This is Rietveld 408576698