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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "ui/gfx/canvas.h" | 35 #include "ui/gfx/canvas.h" |
36 #include "ui/gfx/geometry/insets.h" | 36 #include "ui/gfx/geometry/insets.h" |
37 #include "ui/gfx/image/image_skia.h" | 37 #include "ui/gfx/image/image_skia.h" |
38 #include "ui/gfx/path.h" | 38 #include "ui/gfx/path.h" |
39 #include "ui/gfx/skia_util.h" | 39 #include "ui/gfx/skia_util.h" |
40 #include "ui/resources/grit/ui_resources.h" | 40 #include "ui/resources/grit/ui_resources.h" |
41 #include "ui/views/bubble/bubble_frame_view.h" | 41 #include "ui/views/bubble/bubble_frame_view.h" |
42 #include "ui/views/controls/image_view.h" | 42 #include "ui/views/controls/image_view.h" |
43 #include "ui/views/controls/textfield/textfield.h" | 43 #include "ui/views/controls/textfield/textfield.h" |
44 #include "ui/views/layout/fill_layout.h" | 44 #include "ui/views/layout/fill_layout.h" |
| 45 #include "ui/views/views_delegate.h" |
45 #include "ui/views/widget/widget.h" | 46 #include "ui/views/widget/widget.h" |
46 | 47 |
47 #if defined(USE_AURA) | 48 #if defined(USE_AURA) |
48 #include "ui/aura/window.h" | 49 #include "ui/aura/window.h" |
49 #include "ui/aura/window_tree_host.h" | 50 #include "ui/aura/window_tree_host.h" |
50 #include "ui/views/bubble/bubble_window_targeter.h" | 51 #include "ui/views/bubble/bubble_window_targeter.h" |
51 #include "ui/wm/core/masked_window_targeter.h" | 52 #include "ui/wm/core/masked_window_targeter.h" |
52 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
53 #include "ui/base/win/shell.h" | 54 #include "ui/base/win/shell.h" |
54 #endif | 55 #endif |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 if (delegate_) | 582 if (delegate_) |
582 delegate_->ViewInitialized(); | 583 delegate_->ViewInitialized(); |
583 | 584 |
584 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", | 585 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", |
585 base::Time::Now() - start_time); | 586 base::Time::Now() - start_time); |
586 } | 587 } |
587 | 588 |
588 void AppListView::OnBeforeBubbleWidgetInit( | 589 void AppListView::OnBeforeBubbleWidgetInit( |
589 views::Widget::InitParams* params, | 590 views::Widget::InitParams* params, |
590 views::Widget* widget) const { | 591 views::Widget* widget) const { |
| 592 if (!params->native_widget) { |
| 593 views::ViewsDelegate* views_delegate = views::ViewsDelegate::GetInstance(); |
| 594 if (views_delegate && !views_delegate->native_widget_factory().is_null()) { |
| 595 params->native_widget = |
| 596 views_delegate->native_widget_factory().Run(*params, widget); |
| 597 } |
| 598 } |
591 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 599 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
592 if (delegate_ && delegate_->ForceNativeDesktop()) | 600 if (!params->native_widget && delegate_ && delegate_->ForceNativeDesktop()) |
593 params->native_widget = new views::DesktopNativeWidgetAura(widget); | 601 params->native_widget = new views::DesktopNativeWidgetAura(widget); |
594 #endif | 602 #endif |
595 #if defined(OS_WIN) | 603 #if defined(OS_WIN) |
596 // Windows 7 and higher offer pinning to the taskbar, but we need presence | 604 // Windows 7 and higher offer pinning to the taskbar, but we need presence |
597 // on the taskbar for the user to be able to pin us. So, show the window on | 605 // on the taskbar for the user to be able to pin us. So, show the window on |
598 // the taskbar for these versions of Windows. | 606 // the taskbar for these versions of Windows. |
599 if (base::win::GetVersion() >= base::win::VERSION_WIN7) | 607 if (base::win::GetVersion() >= base::win::VERSION_WIN7) |
600 params->force_show_in_taskbar = true; | 608 params->force_show_in_taskbar = true; |
601 #elif defined(OS_LINUX) | 609 #elif defined(OS_LINUX) |
602 // Set up a custom WM_CLASS for the app launcher window. This allows task | 610 // Set up a custom WM_CLASS for the app launcher window. This allows task |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 app_list_main_view_->SetVisible(true); | 789 app_list_main_view_->SetVisible(true); |
782 // Refocus the search box. However, if the app list widget does not have | 790 // Refocus the search box. However, if the app list widget does not have |
783 // focus, it means another window has already taken focus, and we *must not* | 791 // focus, it means another window has already taken focus, and we *must not* |
784 // focus the search box (or we would steal focus back into the app list). | 792 // focus the search box (or we would steal focus back into the app list). |
785 if (GetWidget()->IsActive()) | 793 if (GetWidget()->IsActive()) |
786 search_box_view_->search_box()->RequestFocus(); | 794 search_box_view_->search_box()->RequestFocus(); |
787 } | 795 } |
788 } | 796 } |
789 | 797 |
790 } // namespace app_list | 798 } // namespace app_list |
OLD | NEW |