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

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

Issue 2909603002: Revert of Remove InputMethodEventHandler. (Closed)
Patch Set: 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
« no previous file with comments | « ash/display/window_tree_host_manager.h ('k') | ash/host/ash_window_tree_host.h » ('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 "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"
20 #include "ash/magnifier/magnification_controller.h" 21 #include "ash/magnifier/magnification_controller.h"
21 #include "ash/magnifier/partial_magnification_controller.h" 22 #include "ash/magnifier/partial_magnification_controller.h"
22 #include "ash/public/cpp/config.h" 23 #include "ash/public/cpp/config.h"
23 #include "ash/root_window_controller.h" 24 #include "ash/root_window_controller.h"
24 #include "ash/root_window_settings.h" 25 #include "ash/root_window_settings.h"
25 #include "ash/shell.h" 26 #include "ash/shell.h"
26 #include "ash/system/tray/system_tray.h" 27 #include "ash/system/tray/system_tray.h"
27 #include "ash/wm/window_util.h" 28 #include "ash/wm/window_util.h"
28 #include "base/command_line.h" 29 #include "base/command_line.h"
29 #include "base/strings/stringprintf.h" 30 #include "base/strings/stringprintf.h"
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // When using IME service, input method is hosted by the browser process, so 833 // When using IME service, input method is hosted by the browser process, so
833 // we don't need to create and set it here. 834 // we don't need to create and set it here.
834 if (!Shell::ShouldUseIMEService()) { 835 if (!Shell::ShouldUseIMEService()) {
835 DCHECK(!host->has_input_method()); 836 DCHECK(!host->has_input_method());
836 if (!input_method_) { // Singleton input method instance for Ash. 837 if (!input_method_) { // Singleton input method instance for Ash.
837 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); 838 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget());
838 // Makes sure the input method is focused by default when created, because 839 // Makes sure the input method is focused by default when created, because
839 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when 840 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when
840 // the active window changed. 841 // the active window changed.
841 input_method_->OnFocus(); 842 input_method_->OnFocus();
843 input_method_event_handler_.reset(
844 new InputMethodEventHandler(input_method_.get()));
842 } 845 }
843 host->SetSharedInputMethod(input_method_.get()); 846 host->SetSharedInputMethod(input_method_.get());
847 ash_host->set_input_method_handler(input_method_event_handler_.get());
844 } 848 }
845 849
846 host->window()->SetName(base::StringPrintf( 850 host->window()->SetName(base::StringPrintf(
847 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "", 851 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "",
848 host_count++)); 852 host_count++));
849 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name())); 853 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name()));
850 host->compositor()->SetBackgroundColor(SK_ColorBLACK); 854 host->compositor()->SetBackgroundColor(SK_ColorBLACK);
851 // No need to remove our observer observer because the WindowTreeHostManager 855 // No need to remove our observer observer because the WindowTreeHostManager
852 // outlives the host. 856 // outlives the host.
853 host->AddObserver(this); 857 host->AddObserver(this);
854 InitRootWindowSettings(host->window())->display_id = display.id(); 858 InitRootWindowSettings(host->window())->display_id = display.id();
855 host->InitHost(); 859 host->InitHost();
856 host->window()->Show(); 860 host->window()->Show();
857 861
858 window_tree_hosts_[display.id()] = ash_host; 862 window_tree_hosts_[display.id()] = ash_host;
859 SetDisplayPropertiesOnHost(ash_host, display); 863 SetDisplayPropertiesOnHost(ash_host, display);
860 864
861 if (switches::ConstrainPointerToRoot()) 865 if (switches::ConstrainPointerToRoot())
862 ash_host->ConfineCursorToRootWindow(); 866 ash_host->ConfineCursorToRootWindow();
863 return ash_host; 867 return ash_host;
864 } 868 }
865 869
866 } // namespace ash 870 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/window_tree_host_manager.h ('k') | ash/host/ash_window_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698