| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" | 10 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 DCHECK(!profile_); | 92 DCHECK(!profile_); |
| 93 CreateViewForProfile(profile); | 93 CreateViewForProfile(profile); |
| 94 app_list_->Prerender(); | 94 app_list_->Prerender(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool AppListShower::HasView() const { | 97 bool AppListShower::HasView() const { |
| 98 return !!app_list_; | 98 return !!app_list_; |
| 99 } | 99 } |
| 100 | 100 |
| 101 app_list::AppListView* AppListShower::MakeViewForCurrentProfile() { | 101 app_list::AppListView* AppListShower::MakeViewForCurrentProfile() { |
| 102 // The view delegate will be owned by the app list view. The app list view | 102 // The app list view manages its own lifetime. |
| 103 // manages its own lifetime. | 103 app_list::AppListView* view = |
| 104 AppListViewDelegate* view_delegate = new AppListViewDelegate( | 104 new app_list::AppListView(delegate_->GetViewDelegateForCreate()); |
| 105 profile_, delegate_->GetControllerDelegateForCreate()); | |
| 106 app_list::AppListView* view = new app_list::AppListView(view_delegate); | |
| 107 gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); | 105 gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); |
| 108 view->InitAsBubbleAtFixedLocation(NULL, | 106 view->InitAsBubbleAtFixedLocation(NULL, |
| 109 0, | 107 0, |
| 110 cursor, | 108 cursor, |
| 111 views::BubbleBorder::FLOAT, | 109 views::BubbleBorder::FLOAT, |
| 112 false /* border_accepts_events */); | 110 false /* border_accepts_events */); |
| 113 return view; | 111 return view; |
| 114 } | 112 } |
| 115 | 113 |
| 116 void AppListShower::UpdateViewForNewProfile() { | 114 void AppListShower::UpdateViewForNewProfile() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 136 FROM_HERE, | 134 FROM_HERE, |
| 137 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this))); | 135 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this))); |
| 138 return; | 136 return; |
| 139 } | 137 } |
| 140 ResetKeepAlive(); | 138 ResetKeepAlive(); |
| 141 } | 139 } |
| 142 | 140 |
| 143 void AppListShower::ResetKeepAlive() { | 141 void AppListShower::ResetKeepAlive() { |
| 144 keep_alive_.reset(); | 142 keep_alive_.reset(); |
| 145 } | 143 } |
| OLD | NEW |