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

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

Issue 2831583005: Enable Config::MUS to use classic IME instead of servicified IME. (Closed)
Patch Set: Addressed feedback. 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 | « no previous file | ash/mus/ash_window_tree_host_mus.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>
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 params_with_bounds.offscreen = 816 params_with_bounds.offscreen =
817 display.id() == display::DisplayManager::kUnifiedDisplayId; 817 display.id() == display::DisplayManager::kUnifiedDisplayId;
818 params_with_bounds.display_id = display.id(); 818 params_with_bounds.display_id = display.id();
819 params_with_bounds.device_scale_factor = display.device_scale_factor(); 819 params_with_bounds.device_scale_factor = display.device_scale_factor();
820 params_with_bounds.ui_scale_factor = display_info.configured_ui_scale(); 820 params_with_bounds.ui_scale_factor = display_info.configured_ui_scale();
821 // The AshWindowTreeHost ends up owned by the RootWindowControllers created 821 // The AshWindowTreeHost ends up owned by the RootWindowControllers created
822 // by this class. 822 // by this class.
823 AshWindowTreeHost* ash_host = 823 AshWindowTreeHost* ash_host =
824 AshWindowTreeHost::Create(params_with_bounds).release(); 824 AshWindowTreeHost::Create(params_with_bounds).release();
825 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); 825 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost();
826 // TODO: Config::MUS should not install an InputMethod. 826 DCHECK(!host->has_input_method());
sky 2017/05/03 15:25:27 The plan is to use this code for both mash and mus
Hadi 2017/05/03 19:35:42 Done.
827 // http://crbug.com/706913 827 if (!input_method_) { // Singleton input method instance for Ash.
828 if (!host->has_input_method()) { 828 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget());
829 if (!input_method_) { // Singleton input method instance for Ash. 829 // Makes sure the input method is focused by default when created, because
830 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); 830 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when
831 // Makes sure the input method is focused by default when created, because 831 // the active window changed.
832 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when 832 input_method_->OnFocus();
833 // the active window changed. 833 input_method_event_handler_.reset(
834 input_method_->OnFocus(); 834 new InputMethodEventHandler(input_method_.get()));
835 input_method_event_handler_.reset(
836 new InputMethodEventHandler(input_method_.get()));
837 }
838 host->SetSharedInputMethod(input_method_.get());
839 ash_host->set_input_method_handler(input_method_event_handler_.get());
840 } 835 }
836 host->SetSharedInputMethod(input_method_.get());
837 ash_host->set_input_method_handler(input_method_event_handler_.get());
841 838
842 host->window()->SetName(base::StringPrintf( 839 host->window()->SetName(base::StringPrintf(
843 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "", 840 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "",
844 host_count++)); 841 host_count++));
845 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name())); 842 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name()));
846 host->compositor()->SetBackgroundColor(SK_ColorBLACK); 843 host->compositor()->SetBackgroundColor(SK_ColorBLACK);
847 // No need to remove our observer observer because the WindowTreeHostManager 844 // No need to remove our observer observer because the WindowTreeHostManager
848 // outlives the host. 845 // outlives the host.
849 host->AddObserver(this); 846 host->AddObserver(this);
850 InitRootWindowSettings(host->window())->display_id = display.id(); 847 InitRootWindowSettings(host->window())->display_id = display.id();
851 host->InitHost(); 848 host->InitHost();
852 host->window()->Show(); 849 host->window()->Show();
853 850
854 window_tree_hosts_[display.id()] = ash_host; 851 window_tree_hosts_[display.id()] = ash_host;
855 SetDisplayPropertiesOnHost(ash_host, display); 852 SetDisplayPropertiesOnHost(ash_host, display);
856 853
857 if (switches::ConstrainPointerToRoot()) 854 if (switches::ConstrainPointerToRoot())
858 ash_host->ConfineCursorToRootWindow(); 855 ash_host->ConfineCursorToRootWindow();
859 return ash_host; 856 return ash_host;
860 } 857 }
861 858
862 } // namespace ash 859 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/mus/ash_window_tree_host_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698