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 "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
10 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" | 10 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 TabContentsContainer::~TabContentsContainer() { | 32 TabContentsContainer::~TabContentsContainer() { |
33 if (web_contents_) | 33 if (web_contents_) |
34 RemoveObservers(); | 34 RemoveObservers(); |
35 } | 35 } |
36 | 36 |
37 void TabContentsContainer::ChangeWebContents(WebContents* contents) { | 37 void TabContentsContainer::ChangeWebContents(WebContents* contents) { |
38 if (web_contents_) { | 38 if (web_contents_) { |
39 native_container_->DetachContents(web_contents_); | 39 native_container_->DetachContents(web_contents_); |
40 web_contents_->WasHidden(); | |
41 RemoveObservers(); | 40 RemoveObservers(); |
42 } | 41 } |
43 web_contents_ = contents; | 42 web_contents_ = contents; |
44 // When detaching the last tab of the browser ChangeWebContents is invoked | 43 // When detaching the last tab of the browser ChangeWebContents is invoked |
45 // with NULL. Don't attempt to do anything in that case. | 44 // with NULL. Don't attempt to do anything in that case. |
46 if (web_contents_) { | 45 if (web_contents_) { |
47 RenderWidgetHostViewChanged(web_contents_->GetRenderWidgetHostView()); | 46 RenderWidgetHostViewChanged(web_contents_->GetRenderWidgetHostView()); |
48 native_container_->AttachContents(web_contents_); | 47 native_container_->AttachContents(web_contents_); |
49 AddObservers(); | 48 AddObservers(); |
50 } | 49 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // us to clean up our state in case this happens. | 196 // us to clean up our state in case this happens. |
198 DCHECK(contents == web_contents_); | 197 DCHECK(contents == web_contents_); |
199 ChangeWebContents(NULL); | 198 ChangeWebContents(NULL); |
200 } | 199 } |
201 | 200 |
202 void TabContentsContainer::RenderWidgetHostViewChanged( | 201 void TabContentsContainer::RenderWidgetHostViewChanged( |
203 RenderWidgetHostView* new_view) { | 202 RenderWidgetHostView* new_view) { |
204 if (new_view) | 203 if (new_view) |
205 new_view->set_reserved_contents_rect(cached_reserved_rect_); | 204 new_view->set_reserved_contents_rect(cached_reserved_rect_); |
206 } | 205 } |
OLD | NEW |