Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: chrome/browser/ui/app_list/app_list_shower_views.cc

Issue 508813002: Move ownership of the AppListViewDelegate into the AppListService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_shower_delegate.h ('k') | chrome/browser/ui/app_list/app_list_shower_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698