OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 std::wstring ignored_result; | 2182 std::wstring ignored_result; |
2183 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm( | 2183 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm( |
2184 routing_id_, frame->url(), UTF16ToWideHack(message), &success, | 2184 routing_id_, frame->url(), UTF16ToWideHack(message), &success, |
2185 &ignored_result)); | 2185 &ignored_result)); |
2186 return success; | 2186 return success; |
2187 } | 2187 } |
2188 | 2188 |
2189 void RenderView::showContextMenu( | 2189 void RenderView::showContextMenu( |
2190 WebFrame* frame, const WebContextMenuData& data) { | 2190 WebFrame* frame, const WebContextMenuData& data) { |
2191 ContextMenuParams params = ContextMenuParams(data); | 2191 ContextMenuParams params = ContextMenuParams(data); |
| 2192 #if !defined(WEBSPELLCHECKCLIENT_HAS_SUGGESTIONS) |
2192 if (!params.misspelled_word.empty() && RenderThread::current()) { | 2193 if (!params.misspelled_word.empty() && RenderThread::current()) { |
2193 int misspelled_offset, misspelled_length; | 2194 int misspelled_offset, misspelled_length; |
2194 bool spelled_right = RenderThread::current()->spellchecker()-> | 2195 bool spelled_right = RenderThread::current()->spellchecker()-> |
2195 SpellCheckWord( | 2196 SpellCheckWord( |
2196 params.misspelled_word.c_str(), params.misspelled_word.size(), | 2197 params.misspelled_word.c_str(), params.misspelled_word.size(), |
2197 spellcheck_provider_->document_tag(), | 2198 spellcheck_provider_->document_tag(), |
2198 &misspelled_offset, &misspelled_length, | 2199 &misspelled_offset, &misspelled_length, |
2199 ¶ms.dictionary_suggestions); | 2200 ¶ms.dictionary_suggestions); |
2200 if (spelled_right) | 2201 if (spelled_right) |
2201 params.misspelled_word.clear(); | 2202 params.misspelled_word.clear(); |
2202 } | 2203 } |
| 2204 #endif |
| 2205 |
2203 // Serializing a GURL longer than content::kMaxURLChars will fail, so don't do | 2206 // Serializing a GURL longer than content::kMaxURLChars will fail, so don't do |
2204 // it. We replace it with an empty GURL so the appropriate items are disabled | 2207 // it. We replace it with an empty GURL so the appropriate items are disabled |
2205 // in the context menu. | 2208 // in the context menu. |
2206 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large | 2209 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large |
2207 // data encoded images. We should have a way to save them. | 2210 // data encoded images. We should have a way to save them. |
2208 if (params.src_url.spec().size() > content::kMaxURLChars) | 2211 if (params.src_url.spec().size() > content::kMaxURLChars) |
2209 params.src_url = GURL(); | 2212 params.src_url = GURL(); |
2210 context_menu_node_ = data.node; | 2213 context_menu_node_ = data.node; |
2211 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); | 2214 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); |
2212 } | 2215 } |
(...skipping 2847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5060 const webkit_glue::CustomContextMenuContext& custom_context) { | 5063 const webkit_glue::CustomContextMenuContext& custom_context) { |
5061 if (custom_context.is_pepper_menu) | 5064 if (custom_context.is_pepper_menu) |
5062 pepper_delegate_.OnContextMenuClosed(custom_context); | 5065 pepper_delegate_.OnContextMenuClosed(custom_context); |
5063 else | 5066 else |
5064 context_menu_node_.reset(); | 5067 context_menu_node_.reset(); |
5065 } | 5068 } |
5066 | 5069 |
5067 void RenderView::OnNetworkStateChanged(bool online) { | 5070 void RenderView::OnNetworkStateChanged(bool online) { |
5068 WebNetworkStateNotifier::setOnLine(online); | 5071 WebNetworkStateNotifier::setOnLine(online); |
5069 } | 5072 } |
OLD | NEW |