OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 | 8 |
9 MSVC_PUSH_WARNING_LEVEL(0); | 9 MSVC_PUSH_WARNING_LEVEL(0); |
10 #include "ContextMenu.h" | 10 #include "ContextMenu.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 // If it's not a link, an image or an image link, show a selection menu or a | 172 // If it's not a link, an image or an image link, show a selection menu or a |
173 // more generic page menu. | 173 // more generic page menu. |
174 std::wstring selection_text_string; | 174 std::wstring selection_text_string; |
175 std::wstring misspelled_word_string; | 175 std::wstring misspelled_word_string; |
176 GURL frame_url; | 176 GURL frame_url; |
177 GURL page_url; | 177 GURL page_url; |
178 std::string security_info; | 178 std::string security_info; |
179 | 179 |
180 std::wstring frame_encoding; | 180 std::string frame_charset = WideToASCII( |
| 181 webkit_glue::StringToStdWString(selected_frame->loader()->encoding())); |
181 // Send the frame and page URLs in any case. | 182 // Send the frame and page URLs in any case. |
182 ContextNode frame_node = ContextNode(ContextNode::NONE); | 183 ContextNode frame_node = ContextNode(ContextNode::NONE); |
183 ContextNode page_node = | 184 ContextNode page_node = |
184 GetTypeAndURLFromFrame(webview_->main_frame()->frame(), | 185 GetTypeAndURLFromFrame(webview_->main_frame()->frame(), |
185 &page_url, | 186 &page_url, |
186 ContextNode(ContextNode::PAGE)); | 187 ContextNode(ContextNode::PAGE)); |
187 if (selected_frame != webview_->main_frame()->frame()) { | 188 if (selected_frame != webview_->main_frame()->frame()) { |
188 frame_node = GetTypeAndURLFromFrame(selected_frame, | 189 frame_node = GetTypeAndURLFromFrame(selected_frame, |
189 &frame_url, | 190 &frame_url, |
190 ContextNode(ContextNode::FRAME)); | 191 ContextNode(ContextNode::FRAME)); |
191 frame_encoding = webkit_glue::StringToStdWString( | |
192 selected_frame->loader()->encoding()); | |
193 } | 192 } |
194 | 193 |
195 if (r.isSelected()) { | 194 if (r.isSelected()) { |
196 node.type |= ContextNode::SELECTION; | 195 node.type |= ContextNode::SELECTION; |
197 selection_text_string = CollapseWhitespace( | 196 selection_text_string = CollapseWhitespace( |
198 webkit_glue::StringToStdWString(selected_frame->selectedText()), | 197 webkit_glue::StringToStdWString(selected_frame->selectedText()), |
199 false); | 198 false); |
200 } | 199 } |
201 | 200 |
202 if (r.isContentEditable()) { | 201 if (r.isContentEditable()) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 node, | 245 node, |
247 menu_point.x(), | 246 menu_point.x(), |
248 menu_point.y(), | 247 menu_point.y(), |
249 webkit_glue::KURLToGURL(link_url), | 248 webkit_glue::KURLToGURL(link_url), |
250 webkit_glue::KURLToGURL(image_url), | 249 webkit_glue::KURLToGURL(image_url), |
251 page_url, | 250 page_url, |
252 frame_url, | 251 frame_url, |
253 selection_text_string, | 252 selection_text_string, |
254 misspelled_word_string, | 253 misspelled_word_string, |
255 edit_flags, | 254 edit_flags, |
256 security_info); | 255 security_info, |
| 256 frame_charset); |
257 } | 257 } |
258 return NULL; | 258 return NULL; |
259 } | 259 } |
260 | 260 |
261 void ContextMenuClientImpl::contextMenuItemSelected( | 261 void ContextMenuClientImpl::contextMenuItemSelected( |
262 WebCore::ContextMenuItem*, const WebCore::ContextMenu*) { | 262 WebCore::ContextMenuItem*, const WebCore::ContextMenu*) { |
263 } | 263 } |
264 | 264 |
265 void ContextMenuClientImpl::downloadURL(const WebCore::KURL&) { | 265 void ContextMenuClientImpl::downloadURL(const WebCore::KURL&) { |
266 } | 266 } |
(...skipping 15 matching lines...) Expand all Loading... |
282 | 282 |
283 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() { | 283 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() { |
284 return false; // TODO(jackson): Eventually include the inspector context me
nu item | 284 return false; // TODO(jackson): Eventually include the inspector context me
nu item |
285 } | 285 } |
286 | 286 |
287 #if defined(OS_MACOSX) | 287 #if defined(OS_MACOSX) |
288 void ContextMenuClientImpl::searchWithSpotlight() { | 288 void ContextMenuClientImpl::searchWithSpotlight() { |
289 // TODO(pinkerton): write this | 289 // TODO(pinkerton): write this |
290 } | 290 } |
291 #endif | 291 #endif |
OLD | NEW |