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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 1155013005: Refactoring the ownership of ui::InputMethod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed bot failure: cast_shell_linux Created 5 years, 6 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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/client/cursor_client.h" 11 #include "ui/aura/client/cursor_client.h"
12 #include "ui/aura/client/focus_client.h" 12 #include "ui/aura/client/focus_client.h"
13 #include "ui/aura/client/screen_position_client.h" 13 #include "ui/aura/client/screen_position_client.h"
14 #include "ui/aura/client/window_tree_client.h" 14 #include "ui/aura/client/window_tree_client.h"
15 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/aura/window_event_dispatcher.h" 17 #include "ui/aura/window_event_dispatcher.h"
18 #include "ui/aura/window_observer.h" 18 #include "ui/aura/window_observer.h"
19 #include "ui/aura/window_tree_host.h"
19 #include "ui/base/dragdrop/os_exchange_data.h" 20 #include "ui/base/dragdrop/os_exchange_data.h"
20 #include "ui/base/ui_base_switches_util.h" 21 #include "ui/base/ui_base_switches_util.h"
21 #include "ui/base/ui_base_types.h" 22 #include "ui/base/ui_base_types.h"
22 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
23 #include "ui/events/event.h" 24 #include "ui/events/event.h"
24 #include "ui/gfx/canvas.h" 25 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/font_list.h" 26 #include "ui/gfx/font_list.h"
26 #include "ui/gfx/screen.h" 27 #include "ui/gfx/screen.h"
27 #include "ui/native_theme/native_theme_aura.h" 28 #include "ui/native_theme/native_theme_aura.h"
28 #include "ui/views/drag_utils.h" 29 #include "ui/views/drag_utils.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return window_ && window_->HasCapture(); 268 return window_ && window_->HasCapture();
268 } 269 }
269 270
270 InputMethod* NativeWidgetAura::CreateInputMethod() { 271 InputMethod* NativeWidgetAura::CreateInputMethod() {
271 if (!window_) 272 if (!window_)
272 return NULL; 273 return NULL;
273 274
274 if (switches::IsTextInputFocusManagerEnabled()) 275 if (switches::IsTextInputFocusManagerEnabled())
275 return new NullInputMethod(); 276 return new NullInputMethod();
276 277
277 aura::Window* root_window = window_->GetRootWindow(); 278 return new InputMethodBridge(this, GetHostInputMethod(), true);
278 ui::InputMethod* host =
279 root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
280 return new InputMethodBridge(this, host, true);
281 } 279 }
282 280
283 internal::InputMethodDelegate* NativeWidgetAura::GetInputMethodDelegate() { 281 internal::InputMethodDelegate* NativeWidgetAura::GetInputMethodDelegate() {
284 return this; 282 return this;
285 } 283 }
286 284
287 ui::InputMethod* NativeWidgetAura::GetHostInputMethod() { 285 ui::InputMethod* NativeWidgetAura::GetHostInputMethod() {
288 aura::Window* root_window = window_->GetRootWindow(); 286 aura::Window* root_window = window_->GetRootWindow();
289 return root_window->GetProperty(aura::client::kRootWindowInputMethodKey); 287 return root_window->GetHost()->GetInputMethod();
290 } 288 }
291 289
292 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { 290 void NativeWidgetAura::CenterWindow(const gfx::Size& size) {
293 if (!window_) 291 if (!window_)
294 return; 292 return;
295 293
296 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); 294 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow());
297 // When centering window, we take the intersection of the host and 295 // When centering window, we take the intersection of the host and
298 // the parent. We assume the root window represents the visible 296 // the parent. We assume the root window represents the visible
299 // rect of a single screen. 297 // rect of a single screen.
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1205 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1208 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1206 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1209 return gfx::FontList(gfx::Font(caption_font)); 1207 return gfx::FontList(gfx::Font(caption_font));
1210 #else 1208 #else
1211 return gfx::FontList(); 1209 return gfx::FontList();
1212 #endif 1210 #endif
1213 } 1211 }
1214 1212
1215 } // namespace internal 1213 } // namespace internal
1216 } // namespace views 1214 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698