| 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 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 | 2217 |
| 2218 bool RenderView::isSelectTrailingWhitespaceEnabled() { | 2218 bool RenderView::isSelectTrailingWhitespaceEnabled() { |
| 2219 #if defined(OS_WIN) | 2219 #if defined(OS_WIN) |
| 2220 return true; | 2220 return true; |
| 2221 #else | 2221 #else |
| 2222 return false; | 2222 return false; |
| 2223 #endif | 2223 #endif |
| 2224 } | 2224 } |
| 2225 | 2225 |
| 2226 void RenderView::didChangeSelection(bool is_empty_selection) { | 2226 void RenderView::didChangeSelection(bool is_empty_selection) { |
| 2227 #if defined(USE_X11) || defined(OS_MACOSX) | 2227 #if defined(OS_POSIX) |
| 2228 if (!handling_input_event_) | 2228 if (!handling_input_event_) |
| 2229 return; | 2229 return; |
| 2230 // TODO(estade): investigate incremental updates to the selection so that we | 2230 // TODO(estade): investigate incremental updates to the selection so that we |
| 2231 // don't send the entire selection over IPC every time. | 2231 // don't send the entire selection over IPC every time. |
| 2232 if (!is_empty_selection) { | 2232 if (!is_empty_selection) { |
| 2233 // Sometimes we get repeated didChangeSelection calls from webkit when | 2233 // Sometimes we get repeated didChangeSelection calls from webkit when |
| 2234 // the selection hasn't actually changed. We don't want to report these | 2234 // the selection hasn't actually changed. We don't want to report these |
| 2235 // because it will cause us to continually claim the X clipboard. | 2235 // because it will cause us to continually claim the X clipboard. |
| 2236 const std::string& this_selection = | 2236 const std::string& this_selection = |
| 2237 webview()->focusedFrame()->selectionAsText().utf8(); | 2237 webview()->focusedFrame()->selectionAsText().utf8(); |
| 2238 if (this_selection == last_selection_) | 2238 if (this_selection == last_selection_) |
| 2239 return; | 2239 return; |
| 2240 | 2240 |
| 2241 Send(new ViewHostMsg_SelectionChanged(routing_id_, | 2241 Send(new ViewHostMsg_SelectionChanged(routing_id_, |
| 2242 this_selection)); | 2242 this_selection)); |
| 2243 last_selection_ = this_selection; | 2243 last_selection_ = this_selection; |
| 2244 } else { | 2244 } else { |
| 2245 last_selection_.clear(); | 2245 last_selection_.clear(); |
| 2246 Send(new ViewHostMsg_SelectionChanged(routing_id_, | 2246 Send(new ViewHostMsg_SelectionChanged(routing_id_, |
| 2247 last_selection_)); | 2247 last_selection_)); |
| 2248 } | 2248 } |
| 2249 #endif | 2249 #endif // defined(OS_POSIX) |
| 2250 } | 2250 } |
| 2251 | 2251 |
| 2252 void RenderView::didExecuteCommand(const WebString& command_name) { | 2252 void RenderView::didExecuteCommand(const WebString& command_name) { |
| 2253 const std::string& name = UTF16ToUTF8(command_name); | 2253 const std::string& name = UTF16ToUTF8(command_name); |
| 2254 if (StartsWithASCII(name, "Move", true) || | 2254 if (StartsWithASCII(name, "Move", true) || |
| 2255 StartsWithASCII(name, "Insert", true) || | 2255 StartsWithASCII(name, "Insert", true) || |
| 2256 StartsWithASCII(name, "Delete", true)) | 2256 StartsWithASCII(name, "Delete", true)) |
| 2257 return; | 2257 return; |
| 2258 UserMetricsRecordAction(name); | 2258 UserMetricsRecordAction(name); |
| 2259 } | 2259 } |
| (...skipping 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5617 void RenderView::OnPageTranslated() { | 5617 void RenderView::OnPageTranslated() { |
| 5618 WebFrame* frame = webview()->mainFrame(); | 5618 WebFrame* frame = webview()->mainFrame(); |
| 5619 if (!frame) | 5619 if (!frame) |
| 5620 return; | 5620 return; |
| 5621 | 5621 |
| 5622 // The page is translated, so try to extract the form data again. | 5622 // The page is translated, so try to extract the form data again. |
| 5623 autofill_helper_->FrameContentsAvailable(frame); | 5623 autofill_helper_->FrameContentsAvailable(frame); |
| 5624 } | 5624 } |
| 5625 | 5625 |
| 5626 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) | 5626 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| 5627 WebKit::WebGeolocationClient* RenderView::geolocationClient() | 5627 WebKit::WebGeolocationClient* RenderView::geolocationClient() { |
| 5628 { | |
| 5629 if (!geolocation_dispatcher_.get()) | 5628 if (!geolocation_dispatcher_.get()) |
| 5630 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); | 5629 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); |
| 5631 return geolocation_dispatcher_.get(); | 5630 return geolocation_dispatcher_.get(); |
| 5632 } | 5631 } |
| 5633 #else | 5632 #else |
| 5634 WebKit::WebGeolocationService* RenderView::geolocationService() { | 5633 WebKit::WebGeolocationService* RenderView::geolocationService() { |
| 5635 if (!geolocation_dispatcher_.get()) | 5634 if (!geolocation_dispatcher_.get()) |
| 5636 geolocation_dispatcher_.reset(new GeolocationDispatcherOld(this)); | 5635 geolocation_dispatcher_.reset(new GeolocationDispatcherOld(this)); |
| 5637 return geolocation_dispatcher_.get(); | 5636 return geolocation_dispatcher_.get(); |
| 5638 } | 5637 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5746 external_popup_menu_.reset(); | 5745 external_popup_menu_.reset(); |
| 5747 } | 5746 } |
| 5748 #endif | 5747 #endif |
| 5749 | 5748 |
| 5750 void RenderView::AddErrorToRootConsole(const string16& message) { | 5749 void RenderView::AddErrorToRootConsole(const string16& message) { |
| 5751 if (webview() && webview()->mainFrame()) { | 5750 if (webview() && webview()->mainFrame()) { |
| 5752 webview()->mainFrame()->addMessageToConsole( | 5751 webview()->mainFrame()->addMessageToConsole( |
| 5753 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5752 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
| 5754 } | 5753 } |
| 5755 } | 5754 } |
| OLD | NEW |