Chromium Code Reviews| Index: chrome/browser/ui/views/task_manager_view.cc |
| diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc |
| index f49a4a2069e18dc2fdf8b35c920cb69bd9b2357f..ad3829517cd97e7cdb219f133d377b68ce7c36eb 100644 |
| --- a/chrome/browser/ui/views/task_manager_view.cc |
| +++ b/chrome/browser/ui/views/task_manager_view.cc |
| @@ -44,6 +44,10 @@ |
| #include "ui/views/widget/widget.h" |
| #include "ui/views/window/dialog_delegate.h" |
| +#if defined(USE_ASH) |
| +#include "ash/wm/window_util.h" |
| +#endif |
| + |
| #if defined(OS_WIN) |
| #include "win8/util/win8_util.h" |
| #endif |
| @@ -531,7 +535,8 @@ void TaskManagerView::Show(bool highlight_background_resources, |
| // In Windows Metro it's not good to open this native window. |
| DCHECK(!win8::IsSingleWindowMetroMode()); |
| #endif |
| - const chrome::HostDesktopType desktop_type = browser->host_desktop_type(); |
| + const chrome::HostDesktopType desktop_type = |
| + browser ? browser->host_desktop_type() : chrome::HOST_DESKTOP_TYPE_ASH; |
|
sky
2013/03/20 23:52:08
Document why browser == NULL is treated as ASH.
Mr4D (OOO till 08-26)
2013/03/21 00:20:10
Done.
|
| if (instance_) { |
| if (instance_->highlight_background_resources_ != |
| @@ -545,8 +550,12 @@ void TaskManagerView::Show(bool highlight_background_resources, |
| } |
| } |
| instance_ = new TaskManagerView(highlight_background_resources, desktop_type); |
| - DialogDelegateView::CreateDialogWidget(instance_, |
| - browser->window()->GetNativeWindow(), NULL); |
| + aura::Window* window = browser ? browser->window()->GetNativeWindow() : NULL; |
| +#if defined(USE_ASH) |
| + if (!window) |
| + window = ash::wm::GetActiveWindow(); |
| +#endif |
| + DialogDelegateView::CreateDialogWidget(instance_, window, NULL); |
|
sky
2013/03/20 23:52:08
Can you verify this does the right thing if window
Mr4D (OOO till 08-26)
2013/03/21 00:20:10
I did already before checking in and it did not.
sky
2013/03/21 00:25:55
So then don't you need to deal with it being null
Mr4D (OOO till 08-26)
2013/03/21 00:29:30
You misunderstood - It did not cause any problems
|
| instance_->InitAlwaysOnTopState(); |
| instance_->model_->StartUpdating(); |
| instance_->GetWidget()->Show(); |
| @@ -763,12 +772,8 @@ bool TaskManagerView::GetSavedAlwaysOnTopState(bool* always_on_top) const { |
| namespace chrome { |
| // Declared in browser_dialogs.h so others don't need to depend on our header. |
| -void ShowTaskManager(Browser* browser) { |
| - TaskManagerView::Show(false, browser); |
| -} |
| - |
| -void ShowBackgroundPages(Browser* browser) { |
| - TaskManagerView::Show(true, browser); |
| +void ShowTaskManager(Browser* browser, bool highlight_background_resources) { |
| + TaskManagerView::Show(highlight_background_resources, browser); |
| } |
| } // namespace chrome |