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

Side by Side Diff: ash/display/window_tree_host_manager.cc

Issue 2872343003: Remove InputMethodEventHandler. (Closed)
Patch Set: Add a unittest. Created 3 years, 7 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
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 "ash/display/window_tree_host_manager.h" 5 #include "ash/display/window_tree_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 12
13 #include "ash/ash_switches.h" 13 #include "ash/ash_switches.h"
14 #include "ash/display/cursor_window_controller.h" 14 #include "ash/display/cursor_window_controller.h"
15 #include "ash/display/mirror_window_controller.h" 15 #include "ash/display/mirror_window_controller.h"
16 #include "ash/display/root_window_transformers.h" 16 #include "ash/display/root_window_transformers.h"
17 #include "ash/host/ash_window_tree_host.h" 17 #include "ash/host/ash_window_tree_host.h"
18 #include "ash/host/ash_window_tree_host_init_params.h" 18 #include "ash/host/ash_window_tree_host_init_params.h"
19 #include "ash/host/root_window_transformer.h" 19 #include "ash/host/root_window_transformer.h"
20 #include "ash/ime/input_method_event_handler.h"
21 #include "ash/magnifier/magnification_controller.h" 20 #include "ash/magnifier/magnification_controller.h"
22 #include "ash/magnifier/partial_magnification_controller.h" 21 #include "ash/magnifier/partial_magnification_controller.h"
23 #include "ash/public/cpp/config.h" 22 #include "ash/public/cpp/config.h"
24 #include "ash/root_window_controller.h" 23 #include "ash/root_window_controller.h"
25 #include "ash/root_window_settings.h" 24 #include "ash/root_window_settings.h"
26 #include "ash/shell.h" 25 #include "ash/shell.h"
27 #include "ash/system/tray/system_tray.h" 26 #include "ash/system/tray/system_tray.h"
28 #include "ash/wm/window_util.h" 27 #include "ash/wm/window_util.h"
29 #include "base/command_line.h" 28 #include "base/command_line.h"
30 #include "base/strings/stringprintf.h" 29 #include "base/strings/stringprintf.h"
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // When using IME service, input method is hosted by the browser process, so 826 // When using IME service, input method is hosted by the browser process, so
828 // we don't need to create and set it here. 827 // we don't need to create and set it here.
829 if (!Shell::ShouldUseIMEService()) { 828 if (!Shell::ShouldUseIMEService()) {
830 DCHECK(!host->has_input_method()); 829 DCHECK(!host->has_input_method());
831 if (!input_method_) { // Singleton input method instance for Ash. 830 if (!input_method_) { // Singleton input method instance for Ash.
832 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); 831 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget());
833 // Makes sure the input method is focused by default when created, because 832 // Makes sure the input method is focused by default when created, because
834 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when 833 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when
835 // the active window changed. 834 // the active window changed.
836 input_method_->OnFocus(); 835 input_method_->OnFocus();
837 input_method_event_handler_.reset(
838 new InputMethodEventHandler(input_method_.get()));
839 } 836 }
840 host->SetSharedInputMethod(input_method_.get()); 837 host->SetSharedInputMethod(input_method_.get());
841 ash_host->set_input_method_handler(input_method_event_handler_.get());
842 } 838 }
843 839
844 host->window()->SetName(base::StringPrintf( 840 host->window()->SetName(base::StringPrintf(
845 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "", 841 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "",
846 host_count++)); 842 host_count++));
847 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name())); 843 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name()));
848 host->compositor()->SetBackgroundColor(SK_ColorBLACK); 844 host->compositor()->SetBackgroundColor(SK_ColorBLACK);
849 // No need to remove our observer observer because the WindowTreeHostManager 845 // No need to remove our observer observer because the WindowTreeHostManager
850 // outlives the host. 846 // outlives the host.
851 host->AddObserver(this); 847 host->AddObserver(this);
852 InitRootWindowSettings(host->window())->display_id = display.id(); 848 InitRootWindowSettings(host->window())->display_id = display.id();
853 host->InitHost(); 849 host->InitHost();
854 host->window()->Show(); 850 host->window()->Show();
855 851
856 window_tree_hosts_[display.id()] = ash_host; 852 window_tree_hosts_[display.id()] = ash_host;
857 SetDisplayPropertiesOnHost(ash_host, display); 853 SetDisplayPropertiesOnHost(ash_host, display);
858 854
859 if (switches::ConstrainPointerToRoot()) 855 if (switches::ConstrainPointerToRoot())
860 ash_host->ConfineCursorToRootWindow(); 856 ash_host->ConfineCursorToRootWindow();
861 return ash_host; 857 return ash_host;
862 } 858 }
863 859
864 } // namespace ash 860 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698