OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/native_tab_contents_view_aura.h" | 5 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.h" |
6 | 6 |
7 #include "base/event_types.h" | 7 #include "base/event_types.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/ui/sad_tab_helper.h" | 9 #include "chrome/browser/ui/sad_tab_helper.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
11 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" | 11 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" |
12 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
16 #include "ui/aura/client/drag_drop_client.h" | 16 #include "ui/aura/client/drag_drop_client.h" |
17 #include "ui/aura/client/drag_drop_delegate.h" | 17 #include "ui/aura/client/drag_drop_delegate.h" |
18 #include "ui/aura/event.h" | 18 #include "ui/aura/event.h" |
19 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
21 #include "ui/base/dragdrop/drag_drop_types.h" | 21 #include "ui/base/dragdrop/drag_drop_types.h" |
22 #include "ui/base/dragdrop/os_exchange_data.h" | 22 #include "ui/base/dragdrop/os_exchange_data.h" |
23 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" | 23 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" |
| 24 #include "ui/gfx/compositor/layer.h" |
24 #include "ui/views/views_delegate.h" | 25 #include "ui/views/views_delegate.h" |
25 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
26 #include "webkit/glue/webdropdata.h" | 27 #include "webkit/glue/webdropdata.h" |
27 | 28 |
28 #if defined(USE_ASH) | 29 #if defined(USE_ASH) |
29 #include "ash/shell.h" | 30 #include "ash/shell.h" |
30 #include "ash/wm/visibility_controller.h" | 31 #include "ash/wm/visibility_controller.h" |
31 #endif | 32 #endif |
32 | 33 |
33 using content::RenderViewHost; | 34 using content::RenderViewHost; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 157 |
157 void NativeTabContentsViewAura::InitNativeTabContentsView() { | 158 void NativeTabContentsViewAura::InitNativeTabContentsView() { |
158 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 159 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
159 params.native_widget = this; | 160 params.native_widget = this; |
160 // We don't draw anything so we don't need a texture. | 161 // We don't draw anything so we don't need a texture. |
161 params.create_texture_for_layer = false; | 162 params.create_texture_for_layer = false; |
162 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 163 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
163 params.parent = NULL; | 164 params.parent = NULL; |
164 params.can_activate = true; | 165 params.can_activate = true; |
165 GetWidget()->Init(params); | 166 GetWidget()->Init(params); |
| 167 GetNativeView()->layer()->SetMasksToBounds(true); |
166 GetNativeWindow()->SetName("NativeTabContentsViewAura"); | 168 GetNativeWindow()->SetName("NativeTabContentsViewAura"); |
167 #if defined(USE_ASH) | 169 #if defined(USE_ASH) |
168 ash::SetChildWindowVisibilityChangesAnimated(GetWidget()->GetNativeView()); | 170 ash::SetChildWindowVisibilityChangesAnimated(GetWidget()->GetNativeView()); |
169 #else | 171 #else |
170 NOTIMPLEMENTED() << "Need to animate in"; | 172 NOTIMPLEMENTED() << "Need to animate in"; |
171 #endif | 173 #endif |
172 | 174 |
173 // Hide the widget to prevent it from showing up on the root window. This is | 175 // Hide the widget to prevent it from showing up on the root window. This is |
174 // needed for TabContentses that aren't immediately added to the tabstrip, | 176 // needed for TabContentses that aren't immediately added to the tabstrip, |
175 // e.g. the Instant preview contents. | 177 // e.g. the Instant preview contents. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 340 } |
339 | 341 |
340 //////////////////////////////////////////////////////////////////////////////// | 342 //////////////////////////////////////////////////////////////////////////////// |
341 // NativeTabContentsView, public: | 343 // NativeTabContentsView, public: |
342 | 344 |
343 // static | 345 // static |
344 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( | 346 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( |
345 internal::NativeTabContentsViewDelegate* delegate) { | 347 internal::NativeTabContentsViewDelegate* delegate) { |
346 return new NativeTabContentsViewAura(delegate); | 348 return new NativeTabContentsViewAura(delegate); |
347 } | 349 } |
OLD | NEW |