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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 1360123006: Introduce RenderFrame::IsMainFrame and clean up a few things. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed use-after-free. Created 5 years, 2 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
« no previous file with comments | « no previous file | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 #endif 543 #endif
544 544
545 #if defined(ENABLE_PLUGINS) 545 #if defined(ENABLE_PLUGINS)
546 new PepperHelper(render_frame); 546 new PepperHelper(render_frame);
547 #endif 547 #endif
548 548
549 #if !defined(DISABLE_NACL) 549 #if !defined(DISABLE_NACL)
550 new nacl::NaClHelper(render_frame); 550 new nacl::NaClHelper(render_frame);
551 #endif 551 #endif
552 552
553 // TODO(jam): when the frame tree moves into content and parent() works at 553 if (render_frame->IsMainFrame()) {
554 // RenderFrame construction, simplify this by just checking parent(). 554 // Only attach NetErrorHelper to the main frame, since only the main frame
555 if (render_frame->GetRenderView()->GetMainRenderFrame() != render_frame) { 555 // should get error pages.
556 new NetErrorHelper(render_frame);
557
558 // Only attach MainRenderFrameObserver to the main frame, since
559 // we only want to log page load metrics for the main frame.
560 new page_load_metrics::MetricsRenderFrameObserver(render_frame);
561 } else {
556 // Avoid any race conditions from having the browser tell subframes that 562 // Avoid any race conditions from having the browser tell subframes that
557 // they're prerendering. 563 // they're prerendering.
558 if (prerender::PrerenderHelper::IsPrerendering( 564 if (prerender::PrerenderHelper::IsPrerendering(
559 render_frame->GetRenderView()->GetMainRenderFrame())) { 565 render_frame->GetRenderView()->GetMainRenderFrame())) {
560 new prerender::PrerenderHelper(render_frame); 566 new prerender::PrerenderHelper(render_frame);
561 } 567 }
562 } 568 }
563 569
564 if (render_frame->GetRenderView()->GetMainRenderFrame() == render_frame) {
565 // Only attach NetErrorHelper to the main frame, since only the main frame
566 // should get error pages.
567 new NetErrorHelper(render_frame);
568 }
569
570 if (render_frame->GetWebFrame()->parent() == nullptr) {
571 // Only attach MainRenderFrameObserver to the main frame, since
572 // we only want to log page load metrics for the main frame.
573 new page_load_metrics::MetricsRenderFrameObserver(render_frame);
574 }
575
576 // Set up a mojo service to test if this page is a distiller page. 570 // Set up a mojo service to test if this page is a distiller page.
577 new dom_distiller::DistillerJsRenderFrameObserver( 571 new dom_distiller::DistillerJsRenderFrameObserver(
578 render_frame, chrome::ISOLATED_WORLD_ID_CHROME_INTERNAL); 572 render_frame, chrome::ISOLATED_WORLD_ID_CHROME_INTERNAL);
579 573
580 PasswordAutofillAgent* password_autofill_agent = 574 PasswordAutofillAgent* password_autofill_agent =
581 new PasswordAutofillAgent(render_frame); 575 new PasswordAutofillAgent(render_frame);
582 PasswordGenerationAgent* password_generation_agent = 576 PasswordGenerationAgent* password_generation_agent =
583 new PasswordGenerationAgent(render_frame, password_autofill_agent); 577 new PasswordGenerationAgent(render_frame, password_autofill_agent);
584 new AutofillAgent(render_frame, password_autofill_agent, 578 new AutofillAgent(render_frame, password_autofill_agent,
585 password_generation_agent); 579 password_generation_agent);
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 } 1663 }
1670 1664
1671 void ChromeContentRendererClient::WillDestroyServiceWorkerContextOnWorkerThread( 1665 void ChromeContentRendererClient::WillDestroyServiceWorkerContextOnWorkerThread(
1672 v8::Local<v8::Context> context, 1666 v8::Local<v8::Context> context,
1673 const GURL& url) { 1667 const GURL& url) {
1674 #if defined(ENABLE_EXTENSIONS) 1668 #if defined(ENABLE_EXTENSIONS)
1675 extensions::Dispatcher::WillDestroyServiceWorkerContextOnWorkerThread(context, 1669 extensions::Dispatcher::WillDestroyServiceWorkerContextOnWorkerThread(context,
1676 url); 1670 url);
1677 #endif 1671 #endif
1678 } 1672 }
OLDNEW
« no previous file with comments | « no previous file | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698