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_gtk.h" | 5 #include "chrome/browser/views/tab_contents/native_tab_contents_container_gtk.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 NativeTabContentsContainerGtk::~NativeTabContentsContainerGtk() { | 23 NativeTabContentsContainerGtk::~NativeTabContentsContainerGtk() { |
24 } | 24 } |
25 | 25 |
26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
27 // NativeTabContentsContainerGtk, NativeTabContentsContainer overrides: | 27 // NativeTabContentsContainerGtk, NativeTabContentsContainer overrides: |
28 | 28 |
29 void NativeTabContentsContainerGtk::AttachContents(TabContents* contents) { | 29 void NativeTabContentsContainerGtk::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 | 36 |
37 // TODO(port): figure out focus interception | 37 // TODO(port): figure out focus interception |
38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
39 HWND contents_hwnd = contents->GetContentNativeView(); | 39 HWND contents_hwnd = contents->GetContentNativeView(); |
40 if (contents_hwnd) | 40 if (contents_hwnd) |
41 views::FocusManager::InstallFocusSubclass(contents_hwnd, this); | 41 views::FocusManager::InstallFocusSubclass(contents_hwnd, this); |
42 #endif | 42 #endif |
43 } | 43 } |
44 | 44 |
45 void NativeTabContentsContainerGtk::DetachContents(TabContents* contents) { | 45 void NativeTabContentsContainerGtk::DetachContents(TabContents* contents) { |
46 // TODO(port): figure out focus interception | 46 // TODO(port): figure out focus interception |
47 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
48 // TODO(brettw) should this move to HWNDView::Detach which is called below? | 48 // TODO(brettw) should this move to NativeViewHost::Detach which is called bel
ow? |
49 // It needs cleanup regardless. | 49 // It needs cleanup regardless. |
50 HWND container_hwnd = contents->GetNativeView(); | 50 HWND container_hwnd = contents->GetNativeView(); |
51 | 51 |
52 // Hide the contents before adjusting its parent to avoid a full desktop | 52 // Hide the contents before adjusting its parent to avoid a full desktop |
53 // flicker. | 53 // flicker. |
54 ShowWindow(container_hwnd, SW_HIDE); | 54 ShowWindow(container_hwnd, SW_HIDE); |
55 | 55 |
56 // Reset the parent to NULL to ensure hidden tabs don't receive messages. | 56 // Reset the parent to NULL to ensure hidden tabs don't receive messages. |
57 ::SetParent(container_hwnd, NULL); | 57 ::SetParent(container_hwnd, NULL); |
58 | 58 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 | 178 |
179 //////////////////////////////////////////////////////////////////////////////// | 179 //////////////////////////////////////////////////////////////////////////////// |
180 // NativeTabContentsContainer, public: | 180 // NativeTabContentsContainer, public: |
181 | 181 |
182 // static | 182 // static |
183 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer( | 183 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer( |
184 TabContentsContainer* container) { | 184 TabContentsContainer* container) { |
185 return new NativeTabContentsContainerGtk(container); | 185 return new NativeTabContentsContainerGtk(container); |
186 } | 186 } |
OLD | NEW |