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