| 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 "chrome/browser/renderer_host/render_view_host.h" | 7 #include "chrome/browser/renderer_host/render_view_host.h" |
| 8 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 8 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 9 #include "chrome/browser/tab_contents/interstitial_page.h" | 9 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| 11 #include "chrome/browser/ui/view_ids.h" | 11 #include "chrome/browser/ui/view_ids.h" |
| 12 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" | 12 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" |
| 13 #include "chrome/common/notification_details.h" | 13 #include "chrome/common/notification_details.h" |
| 14 #include "chrome/common/notification_source.h" | 14 #include "chrome/common/notification_source.h" |
| 15 | 15 |
| 16 | 16 |
| 17 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 18 // TabContentsContainer, public: | 18 // TabContentsContainer, public: |
| 19 | 19 |
| 20 TabContentsContainer::~TabContentsContainer() { | 20 TabContentsContainer::~TabContentsContainer() { |
| 21 if (tab_contents_) | 21 if (tab_contents_) |
| 22 RemoveObservers(); | 22 RemoveObservers(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void TabContentsContainer::SetReservedContentsRect( | |
| 26 const gfx::Rect& reserved_rect) { | |
| 27 cached_reserved_rect_ = reserved_rect; | |
| 28 #if !defined(TOUCH_UI) | |
| 29 if (tab_contents_ && tab_contents_->GetRenderWidgetHostView()) { | |
| 30 tab_contents_->GetRenderWidgetHostView()->set_reserved_contents_rect( | |
| 31 reserved_rect); | |
| 32 } | |
| 33 #endif | |
| 34 } | |
| 35 | |
| 36 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
| 37 // TabContentsContainer, NotificationObserver implementation: | 26 // TabContentsContainer, NotificationObserver implementation: |
| 38 | 27 |
| 39 void TabContentsContainer::Observe(NotificationType type, | 28 void TabContentsContainer::Observe(NotificationType type, |
| 40 const NotificationSource& source, | 29 const NotificationSource& source, |
| 41 const NotificationDetails& details) { | 30 const NotificationDetails& details) { |
| 42 if (type == NotificationType::RENDER_VIEW_HOST_CHANGED) { | 31 if (type == NotificationType::RENDER_VIEW_HOST_CHANGED) { |
| 43 RenderViewHostSwitchedDetails* switched_details = | 32 RenderViewHostSwitchedDetails* switched_details = |
| 44 Details<RenderViewHostSwitchedDetails>(details).ptr(); | 33 Details<RenderViewHostSwitchedDetails>(details).ptr(); |
| 45 RenderViewHostChanged(switched_details->old_host, | 34 RenderViewHostChanged(switched_details->old_host, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // us to clean up our state in case this happens. | 72 // us to clean up our state in case this happens. |
| 84 DCHECK(contents == tab_contents_); | 73 DCHECK(contents == tab_contents_); |
| 85 ChangeTabContents(NULL); | 74 ChangeTabContents(NULL); |
| 86 } | 75 } |
| 87 | 76 |
| 88 void TabContentsContainer::RenderWidgetHostViewChanged( | 77 void TabContentsContainer::RenderWidgetHostViewChanged( |
| 89 RenderWidgetHostView* new_view) { | 78 RenderWidgetHostView* new_view) { |
| 90 if (new_view) | 79 if (new_view) |
| 91 new_view->set_reserved_contents_rect(cached_reserved_rect_); | 80 new_view->set_reserved_contents_rect(cached_reserved_rect_); |
| 92 } | 81 } |
| OLD | NEW |