| 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/lifetime/keep_alive_types.h" | 12 #include "chrome/browser/lifetime/keep_alive_types.h" |
| 13 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 13 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" |
| 16 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 16 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
| 17 #include "ui/app_list/views/app_list_view.h" | 17 #include "ui/app_list/views/app_list_view.h" |
| 18 #include "ui/display/screen.h" |
| 18 #include "ui/gfx/geometry/point.h" | 19 #include "ui/gfx/geometry/point.h" |
| 19 #include "ui/gfx/screen.h" | |
| 20 | 20 |
| 21 AppListShower::AppListShower(AppListShowerDelegate* delegate) | 21 AppListShower::AppListShower(AppListShowerDelegate* delegate) |
| 22 : delegate_(delegate), | 22 : delegate_(delegate), |
| 23 profile_(NULL), | 23 profile_(NULL), |
| 24 app_list_(NULL), | 24 app_list_(NULL), |
| 25 window_icon_updated_(false) { | 25 window_icon_updated_(false) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 AppListShower::~AppListShower() { | 28 AppListShower::~AppListShower() { |
| 29 } | 29 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 app_list::AppListView* view; | 112 app_list::AppListView* view; |
| 113 { | 113 { |
| 114 // TODO(tapted): Remove ScopedTracker below once crbug.com/431326 is fixed. | 114 // TODO(tapted): Remove ScopedTracker below once crbug.com/431326 is fixed. |
| 115 tracked_objects::ScopedTracker tracking_profile1( | 115 tracked_objects::ScopedTracker tracking_profile1( |
| 116 FROM_HERE_WITH_EXPLICIT_FUNCTION("431326 AppListView()")); | 116 FROM_HERE_WITH_EXPLICIT_FUNCTION("431326 AppListView()")); |
| 117 | 117 |
| 118 // The app list view manages its own lifetime. | 118 // The app list view manages its own lifetime. |
| 119 view = new app_list::AppListView(delegate_->GetViewDelegateForCreate()); | 119 view = new app_list::AppListView(delegate_->GetViewDelegateForCreate()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 gfx::Point cursor = gfx::Screen::GetScreen()->GetCursorScreenPoint(); | 122 gfx::Point cursor = display::Screen::GetScreen()->GetCursorScreenPoint(); |
| 123 view->InitAsBubbleAtFixedLocation(NULL, | 123 view->InitAsBubbleAtFixedLocation(NULL, |
| 124 0, | 124 0, |
| 125 cursor, | 125 cursor, |
| 126 views::BubbleBorder::FLOAT, | 126 views::BubbleBorder::FLOAT, |
| 127 false /* border_accepts_events */); | 127 false /* border_accepts_events */); |
| 128 return view; | 128 return view; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void AppListShower::UpdateViewForNewProfile() { | 131 void AppListShower::UpdateViewForNewProfile() { |
| 132 app_list_->SetProfileByPath(profile_->GetPath()); | 132 app_list_->SetProfileByPath(profile_->GetPath()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 151 FROM_HERE, | 151 FROM_HERE, |
| 152 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this))); | 152 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this))); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 ResetKeepAlive(); | 155 ResetKeepAlive(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void AppListShower::ResetKeepAlive() { | 158 void AppListShower::ResetKeepAlive() { |
| 159 keep_alive_.reset(); | 159 keep_alive_.reset(); |
| 160 } | 160 } |
| OLD | NEW |