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/ui/view_ids.h" | 7 #include "chrome/browser/ui/view_ids.h" |
8 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" | 8 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" |
9 #include "content/browser/renderer_host/render_view_host.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
10 #include "content/browser/renderer_host/render_widget_host_view.h" | 10 #include "content/browser/renderer_host/render_widget_host_view.h" |
11 #include "content/browser/tab_contents/interstitial_page.h" | 11 #include "content/browser/tab_contents/interstitial_page.h" |
12 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
13 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
15 #include "content/public/browser/notification_types.h" | 15 #include "content/public/browser/notification_types.h" |
16 #include "ui/base/accessibility/accessible_view_state.h" | 16 #include "ui/base/accessibility/accessible_view_state.h" |
17 | 17 |
| 18 using content::NavigationController; |
18 using content::WebContents; | 19 using content::WebContents; |
19 | 20 |
20 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
21 // TabContentsContainer, public: | 22 // TabContentsContainer, public: |
22 | 23 |
23 TabContentsContainer::TabContentsContainer() | 24 TabContentsContainer::TabContentsContainer() |
24 : native_container_(NULL), | 25 : native_container_(NULL), |
25 web_contents_(NULL) { | 26 web_contents_(NULL) { |
26 set_id(VIEW_ID_TAB_CONTAINER); | 27 set_id(VIEW_ID_TAB_CONTAINER); |
27 } | 28 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 //////////////////////////////////////////////////////////////////////////////// | 163 //////////////////////////////////////////////////////////////////////////////// |
163 // TabContentsContainer, private: | 164 // TabContentsContainer, private: |
164 | 165 |
165 void TabContentsContainer::AddObservers() { | 166 void TabContentsContainer::AddObservers() { |
166 // TabContents can change their RenderViewHost and hence the HWND that is | 167 // TabContents can change their RenderViewHost and hence the HWND that is |
167 // shown and getting focused. We need to keep track of that so we install | 168 // shown and getting focused. We need to keep track of that so we install |
168 // the focus subclass on the shown HWND so we intercept focus change events. | 169 // the focus subclass on the shown HWND so we intercept focus change events. |
169 registrar_.Add( | 170 registrar_.Add( |
170 this, | 171 this, |
171 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, | 172 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, |
172 content::Source<content::NavigationController>( | 173 content::Source<NavigationController>(&web_contents_->GetController())); |
173 &web_contents_->GetController())); | |
174 | 174 |
175 registrar_.Add( | 175 registrar_.Add( |
176 this, | 176 this, |
177 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 177 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
178 content::Source<WebContents>(web_contents_)); | 178 content::Source<WebContents>(web_contents_)); |
179 } | 179 } |
180 | 180 |
181 void TabContentsContainer::RemoveObservers() { | 181 void TabContentsContainer::RemoveObservers() { |
182 registrar_.RemoveAll(); | 182 registrar_.RemoveAll(); |
183 } | 183 } |
(...skipping 10 matching lines...) Expand all Loading... |
194 // us to clean up our state in case this happens. | 194 // us to clean up our state in case this happens. |
195 DCHECK(contents == web_contents_); | 195 DCHECK(contents == web_contents_); |
196 ChangeWebContents(NULL); | 196 ChangeWebContents(NULL); |
197 } | 197 } |
198 | 198 |
199 void TabContentsContainer::RenderWidgetHostViewChanged( | 199 void TabContentsContainer::RenderWidgetHostViewChanged( |
200 RenderWidgetHostView* new_view) { | 200 RenderWidgetHostView* new_view) { |
201 if (new_view) | 201 if (new_view) |
202 new_view->set_reserved_contents_rect(cached_reserved_rect_); | 202 new_view->set_reserved_contents_rect(cached_reserved_rect_); |
203 } | 203 } |
OLD | NEW |