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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 45 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
46 #include "chrome/browser/ui/host_desktop.h" | 46 #include "chrome/browser/ui/host_desktop.h" |
47 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 47 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
48 #include "ui/views/widget/native_widget_aura.h" | 48 #include "ui/views/widget/native_widget_aura.h" |
49 #endif | 49 #endif |
50 | 50 |
51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
52 #include "ui/views/linux_ui/linux_ui.h" | 52 #include "ui/views/linux_ui/linux_ui.h" |
53 #endif | 53 #endif |
54 | 54 |
55 #if defined(OS_ANDROID) | |
56 #include "ui/views/widget/android/native_widget_android.h" | |
57 #endif | |
58 | |
55 #if defined(USE_ASH) | 59 #if defined(USE_ASH) |
56 #include "ash/accelerators/accelerator_controller.h" | 60 #include "ash/accelerators/accelerator_controller.h" |
57 #include "ash/shell.h" | 61 #include "ash/shell.h" |
58 #include "ash/wm/window_state.h" | 62 #include "ash/wm/window_state.h" |
59 #include "chrome/browser/ui/ash/ash_init.h" | 63 #include "chrome/browser/ui/ash/ash_init.h" |
60 #include "chrome/browser/ui/ash/ash_util.h" | 64 #include "chrome/browser/ui/ash/ash_util.h" |
61 #endif | 65 #endif |
62 | 66 |
63 | 67 |
64 // Helpers -------------------------------------------------------------------- | 68 // Helpers -------------------------------------------------------------------- |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 case chrome::HOST_DESKTOP_TYPE_ASH: | 386 case chrome::HOST_DESKTOP_TYPE_ASH: |
383 // If we're in ash, give this window the context of the main monitor. | 387 // If we're in ash, give this window the context of the main monitor. |
384 params->context = ash::Shell::GetPrimaryRootWindow(); | 388 params->context = ash::Shell::GetPrimaryRootWindow(); |
385 break; | 389 break; |
386 #endif | 390 #endif |
387 default: | 391 default: |
388 NOTREACHED(); | 392 NOTREACHED(); |
389 } | 393 } |
390 } else if (use_non_toplevel_window) { | 394 } else if (use_non_toplevel_window) { |
391 views::NativeWidgetAura* native_widget = | 395 views::NativeWidgetAura* native_widget = |
392 new views::NativeWidgetAura(delegate); | 396 new views::NativeWidgetAura(delegate); |
mfomitchev
2015/11/04 23:21:13
So we are using both NativeWidgetAndroid and Nativ
bshe
2015/11/11 00:38:28
Done.
| |
393 if (params->parent) { | 397 if (params->parent) { |
394 Profile* parent_profile = reinterpret_cast<Profile*>( | 398 Profile* parent_profile = reinterpret_cast<Profile*>( |
395 params->parent->GetNativeWindowProperty(Profile::kProfileKey)); | 399 params->parent->GetNativeWindowProperty(Profile::kProfileKey)); |
396 native_widget->SetNativeWindowProperty(Profile::kProfileKey, | 400 native_widget->SetNativeWindowProperty(Profile::kProfileKey, |
397 parent_profile); | 401 parent_profile); |
398 } | 402 } |
399 params->native_widget = native_widget; | 403 params->native_widget = native_widget; |
400 } else { | 404 } else { |
401 // TODO(erg): Once we've threaded context to everywhere that needs it, we | 405 // TODO(erg): Once we've threaded context to everywhere that needs it, we |
402 // should remove this check here. | 406 // should remove this check here. |
403 gfx::NativeView to_check = | 407 gfx::NativeView to_check = |
404 params->context ? params->context : params->parent; | 408 params->context ? params->context : params->parent; |
405 if (chrome::GetHostDesktopTypeForNativeView(to_check) == | 409 if (chrome::GetHostDesktopTypeForNativeView(to_check) == |
406 chrome::HOST_DESKTOP_TYPE_NATIVE) { | 410 chrome::HOST_DESKTOP_TYPE_NATIVE) { |
411 #if defined(OS_ANDROID) | |
412 params->native_widget = new views::NativeWidgetAndroid(delegate); | |
413 #else | |
407 params->native_widget = new views::DesktopNativeWidgetAura(delegate); | 414 params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
415 #endif | |
408 } | 416 } |
409 } | 417 } |
410 #endif | 418 #endif |
411 } | 419 } |
412 | 420 |
413 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 421 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
414 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { | 422 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { |
415 // On Ubuntu Unity, the system always provides a title bar for maximized | 423 // On Ubuntu Unity, the system always provides a title bar for maximized |
416 // windows. | 424 // windows. |
417 views::LinuxUI* ui = views::LinuxUI::instance(); | 425 views::LinuxUI* ui = views::LinuxUI::instance(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
472 return content::BrowserThread::GetBlockingPool(); | 480 return content::BrowserThread::GetBlockingPool(); |
473 } | 481 } |
474 | 482 |
475 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) | 483 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) |
476 views::Widget::InitParams::WindowOpacity | 484 views::Widget::InitParams::WindowOpacity |
477 ChromeViewsDelegate::GetOpacityForInitParams( | 485 ChromeViewsDelegate::GetOpacityForInitParams( |
478 const views::Widget::InitParams& params) { | 486 const views::Widget::InitParams& params) { |
479 return views::Widget::InitParams::OPAQUE_WINDOW; | 487 return views::Widget::InitParams::OPAQUE_WINDOW; |
480 } | 488 } |
481 #endif | 489 #endif |
OLD | NEW |