| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents_observer.h" | 5 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_view_host.h" | 7 #include "content/browser/renderer_host/render_view_host.h" |
| 8 #include "content/browser/tab_contents/tab_contents.h" | 8 #include "content/browser/tab_contents/tab_contents.h" |
| 9 | 9 |
| 10 TabContentsObserver::Registrar::Registrar(TabContentsObserver* observer) | 10 TabContentsObserver::Registrar::Registrar(TabContentsObserver* observer) |
| 11 : observer_(observer), tab_(NULL) { | 11 : observer_(observer), tab_(NULL) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 TabContentsObserver::Registrar::~Registrar() { | 14 TabContentsObserver::Registrar::~Registrar() { |
| 15 if (tab_) | 15 if (tab_) |
| 16 tab_->RemoveObserver(observer_); | 16 tab_->RemoveObserver(observer_); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void TabContentsObserver::Registrar::Observe(TabContents* tab) { | 19 void TabContentsObserver::Registrar::Observe(TabContents* tab) { |
| 20 observer_->SetTabContents(tab); | 20 observer_->SetTabContents(tab); |
| 21 if (tab_) | 21 if (tab_) |
| 22 tab_->RemoveObserver(observer_); | 22 tab_->RemoveObserver(observer_); |
| 23 tab_ = tab; | 23 tab_ = tab; |
| 24 if (tab_) | 24 if (tab_) |
| 25 tab_->AddObserver(observer_); | 25 tab_->AddObserver(observer_); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void TabContentsObserver::RenderViewCreated(RenderViewHost* render_view_host) { |
| 29 } |
| 30 |
| 28 void TabContentsObserver::NavigateToPendingEntry( | 31 void TabContentsObserver::NavigateToPendingEntry( |
| 29 const GURL& url, | 32 const GURL& url, |
| 30 NavigationController::ReloadType reload_type) { | 33 NavigationController::ReloadType reload_type) { |
| 31 } | 34 } |
| 32 | 35 |
| 33 void TabContentsObserver::DidNavigateMainFramePostCommit( | 36 void TabContentsObserver::DidNavigateMainFramePostCommit( |
| 34 const NavigationController::LoadCommittedDetails& details, | 37 const NavigationController::LoadCommittedDetails& details, |
| 35 const ViewHostMsg_FrameNavigate_Params& params) { | 38 const ViewHostMsg_FrameNavigate_Params& params) { |
| 36 } | 39 } |
| 37 | 40 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 140 } |
| 138 | 141 |
| 139 void TabContentsObserver::TabContentsDestroyed() { | 142 void TabContentsObserver::TabContentsDestroyed() { |
| 140 // Do cleanup so that 'this' can safely be deleted from | 143 // Do cleanup so that 'this' can safely be deleted from |
| 141 // TabContentsDestroyed. | 144 // TabContentsDestroyed. |
| 142 tab_contents_->RemoveObserver(this); | 145 tab_contents_->RemoveObserver(this); |
| 143 TabContents* tab = tab_contents_; | 146 TabContents* tab = tab_contents_; |
| 144 tab_contents_ = NULL; | 147 tab_contents_ = NULL; |
| 145 TabContentsDestroyed(tab); | 148 TabContentsDestroyed(tab); |
| 146 } | 149 } |
| OLD | NEW |