OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" | 5 #include "chrome/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 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 | 2236 |
2237 bool RenderView::isSelectTrailingWhitespaceEnabled() { | 2237 bool RenderView::isSelectTrailingWhitespaceEnabled() { |
2238 #if defined(OS_WIN) | 2238 #if defined(OS_WIN) |
2239 return true; | 2239 return true; |
2240 #else | 2240 #else |
2241 return false; | 2241 return false; |
2242 #endif | 2242 #endif |
2243 } | 2243 } |
2244 | 2244 |
2245 void RenderView::didChangeSelection(bool is_empty_selection) { | 2245 void RenderView::didChangeSelection(bool is_empty_selection) { |
2246 #if defined(USE_X11) || defined(OS_MACOSX) | 2246 #if defined(OS_POSIX) |
2247 if (!handling_input_event_) | 2247 if (!handling_input_event_) |
2248 return; | 2248 return; |
2249 // TODO(estade): investigate incremental updates to the selection so that we | 2249 // TODO(estade): investigate incremental updates to the selection so that we |
2250 // don't send the entire selection over IPC every time. | 2250 // don't send the entire selection over IPC every time. |
2251 if (!is_empty_selection) { | 2251 if (!is_empty_selection) { |
2252 // Sometimes we get repeated didChangeSelection calls from webkit when | 2252 // Sometimes we get repeated didChangeSelection calls from webkit when |
2253 // the selection hasn't actually changed. We don't want to report these | 2253 // the selection hasn't actually changed. We don't want to report these |
2254 // because it will cause us to continually claim the X clipboard. | 2254 // because it will cause us to continually claim the X clipboard. |
2255 const std::string& this_selection = | 2255 const std::string& this_selection = |
2256 webview()->focusedFrame()->selectionAsText().utf8(); | 2256 webview()->focusedFrame()->selectionAsText().utf8(); |
2257 if (this_selection == last_selection_) | 2257 if (this_selection == last_selection_) |
2258 return; | 2258 return; |
2259 | 2259 |
2260 Send(new ViewHostMsg_SelectionChanged(routing_id_, | 2260 Send(new ViewHostMsg_SelectionChanged(routing_id_, |
2261 this_selection)); | 2261 this_selection)); |
2262 last_selection_ = this_selection; | 2262 last_selection_ = this_selection; |
2263 } else { | 2263 } else { |
2264 last_selection_.clear(); | 2264 last_selection_.clear(); |
2265 Send(new ViewHostMsg_SelectionChanged(routing_id_, | 2265 Send(new ViewHostMsg_SelectionChanged(routing_id_, |
2266 last_selection_)); | 2266 last_selection_)); |
2267 } | 2267 } |
2268 #endif | 2268 #endif // defined(OS_POSIX) |
2269 } | 2269 } |
2270 | 2270 |
2271 void RenderView::didExecuteCommand(const WebString& command_name) { | 2271 void RenderView::didExecuteCommand(const WebString& command_name) { |
2272 const std::string& name = UTF16ToUTF8(command_name); | 2272 const std::string& name = UTF16ToUTF8(command_name); |
2273 if (StartsWithASCII(name, "Move", true) || | 2273 if (StartsWithASCII(name, "Move", true) || |
2274 StartsWithASCII(name, "Insert", true) || | 2274 StartsWithASCII(name, "Insert", true) || |
2275 StartsWithASCII(name, "Delete", true)) | 2275 StartsWithASCII(name, "Delete", true)) |
2276 return; | 2276 return; |
2277 UserMetricsRecordAction(name); | 2277 UserMetricsRecordAction(name); |
2278 } | 2278 } |
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5624 void RenderView::OnPageTranslated() { | 5624 void RenderView::OnPageTranslated() { |
5625 WebFrame* frame = webview()->mainFrame(); | 5625 WebFrame* frame = webview()->mainFrame(); |
5626 if (!frame) | 5626 if (!frame) |
5627 return; | 5627 return; |
5628 | 5628 |
5629 // The page is translated, so try to extract the form data again. | 5629 // The page is translated, so try to extract the form data again. |
5630 autofill_helper_->FrameContentsAvailable(frame); | 5630 autofill_helper_->FrameContentsAvailable(frame); |
5631 } | 5631 } |
5632 | 5632 |
5633 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) | 5633 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
5634 WebKit::WebGeolocationClient* RenderView::geolocationClient() | 5634 WebKit::WebGeolocationClient* RenderView::geolocationClient() { |
5635 { | |
5636 if (!geolocation_dispatcher_.get()) | 5635 if (!geolocation_dispatcher_.get()) |
5637 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); | 5636 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); |
5638 return geolocation_dispatcher_.get(); | 5637 return geolocation_dispatcher_.get(); |
5639 } | 5638 } |
5640 #else | 5639 #else |
5641 WebKit::WebGeolocationService* RenderView::geolocationService() { | 5640 WebKit::WebGeolocationService* RenderView::geolocationService() { |
5642 if (!geolocation_dispatcher_.get()) | 5641 if (!geolocation_dispatcher_.get()) |
5643 geolocation_dispatcher_.reset(new GeolocationDispatcherOld(this)); | 5642 geolocation_dispatcher_.reset(new GeolocationDispatcherOld(this)); |
5644 return geolocation_dispatcher_.get(); | 5643 return geolocation_dispatcher_.get(); |
5645 } | 5644 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5753 external_popup_menu_.reset(); | 5752 external_popup_menu_.reset(); |
5754 } | 5753 } |
5755 #endif | 5754 #endif |
5756 | 5755 |
5757 void RenderView::AddErrorToRootConsole(const string16& message) { | 5756 void RenderView::AddErrorToRootConsole(const string16& message) { |
5758 if (webview() && webview()->mainFrame()) { | 5757 if (webview() && webview()->mainFrame()) { |
5759 webview()->mainFrame()->addMessageToConsole( | 5758 webview()->mainFrame()->addMessageToConsole( |
5760 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5759 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
5761 } | 5760 } |
5762 } | 5761 } |
OLD | NEW |