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

Side by Side Diff: chrome/browser/renderer_host/render_view_host_manager.cc

Issue 132009: fix DOMUI pages after install of .crx (Closed)
Patch Set: touch grd to avoid clobber build Created 11 years, 5 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/renderer_host/render_view_host_manager.h" 5 #include "chrome/browser/renderer_host/render_view_host_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/dom_ui/dom_ui.h" 9 #include "chrome/browser/dom_ui/dom_ui.h"
10 #include "chrome/browser/dom_ui/dom_ui_factory.h" 10 #include "chrome/browser/dom_ui/dom_ui_factory.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 site_instance = SiteInstance::CreateSiteInstance(profile); 58 site_instance = SiteInstance::CreateSiteInstance(profile);
59 render_view_host_ = RenderViewHostFactory::Create( 59 render_view_host_ = RenderViewHostFactory::Create(
60 site_instance, render_view_delegate_, routing_id, modal_dialog_event); 60 site_instance, render_view_delegate_, routing_id, modal_dialog_event);
61 NotificationService::current()->Notify( 61 NotificationService::current()->Notify(
62 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, 62 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB,
63 Source<RenderViewHostManager>(this), 63 Source<RenderViewHostManager>(this),
64 Details<RenderViewHost>(render_view_host_)); 64 Details<RenderViewHost>(render_view_host_));
65 } 65 }
66 66
67 RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { 67 RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) {
68 // This will possibly create (set to NULL) a DOM UI object for the pending
69 // page. We'll use this later to give the page special access. This must
70 // happen before the new renderer is created below so it will get bindings.
71 pending_dom_ui_.reset(delegate_->CreateDOMUIForRenderManager(entry.url()));
72
73 // Create a pending RenderViewHost. It will give us the one we should use 68 // Create a pending RenderViewHost. It will give us the one we should use
74 RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry); 69 RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry);
75 if (!dest_render_view_host) 70 if (!dest_render_view_host)
76 return NULL; // We weren't able to create a pending render view host. 71 return NULL; // We weren't able to create a pending render view host.
77 72
78 // If the current render_view_host_ isn't live, we should create it so 73 // If the current render_view_host_ isn't live, we should create it so
79 // that we don't show a sad tab while the dest_render_view_host fetches 74 // that we don't show a sad tab while the dest_render_view_host fetches
80 // its first page. (Bug 1145340) 75 // its first page. (Bug 1145340)
81 if (dest_render_view_host != render_view_host_ && 76 if (dest_render_view_host != render_view_host_ &&
82 !render_view_host_->IsRenderViewLive()) { 77 !render_view_host_->IsRenderViewLive()) {
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate( 481 RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
487 const NavigationEntry& entry) { 482 const NavigationEntry& entry) {
488 // If we are cross-navigating, then we want to get back to normal and navigate 483 // If we are cross-navigating, then we want to get back to normal and navigate
489 // as usual. 484 // as usual.
490 if (cross_navigation_pending_) { 485 if (cross_navigation_pending_) {
491 if (pending_render_view_host_) 486 if (pending_render_view_host_)
492 CancelPending(); 487 CancelPending();
493 cross_navigation_pending_ = false; 488 cross_navigation_pending_ = false;
494 } 489 }
495 490
491 // This will possibly create (set to NULL) a DOM UI object for the pending
492 // page. We'll use this later to give the page special access. This must
493 // happen before the new renderer is created below so it will get bindings.
494 // It must also happen after the above conditional call to CancelPending(),
495 // otherwise CancelPending may clear the pending_dom_ui_ and the page will
496 // not have it's bindings set appropriately.
497 pending_dom_ui_.reset(delegate_->CreateDOMUIForRenderManager(entry.url()));
498
496 // render_view_host_ will not be deleted before the end of this method, so we 499 // render_view_host_ will not be deleted before the end of this method, so we
497 // don't have to worry about this SiteInstance's ref count dropping to zero. 500 // don't have to worry about this SiteInstance's ref count dropping to zero.
498 SiteInstance* curr_instance = render_view_host_->site_instance(); 501 SiteInstance* curr_instance = render_view_host_->site_instance();
499 502
500 // Determine if we need a new SiteInstance for this entry. 503 // Determine if we need a new SiteInstance for this entry.
501 // Again, new_instance won't be deleted before the end of this method, so it 504 // Again, new_instance won't be deleted before the end of this method, so it
502 // is safe to use a normal pointer here. 505 // is safe to use a normal pointer here.
503 SiteInstance* new_instance = curr_instance; 506 SiteInstance* new_instance = curr_instance;
504 if (ShouldTransitionCrossSite()) 507 if (ShouldTransitionCrossSite())
505 new_instance = GetSiteInstanceForEntry(entry, curr_instance); 508 new_instance = GetSiteInstanceForEntry(entry, curr_instance);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 583
581 pending_dom_ui_.reset(); 584 pending_dom_ui_.reset();
582 } 585 }
583 586
584 void RenderViewHostManager::CrossSiteNavigationCanceled() { 587 void RenderViewHostManager::CrossSiteNavigationCanceled() {
585 DCHECK(cross_navigation_pending_); 588 DCHECK(cross_navigation_pending_);
586 cross_navigation_pending_ = false; 589 cross_navigation_pending_ = false;
587 if (pending_render_view_host_) 590 if (pending_render_view_host_)
588 CancelPending(); 591 CancelPending();
589 } 592 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/renderer_host/render_view_host_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698