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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #endif | 57 #endif |
58 | 58 |
59 #if defined(USE_ASH) | 59 #if defined(USE_ASH) |
60 #include "ash/accelerators/accelerator_controller.h" | 60 #include "ash/accelerators/accelerator_controller.h" |
61 #include "ash/shell.h" | 61 #include "ash/shell.h" |
62 #include "ash/wm/window_state.h" | 62 #include "ash/wm/window_state.h" |
63 #include "chrome/browser/ui/ash/ash_init.h" | 63 #include "chrome/browser/ui/ash/ash_init.h" |
64 #include "chrome/browser/ui/ash/ash_util.h" | 64 #include "chrome/browser/ui/ash/ash_util.h" |
65 #endif | 65 #endif |
66 | 66 |
67 | |
68 // Helpers -------------------------------------------------------------------- | 67 // Helpers -------------------------------------------------------------------- |
69 | 68 |
70 namespace { | 69 namespace { |
71 | 70 |
72 Profile* GetProfileForWindow(const views::Widget* window) { | 71 Profile* GetProfileForWindow(const views::Widget* window) { |
73 if (!window) | 72 if (!window) |
74 return NULL; | 73 return NULL; |
75 return reinterpret_cast<Profile*>( | 74 return reinterpret_cast<Profile*>( |
76 window->GetNativeWindowProperty(Profile::kProfileKey)); | 75 window->GetNativeWindowProperty(Profile::kProfileKey)); |
77 } | 76 } |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH && | 346 if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH && |
348 params->parent && | 347 params->parent && |
349 params->type != views::Widget::InitParams::TYPE_CONTROL && | 348 params->type != views::Widget::InitParams::TYPE_CONTROL && |
350 params->type != views::Widget::InitParams::TYPE_WINDOW) { | 349 params->type != views::Widget::InitParams::TYPE_WINDOW) { |
351 // When we set this to false, we get a DesktopNativeWidgetAura from the | 350 // When we set this to false, we get a DesktopNativeWidgetAura from the |
352 // default case (not handled in this function). | 351 // default case (not handled in this function). |
353 use_non_toplevel_window = false; | 352 use_non_toplevel_window = false; |
354 } | 353 } |
355 } | 354 } |
356 #endif // OS_WIN | 355 #endif // OS_WIN |
| 356 |
| 357 if (!use_non_toplevel_window && !native_widget_factory().is_null()) { |
| 358 params->native_widget = native_widget_factory().Run(*params, delegate); |
| 359 return; |
| 360 } |
357 #endif // USE_AURA | 361 #endif // USE_AURA |
358 | 362 |
359 #if defined(OS_CHROMEOS) | 363 #if defined(OS_CHROMEOS) |
360 // When we are doing straight chromeos builds, we still need to handle the | 364 // When we are doing straight chromeos builds, we still need to handle the |
361 // toplevel window case. | 365 // toplevel window case. |
362 // There may be a few remaining widgets in Chrome OS that are not top level, | 366 // There may be a few remaining widgets in Chrome OS that are not top level, |
363 // but have neither a context nor a parent. Provide a fallback context so | 367 // but have neither a context nor a parent. Provide a fallback context so |
364 // users don't crash. Developers will hit the DCHECK and should provide a | 368 // users don't crash. Developers will hit the DCHECK and should provide a |
365 // context. | 369 // context. |
366 if (params->context) | 370 if (params->context) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 return content::BrowserThread::GetBlockingPool(); | 484 return content::BrowserThread::GetBlockingPool(); |
481 } | 485 } |
482 | 486 |
483 #if !defined(USE_ASH) | 487 #if !defined(USE_ASH) |
484 views::Widget::InitParams::WindowOpacity | 488 views::Widget::InitParams::WindowOpacity |
485 ChromeViewsDelegate::GetOpacityForInitParams( | 489 ChromeViewsDelegate::GetOpacityForInitParams( |
486 const views::Widget::InitParams& params) { | 490 const views::Widget::InitParams& params) { |
487 return views::Widget::InitParams::OPAQUE_WINDOW; | 491 return views::Widget::InitParams::OPAQUE_WINDOW; |
488 } | 492 } |
489 #endif | 493 #endif |
OLD | NEW |