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/chrome_views_delegate.h" | 5 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include <dwmapi.h> | 26 #include <dwmapi.h> |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #include "chrome/browser/app_icon_win.h" | 28 #include "chrome/browser/app_icon_win.h" |
29 #include "ui/base/win/shell.h" | 29 #include "ui/base/win/shell.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(USE_AURA) | 32 #if defined(USE_AURA) |
| 33 #include "ui/aura/window.h" |
33 #include "ui/aura/window_event_dispatcher.h" | 34 #include "ui/aura/window_event_dispatcher.h" |
34 #endif | 35 #endif |
35 | 36 |
36 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 37 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
37 #include "chrome/browser/ui/host_desktop.h" | 38 #include "chrome/browser/ui/host_desktop.h" |
38 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 39 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
39 #include "ui/views/widget/native_widget_aura.h" | 40 #include "ui/views/widget/native_widget_aura.h" |
40 #endif | 41 #endif |
41 | 42 |
42 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 43 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 #if defined(USE_ASH) | 281 #if defined(USE_ASH) |
281 case chrome::HOST_DESKTOP_TYPE_ASH: | 282 case chrome::HOST_DESKTOP_TYPE_ASH: |
282 // If we're in ash, give this window the context of the main monitor. | 283 // If we're in ash, give this window the context of the main monitor. |
283 params->context = ash::Shell::GetPrimaryRootWindow(); | 284 params->context = ash::Shell::GetPrimaryRootWindow(); |
284 break; | 285 break; |
285 #endif | 286 #endif |
286 default: | 287 default: |
287 NOTREACHED(); | 288 NOTREACHED(); |
288 } | 289 } |
289 } else if (use_non_toplevel_window) { | 290 } else if (use_non_toplevel_window) { |
290 params->native_widget = new views::NativeWidgetAura(delegate); | 291 views::NativeWidgetAura* native_widget = |
| 292 new views::NativeWidgetAura(delegate); |
| 293 if (params->parent) { |
| 294 Profile* parent_profile = reinterpret_cast<Profile*>( |
| 295 params->parent->GetNativeWindowProperty(Profile::kProfileKey)); |
| 296 native_widget->SetNativeWindowProperty(Profile::kProfileKey, |
| 297 parent_profile); |
| 298 } |
| 299 params->native_widget = native_widget; |
291 } else if (params->type != views::Widget::InitParams::TYPE_TOOLTIP) { | 300 } else if (params->type != views::Widget::InitParams::TYPE_TOOLTIP) { |
292 // TODO(erg): Once we've threaded context to everywhere that needs it, we | 301 // TODO(erg): Once we've threaded context to everywhere that needs it, we |
293 // should remove this check here. | 302 // should remove this check here. |
294 gfx::NativeView to_check = | 303 gfx::NativeView to_check = |
295 params->context ? params->context : params->parent; | 304 params->context ? params->context : params->parent; |
296 if (chrome::GetHostDesktopTypeForNativeView(to_check) == | 305 if (chrome::GetHostDesktopTypeForNativeView(to_check) == |
297 chrome::HOST_DESKTOP_TYPE_NATIVE) { | 306 chrome::HOST_DESKTOP_TYPE_NATIVE) { |
298 params->native_widget = new views::DesktopNativeWidgetAura(delegate); | 307 params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
299 } | 308 } |
300 } | 309 } |
(...skipping 16 matching lines...) Expand all Loading... |
317 return false; | 326 return false; |
318 } | 327 } |
319 | 328 |
320 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) | 329 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) |
321 views::Widget::InitParams::WindowOpacity | 330 views::Widget::InitParams::WindowOpacity |
322 ChromeViewsDelegate::GetOpacityForInitParams( | 331 ChromeViewsDelegate::GetOpacityForInitParams( |
323 const views::Widget::InitParams& params) { | 332 const views::Widget::InitParams& params) { |
324 return views::Widget::InitParams::OPAQUE_WINDOW; | 333 return views::Widget::InitParams::OPAQUE_WINDOW; |
325 } | 334 } |
326 #endif | 335 #endif |
OLD | NEW |