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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1234193002: Simplify InputMethodWin initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 range.GetMin() - selection_text_offset_, 1743 range.GetMin() - selection_text_offset_,
1744 range.length()); 1744 range.length());
1745 } 1745 }
1746 return true; 1746 return true;
1747 } 1747 }
1748 1748
1749 void RenderWidgetHostViewAura::OnInputMethodChanged() { 1749 void RenderWidgetHostViewAura::OnInputMethodChanged() {
1750 if (!host_) 1750 if (!host_)
1751 return; 1751 return;
1752 1752
1753 if (GetInputMethod())
1754 host_->SetInputMethodActive(GetInputMethod()->IsActive());
1755
1756 // TODO(suzhe): implement the newly added “locale” property of HTML DOM 1753 // TODO(suzhe): implement the newly added “locale” property of HTML DOM
1757 // TextEvent. 1754 // TextEvent.
1758 } 1755 }
1759 1756
1760 bool RenderWidgetHostViewAura::ChangeTextDirectionAndLayoutAlignment( 1757 bool RenderWidgetHostViewAura::ChangeTextDirectionAndLayoutAlignment(
1761 base::i18n::TextDirection direction) { 1758 base::i18n::TextDirection direction) {
1762 if (!host_) 1759 if (!host_)
1763 return false; 1760 return false;
1764 host_->UpdateTextDirection( 1761 host_->UpdateTextDirection(
1765 direction == base::i18n::RIGHT_TO_LEFT ? 1762 direction == base::i18n::RIGHT_TO_LEFT ?
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 return; 2292 return;
2296 2293
2297 host_->GotFocus(); 2294 host_->GotFocus();
2298 host_->SetActive(true); 2295 host_->SetActive(true);
2299 2296
2300 ui::InputMethod* input_method = GetInputMethod(); 2297 ui::InputMethod* input_method = GetInputMethod();
2301 if (input_method) { 2298 if (input_method) {
2302 // Ask the system-wide IME to send all TextInputClient messages to |this| 2299 // Ask the system-wide IME to send all TextInputClient messages to |this|
2303 // object. 2300 // object.
2304 input_method->SetFocusedTextInputClient(this); 2301 input_method->SetFocusedTextInputClient(this);
2305 host_->SetInputMethodActive(input_method->IsActive());
2306 2302
2307 // Often the application can set focus to the view in response to a key 2303 // Often the application can set focus to the view in response to a key
2308 // down. However the following char event shouldn't be sent to the web 2304 // down. However the following char event shouldn't be sent to the web
2309 // page. 2305 // page.
2310 host_->SuppressNextCharEvents(); 2306 host_->SuppressNextCharEvents();
2311 } else {
2312 host_->SetInputMethodActive(false);
2313 } 2307 }
2314 2308
2315 BrowserAccessibilityManager* manager = 2309 BrowserAccessibilityManager* manager =
2316 host_->GetRootBrowserAccessibilityManager(); 2310 host_->GetRootBrowserAccessibilityManager();
2317 if (manager) 2311 if (manager)
2318 manager->OnWindowFocused(); 2312 manager->OnWindowFocused();
2319 } else if (window_ == lost_focus) { 2313 } else if (window_ == lost_focus) {
2320 host_->SetActive(false); 2314 host_->SetActive(false);
2321 host_->Blur(); 2315 host_->Blur();
2322 2316
2323 DetachFromInputMethod(); 2317 DetachFromInputMethod();
2324 host_->SetInputMethodActive(false);
2325 2318
2326 if (touch_editing_client_) 2319 if (touch_editing_client_)
2327 touch_editing_client_->EndTouchEditing(false); 2320 touch_editing_client_->EndTouchEditing(false);
2328 2321
2329 if (overscroll_controller_) 2322 if (overscroll_controller_)
2330 overscroll_controller_->Cancel(); 2323 overscroll_controller_->Cancel();
2331 2324
2332 BrowserAccessibilityManager* manager = 2325 BrowserAccessibilityManager* manager =
2333 host_->GetRootBrowserAccessibilityManager(); 2326 host_->GetRootBrowserAccessibilityManager();
2334 if (manager) 2327 if (manager)
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 2786
2794 //////////////////////////////////////////////////////////////////////////////// 2787 ////////////////////////////////////////////////////////////////////////////////
2795 // RenderWidgetHostViewBase, public: 2788 // RenderWidgetHostViewBase, public:
2796 2789
2797 // static 2790 // static
2798 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2791 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2799 GetScreenInfoForWindow(results, NULL); 2792 GetScreenInfoForWindow(results, NULL);
2800 } 2793 }
2801 2794
2802 } // namespace content 2795 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698