| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 it != session_storage_namespace_map.end(); | 215 it != session_storage_namespace_map.end(); |
| 216 ++it) { | 216 ++it) { |
| 217 new_contents->GetController() | 217 new_contents->GetController() |
| 218 .SetSessionStorageNamespace(it->first, it->second.get()); | 218 .SetSessionStorageNamespace(it->first, it->second.get()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 new_contents->Init(params); | 221 new_contents->Init(params); |
| 222 return new_contents; | 222 return new_contents; |
| 223 } | 223 } |
| 224 | 224 |
| 225 void WebContentsImpl::AddCreatedCallback(const CreatedCallback& callback) { | 225 void WebContentsImpl::FriendZone::AddCreatedCallbackForTesting( |
| 226 const CreatedCallback& callback) { |
| 226 g_created_callbacks.Get().push_back(callback); | 227 g_created_callbacks.Get().push_back(callback); |
| 227 } | 228 } |
| 228 | 229 |
| 229 void WebContentsImpl::RemoveCreatedCallback(const CreatedCallback& callback) { | 230 void WebContentsImpl::FriendZone::RemoveCreatedCallbackForTesting( |
| 231 const CreatedCallback& callback) { |
| 230 for (size_t i = 0; i < g_created_callbacks.Get().size(); ++i) { | 232 for (size_t i = 0; i < g_created_callbacks.Get().size(); ++i) { |
| 231 if (g_created_callbacks.Get().at(i).Equals(callback)) { | 233 if (g_created_callbacks.Get().at(i).Equals(callback)) { |
| 232 g_created_callbacks.Get().erase(g_created_callbacks.Get().begin() + i); | 234 g_created_callbacks.Get().erase(g_created_callbacks.Get().begin() + i); |
| 233 return; | 235 return; |
| 234 } | 236 } |
| 235 } | 237 } |
| 236 } | 238 } |
| 237 | 239 |
| 238 WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) { | 240 WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) { |
| 239 return rvh->GetDelegate()->GetAsWebContents(); | 241 return rvh->GetDelegate()->GetAsWebContents(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 fullscreen_widget_had_focus_at_shutdown_(false), | 328 fullscreen_widget_had_focus_at_shutdown_(false), |
| 327 is_subframe_(false), | 329 is_subframe_(false), |
| 328 force_disable_overscroll_content_(false), | 330 force_disable_overscroll_content_(false), |
| 329 last_dialog_suppressed_(false), | 331 last_dialog_suppressed_(false), |
| 330 geolocation_service_context_(new GeolocationServiceContext()), | 332 geolocation_service_context_(new GeolocationServiceContext()), |
| 331 accessibility_mode_( | 333 accessibility_mode_( |
| 332 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 334 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
| 333 audio_stream_monitor_(this), | 335 audio_stream_monitor_(this), |
| 334 virtual_keyboard_requested_(false), | 336 virtual_keyboard_requested_(false), |
| 335 loading_weak_factory_(this) { | 337 loading_weak_factory_(this) { |
| 336 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | |
| 337 g_created_callbacks.Get().at(i).Run(this); | |
| 338 frame_tree_.SetFrameRemoveListener( | 338 frame_tree_.SetFrameRemoveListener( |
| 339 base::Bind(&WebContentsImpl::OnFrameRemoved, | 339 base::Bind(&WebContentsImpl::OnFrameRemoved, |
| 340 base::Unretained(this))); | 340 base::Unretained(this))); |
| 341 } | 341 } |
| 342 | 342 |
| 343 WebContentsImpl::~WebContentsImpl() { | 343 WebContentsImpl::~WebContentsImpl() { |
| 344 is_being_destroyed_ = true; | 344 is_being_destroyed_ = true; |
| 345 | 345 |
| 346 // Delete all RFH pending shutdown, which will lead the corresponding RVH to | 346 // Delete all RFH pending shutdown, which will lead the corresponding RVH to |
| 347 // shutdown and be deleted as well. | 347 // shutdown and be deleted as well. |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 manifest_manager_host_.reset(new ManifestManagerHost(this)); | 1199 manifest_manager_host_.reset(new ManifestManagerHost(this)); |
| 1200 | 1200 |
| 1201 #if defined(OS_ANDROID) | 1201 #if defined(OS_ANDROID) |
| 1202 date_time_chooser_.reset(new DateTimeChooserAndroid()); | 1202 date_time_chooser_.reset(new DateTimeChooserAndroid()); |
| 1203 #endif | 1203 #endif |
| 1204 | 1204 |
| 1205 // BrowserPluginGuest::Init needs to be called after this WebContents has | 1205 // BrowserPluginGuest::Init needs to be called after this WebContents has |
| 1206 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. | 1206 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. |
| 1207 if (browser_plugin_guest_) | 1207 if (browser_plugin_guest_) |
| 1208 browser_plugin_guest_->Init(); | 1208 browser_plugin_guest_->Init(); |
| 1209 |
| 1210 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
| 1211 g_created_callbacks.Get().at(i).Run(this); |
| 1209 } | 1212 } |
| 1210 | 1213 |
| 1211 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { | 1214 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { |
| 1212 RemoveDestructionObserver(web_contents); | 1215 RemoveDestructionObserver(web_contents); |
| 1213 | 1216 |
| 1214 // Clear the opener if it has been closed. | 1217 // Clear the opener if it has been closed. |
| 1215 if (web_contents == opener_) { | 1218 if (web_contents == opener_) { |
| 1216 opener_ = NULL; | 1219 opener_ = NULL; |
| 1217 return; | 1220 return; |
| 1218 } | 1221 } |
| (...skipping 3159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4378 node->render_manager()->ResumeResponseDeferredAtStart(); | 4381 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4379 } | 4382 } |
| 4380 | 4383 |
| 4381 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4384 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4382 force_disable_overscroll_content_ = force_disable; | 4385 force_disable_overscroll_content_ = force_disable; |
| 4383 if (view_) | 4386 if (view_) |
| 4384 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4387 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4385 } | 4388 } |
| 4386 | 4389 |
| 4387 } // namespace content | 4390 } // namespace content |
| OLD | NEW |