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

Side by Side Diff: extensions/browser/app_window/app_window_contents.cc

Issue 1340163002: PlzNavigate: fix timing issue in app window creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-throttle
Patch Set: Created 5 years, 3 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 "extensions/browser/app_window/app_window_contents.h" 5 #include "extensions/browser/app_window/app_window_contents.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // shouldn't communicate with the background page anyway (e.g. sandboxed). 47 // shouldn't communicate with the background page anyway (e.g. sandboxed).
48 if (web_contents_->GetMainFrame()->GetProcess()->GetID() == 48 if (web_contents_->GetMainFrame()->GetProcess()->GetID() ==
49 creator_process_id) { 49 creator_process_id) {
50 SuspendRenderFrameHost(web_contents_->GetMainFrame()); 50 SuspendRenderFrameHost(web_contents_->GetMainFrame());
51 } else { 51 } else {
52 VLOG(1) << "AppWindow created in new process (" 52 VLOG(1) << "AppWindow created in new process ("
53 << web_contents_->GetMainFrame()->GetProcess()->GetID() 53 << web_contents_->GetMainFrame()->GetProcess()->GetID()
54 << ") != creator (" << creator_process_id << "). Routing disabled."; 54 << ") != creator (" << creator_process_id << "). Routing disabled.";
55 } 55 }
56 56
57 LOG(ERROR) << "Navigating to " << url_.spec();
nasko 2015/09/16 20:19:36 Is this log intentional?
clamy 2015/09/16 21:32:35 No it's not :). Removed it.
57 web_contents_->GetController().LoadURL( 58 web_contents_->GetController().LoadURL(
58 url_, content::Referrer(), ui::PAGE_TRANSITION_LINK, 59 url_, content::Referrer(), ui::PAGE_TRANSITION_LINK,
59 std::string()); 60 std::string());
60 } 61 }
61 62
62 void AppWindowContentsImpl::NativeWindowChanged( 63 void AppWindowContentsImpl::NativeWindowChanged(
63 NativeAppWindow* native_app_window) { 64 NativeAppWindow* native_app_window) {
64 base::ListValue args; 65 base::ListValue args;
65 base::DictionaryValue* dictionary = new base::DictionaryValue(); 66 base::DictionaryValue* dictionary = new base::DictionaryValue();
66 args.Append(dictionary); 67 args.Append(dictionary);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 bool AppWindowContentsImpl::OnMessageReceived(const IPC::Message& message) { 112 bool AppWindowContentsImpl::OnMessageReceived(const IPC::Message& message) {
112 bool handled = true; 113 bool handled = true;
113 IPC_BEGIN_MESSAGE_MAP(AppWindowContentsImpl, message) 114 IPC_BEGIN_MESSAGE_MAP(AppWindowContentsImpl, message)
114 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UpdateDraggableRegions, 115 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UpdateDraggableRegions,
115 UpdateDraggableRegions) 116 UpdateDraggableRegions)
116 IPC_MESSAGE_UNHANDLED(handled = false) 117 IPC_MESSAGE_UNHANDLED(handled = false)
117 IPC_END_MESSAGE_MAP() 118 IPC_END_MESSAGE_MAP()
118 return handled; 119 return handled;
119 } 120 }
120 121
122 void AppWindowContentsImpl::AboutToCommitNavigation(
123 content::NavigationHandle* handle) {
124 if (is_window_ready_)
125 return;
126 host_->OnFirstCommit();
127 }
128
121 void AppWindowContentsImpl::UpdateDraggableRegions( 129 void AppWindowContentsImpl::UpdateDraggableRegions(
122 const std::vector<DraggableRegion>& regions) { 130 const std::vector<DraggableRegion>& regions) {
123 host_->UpdateDraggableRegions(regions); 131 host_->UpdateDraggableRegions(regions);
124 } 132 }
125 133
126 void AppWindowContentsImpl::SuspendRenderFrameHost( 134 void AppWindowContentsImpl::SuspendRenderFrameHost(
127 content::RenderFrameHost* rfh) { 135 content::RenderFrameHost* rfh) {
128 DCHECK(rfh); 136 DCHECK(rfh);
129 // Don't bother blocking requests if the renderer side is already good to go. 137 // Don't bother blocking requests if the renderer side is already good to go.
130 if (is_window_ready_) 138 if (is_window_ready_)
131 return; 139 return;
132 is_blocking_requests_ = true; 140 is_blocking_requests_ = true;
133 // The ResourceDispatcherHost only accepts RenderViewHost child ids. 141 // The ResourceDispatcherHost only accepts RenderViewHost child ids.
134 // TODO(devlin): This will need to change for site isolation. 142 // TODO(devlin): This will need to change for site isolation.
135 content::BrowserThread::PostTask( 143 content::BrowserThread::PostTask(
136 content::BrowserThread::IO, FROM_HERE, 144 content::BrowserThread::IO, FROM_HERE,
137 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, 145 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute,
138 base::Unretained(content::ResourceDispatcherHost::Get()), 146 base::Unretained(content::ResourceDispatcherHost::Get()),
139 rfh->GetProcess()->GetID(), 147 rfh->GetProcess()->GetID(),
140 rfh->GetRenderViewHost()->GetRoutingID())); 148 rfh->GetRenderViewHost()->GetRoutingID()));
141 } 149 }
142 150
143 } // namespace extensions 151 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698