| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/tab_contents/native_tab_contents_container_win.h" | 5 #include "chrome/browser/views/tab_contents/native_tab_contents_container_win.h" |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 8 #include "chrome/browser/tab_contents/interstitial_page.h" | 8 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
| 10 #include "chrome/browser/views/tab_contents/tab_contents_container.h" | 10 #include "chrome/browser/views/tab_contents/tab_contents_container.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 NativeTabContentsContainerWin::~NativeTabContentsContainerWin() { | 23 NativeTabContentsContainerWin::~NativeTabContentsContainerWin() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
| 27 // NativeTabContentsContainerWin, NativeTabContentsContainer overrides: | 27 // NativeTabContentsContainerWin, NativeTabContentsContainer overrides: |
| 28 | 28 |
| 29 void NativeTabContentsContainerWin::AttachContents(TabContents* contents) { | 29 void NativeTabContentsContainerWin::AttachContents(TabContents* contents) { |
| 30 // We need to register the tab contents window with the BrowserContainer so | 30 // We need to register the tab contents window with the BrowserContainer so |
| 31 // that the BrowserContainer is the focused view when the focus is on the | 31 // that the BrowserContainer is the focused view when the focus is on the |
| 32 // TabContents window (for the TabContents case). | 32 // TabContents window (for the TabContents case). |
| 33 SetAssociatedFocusView(this); | 33 set_focus_view(this); |
| 34 | 34 |
| 35 Attach(contents->GetNativeView()); | 35 Attach(contents->GetNativeView()); |
| 36 HWND contents_hwnd = contents->GetContentNativeView(); | 36 HWND contents_hwnd = contents->GetContentNativeView(); |
| 37 if (contents_hwnd) | 37 if (contents_hwnd) |
| 38 views::FocusManager::InstallFocusSubclass(contents_hwnd, this); | 38 views::FocusManager::InstallFocusSubclass(contents_hwnd, this); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void NativeTabContentsContainerWin::DetachContents(TabContents* contents) { | 41 void NativeTabContentsContainerWin::DetachContents(TabContents* contents) { |
| 42 // TODO(brettw) should this move to HWNDView::Detach which is called below? | 42 // TODO(brettw) should this move to NativeViewHost::Detach which is called bel
ow? |
| 43 // It needs cleanup regardless. | 43 // It needs cleanup regardless. |
| 44 HWND container_hwnd = contents->GetNativeView(); | 44 HWND container_hwnd = contents->GetNativeView(); |
| 45 | 45 |
| 46 // Hide the contents before adjusting its parent to avoid a full desktop | 46 // Hide the contents before adjusting its parent to avoid a full desktop |
| 47 // flicker. | 47 // flicker. |
| 48 ShowWindow(container_hwnd, SW_HIDE); | 48 ShowWindow(container_hwnd, SW_HIDE); |
| 49 | 49 |
| 50 // Reset the parent to NULL to ensure hidden tabs don't receive messages. | 50 // Reset the parent to NULL to ensure hidden tabs don't receive messages. |
| 51 ::SetParent(container_hwnd, NULL); | 51 ::SetParent(container_hwnd, NULL); |
| 52 | 52 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 //////////////////////////////////////////////////////////////////////////////// | 163 //////////////////////////////////////////////////////////////////////////////// |
| 164 // NativeTabContentsContainer, public: | 164 // NativeTabContentsContainer, public: |
| 165 | 165 |
| 166 // static | 166 // static |
| 167 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer( | 167 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer( |
| 168 TabContentsContainer* container) { | 168 TabContentsContainer* container) { |
| 169 return new NativeTabContentsContainerWin(container); | 169 return new NativeTabContentsContainerWin(container); |
| 170 } | 170 } |
| OLD | NEW |