| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 RenderFrameProxy::CreateFrameProxy(params.proxy_routing_id, routing_id_, | 706 RenderFrameProxy::CreateFrameProxy(params.proxy_routing_id, routing_id_, |
| 707 MSG_ROUTING_NONE, MSG_ROUTING_NONE, | 707 MSG_ROUTING_NONE, MSG_ROUTING_NONE, |
| 708 params.replicated_frame_state); | 708 params.replicated_frame_state); |
| 709 } | 709 } |
| 710 } | 710 } |
| 711 | 711 |
| 712 if (main_render_frame_) | 712 if (main_render_frame_) |
| 713 main_render_frame_->Initialize(); | 713 main_render_frame_->Initialize(); |
| 714 | 714 |
| 715 #if defined(OS_ANDROID) | 715 #if defined(OS_ANDROID) |
| 716 content_detectors_.push_back(linked_ptr<ContentDetector>( | 716 content_detectors_.push_back(make_scoped_ptr(new AddressDetector())); |
| 717 new AddressDetector())); | |
| 718 const std::string& contry_iso = | 717 const std::string& contry_iso = |
| 719 params.renderer_preferences.network_contry_iso; | 718 params.renderer_preferences.network_contry_iso; |
| 720 if (!contry_iso.empty()) { | 719 if (!contry_iso.empty()) { |
| 721 content_detectors_.push_back(linked_ptr<ContentDetector>( | 720 content_detectors_.push_back( |
| 722 new PhoneNumberDetector(contry_iso))); | 721 make_scoped_ptr(new PhoneNumberDetector(contry_iso))); |
| 723 } | 722 } |
| 724 content_detectors_.push_back(linked_ptr<ContentDetector>( | 723 content_detectors_.push_back(make_scoped_ptr(new EmailDetector())); |
| 725 new EmailDetector())); | |
| 726 #endif | 724 #endif |
| 727 | 725 |
| 728 RenderThread::Get()->AddRoute(routing_id_, this); | 726 RenderThread::Get()->AddRoute(routing_id_, this); |
| 729 // Take a reference on behalf of the RenderThread. This will be balanced | 727 // Take a reference on behalf of the RenderThread. This will be balanced |
| 730 // when we receive ViewMsg_Close in the RenderWidget (which RenderView | 728 // when we receive ViewMsg_Close in the RenderWidget (which RenderView |
| 731 // inherits from). | 729 // inherits from). |
| 732 AddRef(); | 730 AddRef(); |
| 733 if (RenderThreadImpl::current()) { | 731 if (RenderThreadImpl::current()) { |
| 734 RenderThreadImpl::current()->WidgetCreated(); | 732 RenderThreadImpl::current()->WidgetCreated(); |
| 735 if (is_hidden_) | 733 if (is_hidden_) |
| (...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3337 // queued which could DoS the user. Getting these is most likely a | 3335 // queued which could DoS the user. Getting these is most likely a |
| 3338 // programming error (there are many ways to DoS the user so it's not | 3336 // programming error (there are many ways to DoS the user so it's not |
| 3339 // considered a "real" security check), either in JS requesting many file | 3337 // considered a "real" security check), either in JS requesting many file |
| 3340 // choosers to pop up, or in a plugin. | 3338 // choosers to pop up, or in a plugin. |
| 3341 // | 3339 // |
| 3342 // TODO(brettw) we might possibly want to require a user gesture to open | 3340 // TODO(brettw) we might possibly want to require a user gesture to open |
| 3343 // a file picker, which will address this issue in a better way. | 3341 // a file picker, which will address this issue in a better way. |
| 3344 return false; | 3342 return false; |
| 3345 } | 3343 } |
| 3346 | 3344 |
| 3347 file_chooser_completions_.push_back(linked_ptr<PendingFileChooser>( | 3345 file_chooser_completions_.push_back( |
| 3348 new PendingFileChooser(params, completion))); | 3346 make_scoped_ptr(new PendingFileChooser(params, completion))); |
| 3349 if (file_chooser_completions_.size() == 1) { | 3347 if (file_chooser_completions_.size() == 1) { |
| 3350 // Actually show the browse dialog when this is the first request. | 3348 // Actually show the browse dialog when this is the first request. |
| 3351 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); | 3349 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); |
| 3352 } | 3350 } |
| 3353 return true; | 3351 return true; |
| 3354 } | 3352 } |
| 3355 | 3353 |
| 3356 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { | 3354 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { |
| 3357 if (!speech_recognition_dispatcher_) | 3355 if (!speech_recognition_dispatcher_) |
| 3358 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); | 3356 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3435 main_render_frame_->GetRoutingID(), signals)); | 3433 main_render_frame_->GetRoutingID(), signals)); |
| 3436 } | 3434 } |
| 3437 | 3435 |
| 3438 #if defined(OS_ANDROID) | 3436 #if defined(OS_ANDROID) |
| 3439 WebContentDetectionResult RenderViewImpl::detectContentAround( | 3437 WebContentDetectionResult RenderViewImpl::detectContentAround( |
| 3440 const WebHitTestResult& touch_hit) { | 3438 const WebHitTestResult& touch_hit) { |
| 3441 DCHECK(touch_hit.node().isTextNode()); | 3439 DCHECK(touch_hit.node().isTextNode()); |
| 3442 | 3440 |
| 3443 // Process the position with all the registered content detectors until | 3441 // Process the position with all the registered content detectors until |
| 3444 // a match is found. Priority is provided by their relative order. | 3442 // a match is found. Priority is provided by their relative order. |
| 3445 for (ContentDetectorList::const_iterator it = content_detectors_.begin(); | 3443 for (const auto& detector : content_detectors_) { |
| 3446 it != content_detectors_.end(); ++it) { | 3444 ContentDetector::Result content = detector->FindTappedContent(touch_hit); |
| 3447 ContentDetector::Result content = (*it)->FindTappedContent(touch_hit); | |
| 3448 if (content.valid) { | 3445 if (content.valid) { |
| 3449 return WebContentDetectionResult(content.content_boundaries, | 3446 return WebContentDetectionResult(content.content_boundaries, |
| 3450 base::UTF8ToUTF16(content.text), content.intent_url); | 3447 base::UTF8ToUTF16(content.text), content.intent_url); |
| 3451 } | 3448 } |
| 3452 } | 3449 } |
| 3453 return WebContentDetectionResult(); | 3450 return WebContentDetectionResult(); |
| 3454 } | 3451 } |
| 3455 | 3452 |
| 3456 void RenderViewImpl::scheduleContentIntent(const WebURL& intent, | 3453 void RenderViewImpl::scheduleContentIntent(const WebURL& intent, |
| 3457 bool is_main_frame) { | 3454 bool is_main_frame) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3712 if (IsUseZoomForDSFEnabled()) { | 3709 if (IsUseZoomForDSFEnabled()) { |
| 3713 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); | 3710 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); |
| 3714 webview()->setZoomFactorForDeviceScaleFactor( | 3711 webview()->setZoomFactorForDeviceScaleFactor( |
| 3715 device_scale_factor_); | 3712 device_scale_factor_); |
| 3716 } else { | 3713 } else { |
| 3717 webview()->setDeviceScaleFactor(device_scale_factor_); | 3714 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3718 } | 3715 } |
| 3719 } | 3716 } |
| 3720 | 3717 |
| 3721 } // namespace content | 3718 } // namespace content |
| OLD | NEW |