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

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

Issue 492163002: Fix Profile* lifetime issues in Chrome's AppListViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update unit test, cl format Created 6 years, 4 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 | Annotate | Revision Log
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 view delegate will be owned by the app list view. The app list view
103 // manages its own lifetime. 103 // manages its own lifetime.
104 AppListViewDelegate* view_delegate = new AppListViewDelegate( 104 AppListViewDelegate* view_delegate =
105 profile_, delegate_->GetControllerDelegateForCreate()); 105 new AppListViewDelegate(delegate_->GetControllerDelegateForCreate());
106 view_delegate->SetProfile(profile_);
106 app_list::AppListView* view = new app_list::AppListView(view_delegate); 107 app_list::AppListView* view = new app_list::AppListView(view_delegate);
107 gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); 108 gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
108 view->InitAsBubbleAtFixedLocation(NULL, 109 view->InitAsBubbleAtFixedLocation(NULL,
109 0, 110 0,
110 cursor, 111 cursor,
111 views::BubbleBorder::FLOAT, 112 views::BubbleBorder::FLOAT,
112 false /* border_accepts_events */); 113 false /* border_accepts_events */);
113 return view; 114 return view;
114 } 115 }
115 116
(...skipping 20 matching lines...) Expand all
136 FROM_HERE, 137 FROM_HERE,
137 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this))); 138 base::Bind(&AppListShower::ResetKeepAlive, base::Unretained(this)));
138 return; 139 return;
139 } 140 }
140 ResetKeepAlive(); 141 ResetKeepAlive();
141 } 142 }
142 143
143 void AppListShower::ResetKeepAlive() { 144 void AppListShower::ResetKeepAlive() {
144 keep_alive_.reset(); 145 keep_alive_.reset();
145 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698