Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 1600953003: Move find-in-page code from RenderView to RenderFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments by nasko@, git cl format. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bit_cast.h" 10 #include "base/bit_cast.h"
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 660
661 v8::Local<v8::Context> context = 661 v8::Local<v8::Context> context =
662 container_->element().document().frame()->mainWorldScriptContext(); 662 container_->element().document().frame()->mainWorldScriptContext();
663 DCHECK(context->GetIsolate() == isolate_); 663 DCHECK(context->GetIsolate() == isolate_);
664 return context; 664 return context;
665 } 665 }
666 666
667 void PepperPluginInstanceImpl::Delete() { 667 void PepperPluginInstanceImpl::Delete() {
668 is_deleted_ = true; 668 is_deleted_ = true;
669 669
670 if (render_frame_ && render_frame_->render_view() && 670 if (render_frame_ && render_frame_->plugin_find_handler() == this) {
671 render_frame_->render_view()->plugin_find_handler() == this) { 671 render_frame_->set_plugin_find_handler(nullptr);
672 render_frame_->render_view()->set_plugin_find_handler(NULL);
673 } 672 }
674 673
675 // Keep a reference on the stack. See NOTE above. 674 // Keep a reference on the stack. See NOTE above.
676 scoped_refptr<PepperPluginInstanceImpl> ref(this); 675 scoped_refptr<PepperPluginInstanceImpl> ref(this);
677 676
678 // It is important to destroy the throttler before anything else. 677 // It is important to destroy the throttler before anything else.
679 // The plugin instance may flush its graphics pipeline during its postmortem 678 // The plugin instance may flush its graphics pipeline during its postmortem
680 // spasm, causing the throttler to engage and obtain new dangling reference 679 // spasm, causing the throttler to engage and obtain new dangling reference
681 // to the plugin container being destroyed. 680 // to the plugin container being destroyed.
682 throttler_.reset(); 681 throttler_.reset();
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 2523
2525 void PepperPluginInstanceImpl::SetPluginToHandleFindRequests( 2524 void PepperPluginInstanceImpl::SetPluginToHandleFindRequests(
2526 PP_Instance instance) { 2525 PP_Instance instance) {
2527 if (!LoadFindInterface()) 2526 if (!LoadFindInterface())
2528 return; 2527 return;
2529 bool is_main_frame = 2528 bool is_main_frame =
2530 render_frame_ && 2529 render_frame_ &&
2531 render_frame_->GetRenderView()->GetMainRenderFrame() == render_frame_; 2530 render_frame_->GetRenderView()->GetMainRenderFrame() == render_frame_;
2532 if (!is_main_frame) 2531 if (!is_main_frame)
2533 return; 2532 return;
2534 render_frame_->render_view()->set_plugin_find_handler(this); 2533 render_frame_->set_plugin_find_handler(this);
2535 } 2534 }
2536 2535
2537 void PepperPluginInstanceImpl::NumberOfFindResultsChanged( 2536 void PepperPluginInstanceImpl::NumberOfFindResultsChanged(
2538 PP_Instance instance, 2537 PP_Instance instance,
2539 int32_t total, 2538 int32_t total,
2540 PP_Bool final_result) { 2539 PP_Bool final_result) {
2541 DCHECK_NE(find_identifier_, -1); 2540 DCHECK_NE(find_identifier_, -1);
2542 if (render_frame_) { 2541 if (render_frame_) {
2543 render_frame_->reportFindInPageMatchCount( 2542 render_frame_->reportFindInPageMatchCount(
2544 find_identifier_, total, PP_ToBool(final_result)); 2543 find_identifier_, total, PP_ToBool(final_result));
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
3292 3291
3293 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { 3292 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() {
3294 if (initialized_ && !javascript_used_ && is_flash_plugin_) { 3293 if (initialized_ && !javascript_used_ && is_flash_plugin_) {
3295 javascript_used_ = true; 3294 javascript_used_ = true;
3296 RenderThread::Get()->RecordAction( 3295 RenderThread::Get()->RecordAction(
3297 base::UserMetricsAction("Flash.JavaScriptUsed")); 3296 base::UserMetricsAction("Flash.JavaScriptUsed"));
3298 } 3297 }
3299 } 3298 }
3300 3299
3301 } // namespace content 3300 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698