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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 910073003: <webview>: Make contentWindow available prior to attachment (on display:none). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use constants 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 (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/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 3129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 } 3140 }
3141 } 3141 }
3142 3142
3143 void WebContentsImpl::OnPpapiBrokerPermissionResult(int routing_id, 3143 void WebContentsImpl::OnPpapiBrokerPermissionResult(int routing_id,
3144 bool result) { 3144 bool result) {
3145 Send(new ViewMsg_PpapiBrokerPermissionResult(routing_id, result)); 3145 Send(new ViewMsg_PpapiBrokerPermissionResult(routing_id, result));
3146 } 3146 }
3147 3147
3148 void WebContentsImpl::OnBrowserPluginMessage(RenderFrameHost* render_frame_host, 3148 void WebContentsImpl::OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
3149 const IPC::Message& message) { 3149 const IPC::Message& message) {
3150 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin 3150 CreateBrowserPluginEmbedderIfNecessary();
3151 // specific messages for this WebContents. This means that any message from
3152 // a BrowserPlugin prior to this will be ignored.
3153 // For more info, see comment above classes BrowserPluginEmbedder and
3154 // BrowserPluginGuest.
3155 CHECK(!browser_plugin_embedder_.get());
Charlie Reis 2015/03/04 20:08:36 Why not keep this CHECK before the CreateBrowserPl
Fady Samuel 2015/03/05 20:56:23 Good point. If a BrowserPluginEmbedder already exi
3156 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this));
3157 browser_plugin_embedder_->OnMessageReceived(message, render_frame_host); 3151 browser_plugin_embedder_->OnMessageReceived(message, render_frame_host);
3158 } 3152 }
3159 #endif // defined(ENABLE_PLUGINS) 3153 #endif // defined(ENABLE_PLUGINS)
3160 3154
3161 void WebContentsImpl::OnDidDownloadImage( 3155 void WebContentsImpl::OnDidDownloadImage(
3162 int id, 3156 int id,
3163 int http_status_code, 3157 int http_status_code,
3164 const GURL& image_url, 3158 const GURL& image_url,
3165 const std::vector<SkBitmap>& bitmaps, 3159 const std::vector<SkBitmap>& bitmaps,
3166 const std::vector<gfx::Size>& original_bitmap_sizes) { 3160 const std::vector<gfx::Size>& original_bitmap_sizes) {
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
3981 RenderViewHost* rvh, 3975 RenderViewHost* rvh,
3982 const ViewMsg_PostMessage_Params& params) { 3976 const ViewMsg_PostMessage_Params& params) {
3983 // Only deliver the message to the active RenderViewHost if the request 3977 // Only deliver the message to the active RenderViewHost if the request
3984 // came from a RenderViewHost in the same BrowsingInstance or if this 3978 // came from a RenderViewHost in the same BrowsingInstance or if this
3985 // WebContents is dedicated to a browser plugin guest. 3979 // WebContents is dedicated to a browser plugin guest.
3986 // Note: This check means that an embedder could theoretically receive a 3980 // Note: This check means that an embedder could theoretically receive a
3987 // postMessage from anyone (not just its own guests). However, this is 3981 // postMessage from anyone (not just its own guests). However, this is
3988 // probably not a risk for apps since other pages won't have references 3982 // probably not a risk for apps since other pages won't have references
3989 // to App windows. 3983 // to App windows.
3990 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) && 3984 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) &&
3991 !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder()) 3985 !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder()) {
Charlie Reis 2015/03/04 20:08:36 This change isn't necessary, and it's not related
Fady Samuel 2015/03/05 20:56:23 Done.
3992 return; 3986 return;
3987 }
3993 3988
3994 ViewMsg_PostMessage_Params new_params(params); 3989 ViewMsg_PostMessage_Params new_params(params);
3995 3990
3996 // If there is a source_routing_id, translate it to the routing ID for 3991 // If there is a source_routing_id, translate it to the routing ID for
3997 // the equivalent swapped out RVH in the target process. If we need 3992 // the equivalent swapped out RVH in the target process. If we need
3998 // to create a swapped out RVH for the source tab, we create its opener 3993 // to create a swapped out RVH for the source tab, we create its opener
3999 // chain as well, since those will also be accessible to the target page. 3994 // chain as well, since those will also be accessible to the target page.
4000 if (new_params.source_routing_id != MSG_ROUTING_NONE) { 3995 if (new_params.source_routing_id != MSG_ROUTING_NONE) {
4001 // Try to look up the WebContents for the source page. 3996 // Try to look up the WebContents for the source page.
4002 WebContentsImpl* source_contents = NULL; 3997 WebContentsImpl* source_contents = NULL;
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
4436 4431
4437 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { 4432 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) {
4438 CHECK(!browser_plugin_guest_); 4433 CHECK(!browser_plugin_guest_);
4439 browser_plugin_guest_.reset(guest); 4434 browser_plugin_guest_.reset(guest);
4440 } 4435 }
4441 4436
4442 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { 4437 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const {
4443 return browser_plugin_embedder_.get(); 4438 return browser_plugin_embedder_.get();
4444 } 4439 }
4445 4440
4441 void WebContentsImpl::CreateBrowserPluginEmbedderIfNecessary() {
4442 if (browser_plugin_embedder_)
4443 return;
4444 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this));
4445 }
4446
4446 void WebContentsImpl::ClearPowerSaveBlockers( 4447 void WebContentsImpl::ClearPowerSaveBlockers(
4447 RenderFrameHost* render_frame_host) { 4448 RenderFrameHost* render_frame_host) {
4448 RemoveAllMediaPlayerEntries(render_frame_host, &active_audio_players_); 4449 RemoveAllMediaPlayerEntries(render_frame_host, &active_audio_players_);
4449 RemoveAllMediaPlayerEntries(render_frame_host, &active_video_players_); 4450 RemoveAllMediaPlayerEntries(render_frame_host, &active_video_players_);
4450 MaybeReleasePowerSaveBlockers(); 4451 MaybeReleasePowerSaveBlockers();
4451 } 4452 }
4452 4453
4453 void WebContentsImpl::ClearAllPowerSaveBlockers() { 4454 void WebContentsImpl::ClearAllPowerSaveBlockers() {
4454 active_audio_players_.clear(); 4455 active_audio_players_.clear();
4455 active_video_players_.clear(); 4456 active_video_players_.clear();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4529 node->render_manager()->ResumeResponseDeferredAtStart(); 4530 node->render_manager()->ResumeResponseDeferredAtStart();
4530 } 4531 }
4531 4532
4532 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4533 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4533 force_disable_overscroll_content_ = force_disable; 4534 force_disable_overscroll_content_ = force_disable;
4534 if (view_) 4535 if (view_)
4535 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4536 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4536 } 4537 }
4537 4538
4538 } // namespace content 4539 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698