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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 2264403006: Update ui/views menus to use async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Updates Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar.cc ('k') | ui/views/examples/menu_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 context_menu_contents_->AddItemWithStringId(IDS_APP_DELETE, IDS_APP_DELETE); 1944 context_menu_contents_->AddItemWithStringId(IDS_APP_DELETE, IDS_APP_DELETE);
1945 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); 1945 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1946 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL, 1946 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL,
1947 IDS_APP_SELECT_ALL); 1947 IDS_APP_SELECT_ALL);
1948 1948
1949 // If the controller adds menu commands, also override ExecuteCommand() and 1949 // If the controller adds menu commands, also override ExecuteCommand() and
1950 // IsCommandIdEnabled() as appropriate, for the commands added. 1950 // IsCommandIdEnabled() as appropriate, for the commands added.
1951 if (controller_) 1951 if (controller_)
1952 controller_->UpdateContextMenu(context_menu_contents_.get()); 1952 controller_->UpdateContextMenu(context_menu_contents_.get());
1953 } 1953 }
1954 context_menu_runner_.reset( 1954 context_menu_runner_.reset(new MenuRunner(context_menu_contents_.get(),
1955 new MenuRunner(context_menu_contents_.get(), 1955 MenuRunner::HAS_MNEMONICS |
1956 MenuRunner::HAS_MNEMONICS | MenuRunner::CONTEXT_MENU)); 1956 MenuRunner::CONTEXT_MENU |
1957 MenuRunner::ASYNC));
1957 } 1958 }
1958 1959
1959 void Textfield::TrackMouseClicks(const ui::MouseEvent& event) { 1960 void Textfield::TrackMouseClicks(const ui::MouseEvent& event) {
1960 if (event.IsOnlyLeftMouseButton()) { 1961 if (event.IsOnlyLeftMouseButton()) {
1961 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; 1962 base::TimeDelta time_delta = event.time_stamp() - last_click_time_;
1962 if (!last_click_time_.is_null() && 1963 if (!last_click_time_.is_null() &&
1963 time_delta.InMilliseconds() <= GetDoubleClickInterval() && 1964 time_delta.InMilliseconds() <= GetDoubleClickInterval() &&
1964 !ExceededDragThreshold(event.location() - last_click_location_)) { 1965 !ExceededDragThreshold(event.location() - last_click_location_)) {
1965 // Upon clicking after a triple click, the count should go back to double 1966 // Upon clicking after a triple click, the count should go back to double
1966 // click and alternate between double and triple. This assignment maps 1967 // click and alternate between double and triple. This assignment maps
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 RequestFocus(); 2026 RequestFocus();
2026 model_->MoveCursorTo(mouse); 2027 model_->MoveCursorTo(mouse);
2027 if (!selection_clipboard_text.empty()) { 2028 if (!selection_clipboard_text.empty()) {
2028 model_->InsertText(selection_clipboard_text); 2029 model_->InsertText(selection_clipboard_text);
2029 UpdateAfterChange(true, true); 2030 UpdateAfterChange(true, true);
2030 } 2031 }
2031 OnAfterUserAction(); 2032 OnAfterUserAction();
2032 } 2033 }
2033 2034
2034 } // namespace views 2035 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar.cc ('k') | ui/views/examples/menu_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698