| OLD | NEW |
| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 | 1720 |
| 1721 void RenderViewImpl::OnSetName(const std::string& name) { | 1721 void RenderViewImpl::OnSetName(const std::string& name) { |
| 1722 if (!webview()) | 1722 if (!webview()) |
| 1723 return; | 1723 return; |
| 1724 | 1724 |
| 1725 webview()->mainFrame()->setName(WebString::fromUTF8(name)); | 1725 webview()->mainFrame()->setName(WebString::fromUTF8(name)); |
| 1726 } | 1726 } |
| 1727 | 1727 |
| 1728 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { | 1728 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { |
| 1729 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1729 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
| 1730 if (!ShouldHandleImeEvent()) |
| 1731 return; |
| 1730 ImeEventGuard guard(this); | 1732 ImeEventGuard guard(this); |
| 1731 webview()->setEditableSelectionOffsets(start, end); | 1733 webview()->setEditableSelectionOffsets(start, end); |
| 1732 } | 1734 } |
| 1733 | 1735 |
| 1734 void RenderViewImpl::OnSetCompositionFromExistingText( | 1736 void RenderViewImpl::OnSetCompositionFromExistingText( |
| 1735 int start, int end, | 1737 int start, int end, |
| 1736 const std::vector<WebKit::WebCompositionUnderline>& underlines) { | 1738 const std::vector<WebKit::WebCompositionUnderline>& underlines) { |
| 1737 if (!webview()) | 1739 if (!ShouldHandleImeEvent()) |
| 1738 return; | 1740 return; |
| 1739 ImeEventGuard guard(this); | 1741 ImeEventGuard guard(this); |
| 1740 webview()->setCompositionFromExistingText(start, end, underlines); | 1742 webview()->setCompositionFromExistingText(start, end, underlines); |
| 1741 } | 1743 } |
| 1742 | 1744 |
| 1743 void RenderViewImpl::OnExtendSelectionAndDelete(int before, int after) { | 1745 void RenderViewImpl::OnExtendSelectionAndDelete(int before, int after) { |
| 1744 if (!webview()) | 1746 if (!ShouldHandleImeEvent()) |
| 1745 return; | 1747 return; |
| 1746 ImeEventGuard guard(this); | 1748 ImeEventGuard guard(this); |
| 1747 webview()->extendSelectionAndDelete(before, after); | 1749 webview()->extendSelectionAndDelete(before, after); |
| 1748 } | 1750 } |
| 1749 | 1751 |
| 1750 void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length, | 1752 void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length, |
| 1751 int32 minimum_page_id) { | 1753 int32 minimum_page_id) { |
| 1752 DCHECK_GE(history_length, 0); | 1754 DCHECK_GE(history_length, 0); |
| 1753 DCHECK(history_list_offset_ == history_list_length_ - 1); | 1755 DCHECK(history_list_offset_ == history_list_length_ - 1); |
| 1754 DCHECK_GE(minimum_page_id, -1); | 1756 DCHECK_GE(minimum_page_id, -1); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 void RenderViewImpl::didChangeSelection(bool is_empty_selection) { | 2355 void RenderViewImpl::didChangeSelection(bool is_empty_selection) { |
| 2354 if (!handling_input_event_ && !handling_select_range_) | 2356 if (!handling_input_event_ && !handling_select_range_) |
| 2355 return; | 2357 return; |
| 2356 | 2358 |
| 2357 if (is_empty_selection) | 2359 if (is_empty_selection) |
| 2358 selection_text_.clear(); | 2360 selection_text_.clear(); |
| 2359 | 2361 |
| 2360 SyncSelectionIfRequired(); | 2362 SyncSelectionIfRequired(); |
| 2361 UpdateTextInputType(); | 2363 UpdateTextInputType(); |
| 2362 #if defined(OS_ANDROID) | 2364 #if defined(OS_ANDROID) |
| 2363 UpdateTextInputState(DO_NOT_SHOW_IME); | 2365 UpdateTextInputState(false, true); |
| 2364 #endif | 2366 #endif |
| 2365 } | 2367 } |
| 2366 | 2368 |
| 2367 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { | 2369 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { |
| 2368 const std::string& name = UTF16ToUTF8(command_name); | 2370 const std::string& name = UTF16ToUTF8(command_name); |
| 2369 if (StartsWithASCII(name, "Move", true) || | 2371 if (StartsWithASCII(name, "Move", true) || |
| 2370 StartsWithASCII(name, "Insert", true) || | 2372 StartsWithASCII(name, "Insert", true) || |
| 2371 StartsWithASCII(name, "Delete", true)) | 2373 StartsWithASCII(name, "Delete", true)) |
| 2372 return; | 2374 return; |
| 2373 RenderThreadImpl::current()->RecordUserMetrics(name); | 2375 RenderThreadImpl::current()->RecordUserMetrics(name); |
| (...skipping 3951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6325 WebURL url = icon_urls[i].iconURL(); | 6327 WebURL url = icon_urls[i].iconURL(); |
| 6326 if (!url.isEmpty()) | 6328 if (!url.isEmpty()) |
| 6327 urls.push_back(FaviconURL(url, | 6329 urls.push_back(FaviconURL(url, |
| 6328 ToFaviconType(icon_urls[i].iconType()))); | 6330 ToFaviconType(icon_urls[i].iconType()))); |
| 6329 } | 6331 } |
| 6330 SendUpdateFaviconURL(urls); | 6332 SendUpdateFaviconURL(urls); |
| 6331 } | 6333 } |
| 6332 | 6334 |
| 6333 | 6335 |
| 6334 } // namespace content | 6336 } // namespace content |
| OLD | NEW |