Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_list/app_list_shower_views.h" | 5 #include "chrome/browser/ui/app_list/app_list_shower_views.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "chrome/browser/apps/scoped_keep_alive.h" | 12 #include "chrome/browser/lifetime/keep_alive_types.h" |
| 13 #include "chrome/browser/lifetime/scoped_keep_alive.h" | |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" |
| 15 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 16 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
| 16 #include "ui/app_list/views/app_list_view.h" | 17 #include "ui/app_list/views/app_list_view.h" |
| 17 #include "ui/gfx/geometry/point.h" | 18 #include "ui/gfx/geometry/point.h" |
| 18 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
| 19 | 20 |
| 20 AppListShower::AppListShower(AppListShowerDelegate* delegate) | 21 AppListShower::AppListShower(AppListShowerDelegate* delegate) |
| 21 : delegate_(delegate), | 22 : delegate_(delegate), |
| 22 profile_(NULL), | 23 profile_(NULL), |
| 23 app_list_(NULL), | 24 app_list_(NULL), |
| 24 window_icon_updated_(false) { | 25 window_icon_updated_(false) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 AppListShower::~AppListShower() { | 28 AppListShower::~AppListShower() { |
| 28 } | 29 } |
| 29 | 30 |
| 30 void AppListShower::ShowForCurrentProfile() { | 31 void AppListShower::ShowForCurrentProfile() { |
| 31 DCHECK(HasView()); | 32 DCHECK(HasView()); |
| 32 keep_alive_.reset(new ScopedKeepAlive); | 33 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::APP_LIST_SHOWER)); |
|
sky
2016/02/25 18:43:50
Ugh! What a name (I get that you're matching the c
dgn
2016/02/25 20:08:50
Haha, I also had a double take while writing that.
| |
| 33 | 34 |
| 34 // If the app list is already displaying |profile| just activate it (in case | 35 // If the app list is already displaying |profile| just activate it (in case |
| 35 // we have lost focus). | 36 // we have lost focus). |
| 36 if (!IsAppListVisible()) | 37 if (!IsAppListVisible()) |
| 37 delegate_->MoveNearCursor(app_list_); | 38 delegate_->MoveNearCursor(app_list_); |
| 38 | 39 |
| 39 Show(); | 40 Show(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 gfx::NativeWindow AppListShower::GetWindow() { | 43 gfx::NativeWindow AppListShower::GetWindow() { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 FROM_HERE, | 150 FROM_HERE, |
| 150 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this))); | 151 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this))); |
| 151 return; | 152 return; |
| 152 } | 153 } |
| 153 ResetKeepAlive(); | 154 ResetKeepAlive(); |
| 154 } | 155 } |
| 155 | 156 |
| 156 void AppListShower::ResetKeepAlive() { | 157 void AppListShower::ResetKeepAlive() { |
| 157 keep_alive_.reset(); | 158 keep_alive_.reset(); |
| 158 } | 159 } |
| OLD | NEW |