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

Side by Side Diff: ui/views/corewm/focus_change_shim.cc

Issue 11421194: Hook up the FocusController behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/corewm/focus_change_shim.h"
6
7 #include "base/command_line.h"
8 #include "ui/aura/window.h"
9 #include "ui/base/events/event_target.h"
10 #include "ui/views/corewm/corewm_switches.h"
11 #include "ui/views/corewm/focus_change_event.h"
12
13 namespace views {
14 namespace corewm {
15 namespace {
16 bool UseFocusController() {
17 return CommandLine::ForCurrentProcess()->HasSwitch(
18 switches::kUseFocusController);
19 }
20 }
21
22 FocusChangeShim::FocusChangeShim(ui::EventTarget* target) {
23 if (UseFocusController())
24 target->AddPreTargetHandler(this);
25 }
26
27 FocusChangeShim::~FocusChangeShim() {
sadrul 2012/12/03 06:32:17 Does this need to remove itself as a pre-target ha
28 }
29
30 void FocusChangeShim::OnWindowFocused(aura::Window* window) {
31 }
32
33 ui::EventResult FocusChangeShim::OnEvent(ui::Event* event) {
34 if (event->type() == FocusChangeEvent::focus_changed_event_type()) {
35 DCHECK(UseFocusController());
36 OnWindowFocused(static_cast<aura::Window*>(event->target()));
37 }
38 return EventHandler::OnEvent(event);
39 }
40
41 } // namespace corewm
42 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698