| OLD | NEW |
| 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 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3182 } | 3182 } |
| 3183 } | 3183 } |
| 3184 | 3184 |
| 3185 void WebContentsImpl::OnPpapiBrokerPermissionResult(int routing_id, | 3185 void WebContentsImpl::OnPpapiBrokerPermissionResult(int routing_id, |
| 3186 bool result) { | 3186 bool result) { |
| 3187 Send(new ViewMsg_PpapiBrokerPermissionResult(routing_id, result)); | 3187 Send(new ViewMsg_PpapiBrokerPermissionResult(routing_id, result)); |
| 3188 } | 3188 } |
| 3189 | 3189 |
| 3190 void WebContentsImpl::OnBrowserPluginMessage(RenderFrameHost* render_frame_host, | 3190 void WebContentsImpl::OnBrowserPluginMessage(RenderFrameHost* render_frame_host, |
| 3191 const IPC::Message& message) { | 3191 const IPC::Message& message) { |
| 3192 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin | |
| 3193 // specific messages for this WebContents. This means that any message from | |
| 3194 // a BrowserPlugin prior to this will be ignored. | |
| 3195 // For more info, see comment above classes BrowserPluginEmbedder and | |
| 3196 // BrowserPluginGuest. | |
| 3197 CHECK(!browser_plugin_embedder_.get()); | 3192 CHECK(!browser_plugin_embedder_.get()); |
| 3198 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); | 3193 CreateBrowserPluginEmbedderIfNecessary(); |
| 3199 browser_plugin_embedder_->OnMessageReceived(message, render_frame_host); | 3194 browser_plugin_embedder_->OnMessageReceived(message, render_frame_host); |
| 3200 } | 3195 } |
| 3201 #endif // defined(ENABLE_PLUGINS) | 3196 #endif // defined(ENABLE_PLUGINS) |
| 3202 | 3197 |
| 3203 void WebContentsImpl::OnDidDownloadImage( | 3198 void WebContentsImpl::OnDidDownloadImage( |
| 3204 int id, | 3199 int id, |
| 3205 int http_status_code, | 3200 int http_status_code, |
| 3206 const GURL& image_url, | 3201 const GURL& image_url, |
| 3207 const std::vector<SkBitmap>& bitmaps, | 3202 const std::vector<SkBitmap>& bitmaps, |
| 3208 const std::vector<gfx::Size>& original_bitmap_sizes) { | 3203 const std::vector<gfx::Size>& original_bitmap_sizes) { |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4485 | 4480 |
| 4486 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { | 4481 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { |
| 4487 CHECK(!browser_plugin_guest_); | 4482 CHECK(!browser_plugin_guest_); |
| 4488 browser_plugin_guest_.reset(guest); | 4483 browser_plugin_guest_.reset(guest); |
| 4489 } | 4484 } |
| 4490 | 4485 |
| 4491 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 4486 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
| 4492 return browser_plugin_embedder_.get(); | 4487 return browser_plugin_embedder_.get(); |
| 4493 } | 4488 } |
| 4494 | 4489 |
| 4490 void WebContentsImpl::CreateBrowserPluginEmbedderIfNecessary() { |
| 4491 if (browser_plugin_embedder_) |
| 4492 return; |
| 4493 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); |
| 4494 } |
| 4495 |
| 4495 void WebContentsImpl::ClearPowerSaveBlockers( | 4496 void WebContentsImpl::ClearPowerSaveBlockers( |
| 4496 RenderFrameHost* render_frame_host) { | 4497 RenderFrameHost* render_frame_host) { |
| 4497 RemoveAllMediaPlayerEntries(render_frame_host, &active_audio_players_); | 4498 RemoveAllMediaPlayerEntries(render_frame_host, &active_audio_players_); |
| 4498 RemoveAllMediaPlayerEntries(render_frame_host, &active_video_players_); | 4499 RemoveAllMediaPlayerEntries(render_frame_host, &active_video_players_); |
| 4499 MaybeReleasePowerSaveBlockers(); | 4500 MaybeReleasePowerSaveBlockers(); |
| 4500 } | 4501 } |
| 4501 | 4502 |
| 4502 void WebContentsImpl::ClearAllPowerSaveBlockers() { | 4503 void WebContentsImpl::ClearAllPowerSaveBlockers() { |
| 4503 active_audio_players_.clear(); | 4504 active_audio_players_.clear(); |
| 4504 active_video_players_.clear(); | 4505 active_video_players_.clear(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4578 node->render_manager()->ResumeResponseDeferredAtStart(); | 4579 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4579 } | 4580 } |
| 4580 | 4581 |
| 4581 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4582 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4582 force_disable_overscroll_content_ = force_disable; | 4583 force_disable_overscroll_content_ = force_disable; |
| 4583 if (view_) | 4584 if (view_) |
| 4584 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4585 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4585 } | 4586 } |
| 4586 | 4587 |
| 4587 } // namespace content | 4588 } // namespace content |
| OLD | NEW |