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

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

Issue 6287002: Fix for broken build (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/textfield/native_textfield_views.h" 5 #include "views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 void NativeTextfieldViews::HandleWillLoseFocus() { 303 void NativeTextfieldViews::HandleWillLoseFocus() {
304 // Stop blinking cursor. 304 // Stop blinking cursor.
305 cursor_timer_.RevokeAll(); 305 cursor_timer_.RevokeAll();
306 if (is_cursor_visible_) { 306 if (is_cursor_visible_) {
307 is_cursor_visible_ = false; 307 is_cursor_visible_ = false;
308 RepaintCursor(); 308 RepaintCursor();
309 } 309 }
310 } 310 }
311 311
312 ///////////////////////////////////////////////////////////////// 312 /////////////////////////////////////////////////////////////////
313 // NativeTextfieldViews, menus::SimpleMenuModel::Delegate overrides: 313 // NativeTextfieldViews, ui::SimpleMenuModel::Delegate overrides:
314 314
315 bool NativeTextfieldViews::IsCommandIdChecked(int command_id) const { 315 bool NativeTextfieldViews::IsCommandIdChecked(int command_id) const {
316 return true; 316 return true;
317 } 317 }
318 318
319 bool NativeTextfieldViews::IsCommandIdEnabled(int command_id) const { 319 bool NativeTextfieldViews::IsCommandIdEnabled(int command_id) const {
320 string16 result; 320 string16 result;
321 switch (command_id) { 321 switch (command_id) {
322 case IDS_APP_CUT: 322 case IDS_APP_CUT:
323 return model_->HasSelection(); 323 return model_->HasSelection();
324 case IDS_APP_COPY: 324 case IDS_APP_COPY:
325 return model_->HasSelection(); 325 return model_->HasSelection();
326 case IDS_APP_PASTE: 326 case IDS_APP_PASTE:
327 views::ViewsDelegate::views_delegate->GetClipboard() 327 views::ViewsDelegate::views_delegate->GetClipboard()
328 ->ReadText(ui::Clipboard::BUFFER_STANDARD, &result); 328 ->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
329 return !result.empty(); 329 return !result.empty();
330 case IDS_APP_DELETE: 330 case IDS_APP_DELETE:
331 return model_->HasSelection(); 331 return model_->HasSelection();
332 case IDS_APP_SELECT_ALL: 332 case IDS_APP_SELECT_ALL:
333 return true; 333 return true;
334 default: 334 default:
335 NOTREACHED(); 335 NOTREACHED();
336 return false; 336 return false;
337 } 337 }
338 } 338 }
339 339
340 bool NativeTextfieldViews::GetAcceleratorForCommandId(int command_id, 340 bool NativeTextfieldViews::GetAcceleratorForCommandId(int command_id,
341 menus::Accelerator* accelerator) { 341 ui::Accelerator* accelerator) {
342 return false; 342 return false;
343 } 343 }
344 344
345 void NativeTextfieldViews::ExecuteCommand(int command_id) { 345 void NativeTextfieldViews::ExecuteCommand(int command_id) {
346 bool text_changed = false; 346 bool text_changed = false;
347 switch (command_id) { 347 switch (command_id) {
348 case IDS_APP_CUT: 348 case IDS_APP_CUT:
349 text_changed = model_->Cut(); 349 text_changed = model_->Cut();
350 break; 350 break;
351 case IDS_APP_COPY: 351 case IDS_APP_COPY:
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 void NativeTextfieldViews::PropagateTextChange() { 765 void NativeTextfieldViews::PropagateTextChange() {
766 textfield_->SyncText(); 766 textfield_->SyncText();
767 Textfield::Controller* controller = textfield_->GetController(); 767 Textfield::Controller* controller = textfield_->GetController();
768 if (controller) 768 if (controller)
769 controller->ContentsChanged(textfield_, GetText()); 769 controller->ContentsChanged(textfield_, GetText());
770 } 770 }
771 771
772 void NativeTextfieldViews::InitContextMenuIfRequired() { 772 void NativeTextfieldViews::InitContextMenuIfRequired() {
773 if (context_menu_menu_.get()) 773 if (context_menu_menu_.get())
774 return; 774 return;
775 context_menu_contents_.reset(new menus::SimpleMenuModel(this)); 775 context_menu_contents_.reset(new ui::SimpleMenuModel(this));
776 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT); 776 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT);
777 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); 777 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY);
778 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE); 778 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE);
779 context_menu_contents_->AddItemWithStringId(IDS_APP_DELETE, IDS_APP_DELETE); 779 context_menu_contents_->AddItemWithStringId(IDS_APP_DELETE, IDS_APP_DELETE);
780 context_menu_contents_->AddSeparator(); 780 context_menu_contents_->AddSeparator();
781 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL, 781 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL,
782 IDS_APP_SELECT_ALL); 782 IDS_APP_SELECT_ALL);
783 context_menu_menu_.reset(new Menu2(context_menu_contents_.get())); 783 context_menu_menu_.reset(new Menu2(context_menu_contents_.get()));
784 } 784 }
785 785
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 831 }
832 832
833 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, 833 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top,
834 int left, 834 int left,
835 int bottom, 835 int bottom,
836 int right) { 836 int right) {
837 insets_.Set(top, left, bottom, right); 837 insets_.Set(top, left, bottom, right);
838 } 838 }
839 839
840 } // namespace views 840 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/textfield/native_textfield_views.h ('k') | views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698