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