| 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 16 matching lines...) Expand all Loading... |
| 27 #include <dwmapi.h> | 27 #include <dwmapi.h> |
| 28 #include <shellapi.h> | 28 #include <shellapi.h> |
| 29 #include "base/task_runner_util.h" | 29 #include "base/task_runner_util.h" |
| 30 #include "base/win/windows_version.h" | 30 #include "base/win/windows_version.h" |
| 31 #include "chrome/browser/app_icon_win.h" | 31 #include "chrome/browser/app_icon_win.h" |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 33 #include "ui/base/win/shell.h" | 33 #include "ui/base/win/shell.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #if defined(USE_AURA) | 36 #if defined(USE_AURA) |
| 37 #include "ui/aura/window.h" |
| 37 #include "ui/aura/window_event_dispatcher.h" | 38 #include "ui/aura/window_event_dispatcher.h" |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 41 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
| 41 #include "chrome/browser/ui/host_desktop.h" | 42 #include "chrome/browser/ui/host_desktop.h" |
| 42 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 43 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 43 #include "ui/views/widget/native_widget_aura.h" | 44 #include "ui/views/widget/native_widget_aura.h" |
| 44 #endif | 45 #endif |
| 45 | 46 |
| 46 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 47 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 #if defined(USE_ASH) | 331 #if defined(USE_ASH) |
| 331 case chrome::HOST_DESKTOP_TYPE_ASH: | 332 case chrome::HOST_DESKTOP_TYPE_ASH: |
| 332 // If we're in ash, give this window the context of the main monitor. | 333 // If we're in ash, give this window the context of the main monitor. |
| 333 params->context = ash::Shell::GetPrimaryRootWindow(); | 334 params->context = ash::Shell::GetPrimaryRootWindow(); |
| 334 break; | 335 break; |
| 335 #endif | 336 #endif |
| 336 default: | 337 default: |
| 337 NOTREACHED(); | 338 NOTREACHED(); |
| 338 } | 339 } |
| 339 } else if (use_non_toplevel_window) { | 340 } else if (use_non_toplevel_window) { |
| 340 params->native_widget = new views::NativeWidgetAura(delegate); | 341 views::NativeWidgetAura* native_widget = |
| 342 new views::NativeWidgetAura(delegate); |
| 343 if (params->parent) { |
| 344 Profile* parent_profile = reinterpret_cast<Profile*>( |
| 345 params->parent->GetNativeWindowProperty(Profile::kProfileKey)); |
| 346 native_widget->SetNativeWindowProperty(Profile::kProfileKey, |
| 347 parent_profile); |
| 348 } |
| 349 params->native_widget = native_widget; |
| 341 } else if (params->type != views::Widget::InitParams::TYPE_TOOLTIP) { | 350 } else if (params->type != views::Widget::InitParams::TYPE_TOOLTIP) { |
| 342 // TODO(erg): Once we've threaded context to everywhere that needs it, we | 351 // TODO(erg): Once we've threaded context to everywhere that needs it, we |
| 343 // should remove this check here. | 352 // should remove this check here. |
| 344 gfx::NativeView to_check = | 353 gfx::NativeView to_check = |
| 345 params->context ? params->context : params->parent; | 354 params->context ? params->context : params->parent; |
| 346 if (chrome::GetHostDesktopTypeForNativeView(to_check) == | 355 if (chrome::GetHostDesktopTypeForNativeView(to_check) == |
| 347 chrome::HOST_DESKTOP_TYPE_NATIVE) { | 356 chrome::HOST_DESKTOP_TYPE_NATIVE) { |
| 348 params->native_widget = new views::DesktopNativeWidgetAura(delegate); | 357 params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
| 349 } | 358 } |
| 350 } | 359 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 409 } |
| 401 #endif | 410 #endif |
| 402 | 411 |
| 403 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) | 412 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) |
| 404 views::Widget::InitParams::WindowOpacity | 413 views::Widget::InitParams::WindowOpacity |
| 405 ChromeViewsDelegate::GetOpacityForInitParams( | 414 ChromeViewsDelegate::GetOpacityForInitParams( |
| 406 const views::Widget::InitParams& params) { | 415 const views::Widget::InitParams& params) { |
| 407 return views::Widget::InitParams::OPAQUE_WINDOW; | 416 return views::Widget::InitParams::OPAQUE_WINDOW; |
| 408 } | 417 } |
| 409 #endif | 418 #endif |
| OLD | NEW |