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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1023783004: [DevTools] Move DevToolsAgent to RenderFrameImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 5 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 633
634 // static 634 // static
635 blink::WebSandboxFlags RenderFrameImpl::ContentToWebSandboxFlags( 635 blink::WebSandboxFlags RenderFrameImpl::ContentToWebSandboxFlags(
636 content::SandboxFlags flags) { 636 content::SandboxFlags flags) {
637 return static_cast<blink::WebSandboxFlags>(flags); 637 return static_cast<blink::WebSandboxFlags>(flags);
638 } 638 }
639 639
640 // RenderFrameImpl ---------------------------------------------------------- 640 // RenderFrameImpl ----------------------------------------------------------
641 RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id) 641 RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id)
642 : frame_(NULL), 642 : frame_(NULL),
643 is_local_root_(false),
643 render_view_(render_view->AsWeakPtr()), 644 render_view_(render_view->AsWeakPtr()),
644 routing_id_(routing_id), 645 routing_id_(routing_id),
645 is_swapped_out_(false), 646 is_swapped_out_(false),
646 render_frame_proxy_(NULL), 647 render_frame_proxy_(NULL),
647 is_detaching_(false), 648 is_detaching_(false),
648 proxy_routing_id_(MSG_ROUTING_NONE), 649 proxy_routing_id_(MSG_ROUTING_NONE),
649 #if defined(ENABLE_PLUGINS) 650 #if defined(ENABLE_PLUGINS)
650 plugin_power_saver_helper_(NULL), 651 plugin_power_saver_helper_(NULL),
651 #endif 652 #endif
652 cookie_jar_(this), 653 cookie_jar_(this),
653 selection_text_offset_(0), 654 selection_text_offset_(0),
654 selection_range_(gfx::Range::InvalidRange()), 655 selection_range_(gfx::Range::InvalidRange()),
655 handling_select_range_(false), 656 handling_select_range_(false),
656 notification_permission_dispatcher_(NULL), 657 notification_permission_dispatcher_(NULL),
657 web_user_media_client_(NULL), 658 web_user_media_client_(NULL),
658 media_permission_dispatcher_(NULL), 659 media_permission_dispatcher_(NULL),
659 midi_dispatcher_(NULL), 660 midi_dispatcher_(NULL),
660 #if defined(OS_ANDROID) 661 #if defined(OS_ANDROID)
661 media_player_manager_(NULL), 662 media_player_manager_(NULL),
662 #endif 663 #endif
663 #if defined(ENABLE_BROWSER_CDMS) 664 #if defined(ENABLE_BROWSER_CDMS)
664 cdm_manager_(NULL), 665 cdm_manager_(NULL),
665 #endif 666 #endif
666 #if defined(VIDEO_HOLE) 667 #if defined(VIDEO_HOLE)
667 contains_media_player_(false), 668 contains_media_player_(false),
668 #endif 669 #endif
670 devtools_agent_(nullptr),
669 geolocation_dispatcher_(NULL), 671 geolocation_dispatcher_(NULL),
670 push_messaging_dispatcher_(NULL), 672 push_messaging_dispatcher_(NULL),
671 presentation_dispatcher_(NULL), 673 presentation_dispatcher_(NULL),
672 screen_orientation_dispatcher_(NULL), 674 screen_orientation_dispatcher_(NULL),
673 manifest_manager_(NULL), 675 manifest_manager_(NULL),
674 accessibility_mode_(AccessibilityModeOff), 676 accessibility_mode_(AccessibilityModeOff),
675 renderer_accessibility_(NULL), 677 renderer_accessibility_(NULL),
676 weak_factory_(this) { 678 weak_factory_(this) {
677 std::pair<RoutingIDFrameMap::iterator, bool> result = 679 std::pair<RoutingIDFrameMap::iterator, bool> result =
678 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); 680 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 726
725 void RenderFrameImpl::Initialize() { 727 void RenderFrameImpl::Initialize() {
726 #if defined(ENABLE_PLUGINS) 728 #if defined(ENABLE_PLUGINS)
727 new PepperBrowserConnection(this); 729 new PepperBrowserConnection(this);
728 #endif 730 #endif
729 new SharedWorkerRepository(this); 731 new SharedWorkerRepository(this);
730 732
731 if (!frame_->parent()) 733 if (!frame_->parent())
732 new ImageLoadingHelper(this); 734 new ImageLoadingHelper(this);
733 735
736 is_local_root_ = !frame_->parent() || frame_->parent()->isWebRemoteFrame();
nasko 2015/03/25 22:26:04 I'd put this initialization line as the first thin
dgozman 2015/03/26 13:25:49 Done.
737 if (is_local_root_ && !render_frame_proxy_) {
738 // DevToolsAgent is a RenderFrameObserver, and will destruct itself
739 // when |this| is deleted.
740 devtools_agent_ = new DevToolsAgent(this);
741 }
742
734 // We delay calling this until we have the WebFrame so that any observer or 743 // We delay calling this until we have the WebFrame so that any observer or
735 // embedder can call GetWebFrame on any RenderFrame. 744 // embedder can call GetWebFrame on any RenderFrame.
736 GetContentClient()->renderer()->RenderFrameCreated(this); 745 GetContentClient()->renderer()->RenderFrameCreated(this);
737 } 746 }
738 747
739 RenderWidget* RenderFrameImpl::GetRenderWidget() { 748 RenderWidget* RenderFrameImpl::GetRenderWidget() {
740 return render_view_.get(); 749 return render_view_.get();
741 } 750 }
742 751
743 #if defined(ENABLE_PLUGINS) 752 #if defined(ENABLE_PLUGINS)
(...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 3221
3213 void RenderFrameImpl::didFinishResourceLoad(blink::WebLocalFrame* frame, 3222 void RenderFrameImpl::didFinishResourceLoad(blink::WebLocalFrame* frame,
3214 unsigned identifier) { 3223 unsigned identifier) {
3215 DCHECK(!frame_ || frame_ == frame); 3224 DCHECK(!frame_ || frame_ == frame);
3216 InternalDocumentStateData* internal_data = 3225 InternalDocumentStateData* internal_data =
3217 InternalDocumentStateData::FromDataSource(frame->dataSource()); 3226 InternalDocumentStateData::FromDataSource(frame->dataSource());
3218 if (!internal_data->use_error_page()) 3227 if (!internal_data->use_error_page())
3219 return; 3228 return;
3220 3229
3221 // Do not show error page when DevTools is attached. 3230 // Do not show error page when DevTools is attached.
3222 if (render_view_->devtools_agent_ && 3231 // TODO(dgozman): we should check DevToolsAgent of the local frame root.
nasko 2015/03/25 22:26:04 Why not include this check in this CL? I'm worried
dgozman 2015/03/26 13:25:49 Done.
3223 render_view_->devtools_agent_->IsAttached()) { 3232 if (devtools_agent_ && devtools_agent_->IsAttached())
3224 return; 3233 return;
3225 }
3226 3234
3227 // Display error page, if appropriate. 3235 // Display error page, if appropriate.
3228 std::string error_domain = "http"; 3236 std::string error_domain = "http";
3229 int http_status_code = internal_data->http_status_code(); 3237 int http_status_code = internal_data->http_status_code();
3230 if (GetContentClient()->renderer()->HasErrorPage( 3238 if (GetContentClient()->renderer()->HasErrorPage(
3231 http_status_code, &error_domain)) { 3239 http_status_code, &error_domain)) {
3232 WebURLError error; 3240 WebURLError error;
3233 error.unreachableURL = frame->document().url(); 3241 error.unreachableURL = frame->document().url();
3234 error.domain = WebString::fromUTF8(error_domain); 3242 error.domain = WebString::fromUTF8(error_domain);
3235 error.reason = http_status_code; 3243 error.reason = http_status_code;
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4520 4528
4521 #if defined(ENABLE_BROWSER_CDMS) 4529 #if defined(ENABLE_BROWSER_CDMS)
4522 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4530 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4523 if (!cdm_manager_) 4531 if (!cdm_manager_)
4524 cdm_manager_ = new RendererCdmManager(this); 4532 cdm_manager_ = new RendererCdmManager(this);
4525 return cdm_manager_; 4533 return cdm_manager_;
4526 } 4534 }
4527 #endif // defined(ENABLE_BROWSER_CDMS) 4535 #endif // defined(ENABLE_BROWSER_CDMS)
4528 4536
4529 } // namespace content 4537 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698