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

Side by Side Diff: ui/views/focus/focus_manager.cc

Issue 2345183002: Views: Draw Textfield selected text in gray when top-level Widget loses focus.
Patch Set: Fix up colors for Linux. Created 4 years, 1 month 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
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/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 25 matching lines...) Expand all
36 shortcut_handling_suspended_(false), 36 shortcut_handling_suspended_(false),
37 focus_change_reason_(kReasonDirectFocusChange), 37 focus_change_reason_(kReasonDirectFocusChange),
38 is_changing_focus_(false), 38 is_changing_focus_(false),
39 keyboard_accessible_(false) { 39 keyboard_accessible_(false) {
40 DCHECK(widget_); 40 DCHECK(widget_);
41 stored_focused_view_storage_id_ = 41 stored_focused_view_storage_id_ =
42 ViewStorage::GetInstance()->CreateStorageID(); 42 ViewStorage::GetInstance()->CreateStorageID();
43 } 43 }
44 44
45 FocusManager::~FocusManager() { 45 FocusManager::~FocusManager() {
46 for (FocusChangeListener& observer : focus_change_listeners_)
47 observer.OnFocusManagerDestroying();
46 } 48 }
47 49
48 bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) { 50 bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) {
49 const int key_code = event.key_code(); 51 const int key_code = event.key_code();
50 52
51 if (event.type() != ui::ET_KEY_PRESSED && event.type() != ui::ET_KEY_RELEASED) 53 if (event.type() != ui::ET_KEY_PRESSED && event.type() != ui::ET_KEY_RELEASED)
52 return false; 54 return false;
53 55
54 if (shortcut_handling_suspended()) 56 if (shortcut_handling_suspended())
55 return true; 57 return true;
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 // |keyboard_accessible_| is only used on Mac. 570 // |keyboard_accessible_| is only used on Mac.
569 #if defined(OS_MACOSX) 571 #if defined(OS_MACOSX)
570 return keyboard_accessible_ ? view->IsAccessibilityFocusable() 572 return keyboard_accessible_ ? view->IsAccessibilityFocusable()
571 : view->IsFocusable(); 573 : view->IsFocusable();
572 #else 574 #else
573 return view->IsAccessibilityFocusable(); 575 return view->IsAccessibilityFocusable();
574 #endif 576 #endif
575 } 577 }
576 578
577 } // namespace views 579 } // namespace views
OLDNEW
« ui/views/controls/textfield/textfield.cc ('K') | « ui/views/focus/focus_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698