| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // WebContentsImpl::DestructionObserver ---------------------------------------- | 280 // WebContentsImpl::DestructionObserver ---------------------------------------- |
| 281 | 281 |
| 282 class WebContentsImpl::DestructionObserver : public WebContentsObserver { | 282 class WebContentsImpl::DestructionObserver : public WebContentsObserver { |
| 283 public: | 283 public: |
| 284 DestructionObserver(WebContentsImpl* owner, WebContents* watched_contents) | 284 DestructionObserver(WebContentsImpl* owner, WebContents* watched_contents) |
| 285 : WebContentsObserver(watched_contents), | 285 : WebContentsObserver(watched_contents), |
| 286 owner_(owner) { | 286 owner_(owner) { |
| 287 } | 287 } |
| 288 | 288 |
| 289 // WebContentsObserver: | 289 // WebContentsObserver: |
| 290 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { | 290 virtual void WebContentsDestroyed() OVERRIDE { |
| 291 owner_->OnWebContentsDestroyed(static_cast<WebContentsImpl*>(web_contents)); | 291 owner_->OnWebContentsDestroyed( |
| 292 static_cast<WebContentsImpl*>(web_contents())); |
| 292 } | 293 } |
| 293 | 294 |
| 294 private: | 295 private: |
| 295 WebContentsImpl* owner_; | 296 WebContentsImpl* owner_; |
| 296 | 297 |
| 297 DISALLOW_COPY_AND_ASSIGN(DestructionObserver); | 298 DISALLOW_COPY_AND_ASSIGN(DestructionObserver); |
| 298 }; | 299 }; |
| 299 | 300 |
| 300 WebContentsImpl::ColorChooserInfo::ColorChooserInfo(int render_process_id, | 301 WebContentsImpl::ColorChooserInfo::ColorChooserInfo(int render_process_id, |
| 301 int render_frame_id, | 302 int render_frame_id, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 355 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
| 355 g_created_callbacks.Get().at(i).Run(this); | 356 g_created_callbacks.Get().at(i).Run(this); |
| 356 frame_tree_.SetFrameRemoveListener( | 357 frame_tree_.SetFrameRemoveListener( |
| 357 base::Bind(&WebContentsImpl::OnFrameRemoved, | 358 base::Bind(&WebContentsImpl::OnFrameRemoved, |
| 358 base::Unretained(this))); | 359 base::Unretained(this))); |
| 359 } | 360 } |
| 360 | 361 |
| 361 WebContentsImpl::~WebContentsImpl() { | 362 WebContentsImpl::~WebContentsImpl() { |
| 362 is_being_destroyed_ = true; | 363 is_being_destroyed_ = true; |
| 363 | 364 |
| 364 // If there is an interstitial page being shown, tell it to close down early | |
| 365 // so that this contents will be alive enough to handle all the UI triggered | |
| 366 // by that. <http://crbug.com/363564> | |
| 367 InterstitialPageImpl* interstitial_page = | |
| 368 static_cast<InterstitialPageImpl*>(GetInterstitialPage()); | |
| 369 if (interstitial_page) | |
| 370 interstitial_page->WebContentsWillBeDestroyed(); | |
| 371 | |
| 372 // Delete all RFH pending shutdown, which will lead the corresponding RVH to | 365 // Delete all RFH pending shutdown, which will lead the corresponding RVH to |
| 373 // shutdown and be deleted as well. | 366 // shutdown and be deleted as well. |
| 374 frame_tree_.ForEach( | 367 frame_tree_.ForEach( |
| 375 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); | 368 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); |
| 376 | 369 |
| 377 ClearAllPowerSaveBlockers(); | 370 ClearAllPowerSaveBlockers(); |
| 378 | 371 |
| 379 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 372 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
| 380 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 373 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
| 381 (*iter)->DetachDelegate(); | 374 (*iter)->DetachDelegate(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 410 } | 403 } |
| 411 | 404 |
| 412 ForEachFrame(run_render_frame_deleted_callback); | 405 ForEachFrame(run_render_frame_deleted_callback); |
| 413 | 406 |
| 414 FOR_EACH_OBSERVER(WebContentsObserver, | 407 FOR_EACH_OBSERVER(WebContentsObserver, |
| 415 observers_, | 408 observers_, |
| 416 RenderViewDeleted(GetRenderManager()->current_host())); | 409 RenderViewDeleted(GetRenderManager()->current_host())); |
| 417 | 410 |
| 418 FOR_EACH_OBSERVER(WebContentsObserver, | 411 FOR_EACH_OBSERVER(WebContentsObserver, |
| 419 observers_, | 412 observers_, |
| 420 WebContentsImplDestroyed()); | 413 WebContentsDestroyed()); |
| 414 |
| 415 FOR_EACH_OBSERVER(WebContentsObserver, |
| 416 observers_, |
| 417 ResetWebContents()); |
| 421 | 418 |
| 422 SetDelegate(NULL); | 419 SetDelegate(NULL); |
| 423 | 420 |
| 424 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(), | 421 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(), |
| 425 destruction_observers_.end()); | 422 destruction_observers_.end()); |
| 426 } | 423 } |
| 427 | 424 |
| 428 WebContentsImpl* WebContentsImpl::CreateWithOpener( | 425 WebContentsImpl* WebContentsImpl::CreateWithOpener( |
| 429 const WebContents::CreateParams& params, | 426 const WebContents::CreateParams& params, |
| 430 WebContentsImpl* opener) { | 427 WebContentsImpl* opener) { |
| (...skipping 3543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3974 | 3971 |
| 3975 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3972 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3976 if (!delegate_) | 3973 if (!delegate_) |
| 3977 return; | 3974 return; |
| 3978 const gfx::Size new_size = GetPreferredSize(); | 3975 const gfx::Size new_size = GetPreferredSize(); |
| 3979 if (new_size != old_size) | 3976 if (new_size != old_size) |
| 3980 delegate_->UpdatePreferredSize(this, new_size); | 3977 delegate_->UpdatePreferredSize(this, new_size); |
| 3981 } | 3978 } |
| 3982 | 3979 |
| 3983 } // namespace content | 3980 } // namespace content |
| OLD | NEW |