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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/custom_launcher_page_contents.h" 9 #include "apps/custom_launcher_page_contents.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 extensions::LauncherPageHandler::GetInfo(extension); 140 extensions::LauncherPageHandler::GetInfo(extension);
141 if (!info) 141 if (!info)
142 continue; 142 continue;
143 143
144 urls->push_back(extension->GetResourceURL(info->page)); 144 urls->push_back(extension->GetResourceURL(info->page));
145 } 145 }
146 } 146 }
147 147
148 } // namespace 148 } // namespace
149 149
150 AppListViewDelegate::AppListViewDelegate(Profile* profile, 150 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller)
151 AppListControllerDelegate* controller)
152 : controller_(controller), 151 : controller_(controller),
153 profile_(NULL), 152 profile_(NULL),
154 model_(NULL), 153 model_(NULL),
155 scoped_observer_(this) { 154 scoped_observer_(this) {
156 CHECK(controller_); 155 CHECK(controller_);
157 // The SigninManagerFactor and the SigninManagers are observed to keep the 156 // The SigninManagerFactor and the SigninManagers are observed to keep the
158 // profile switcher menu up to date, with the correct list of profiles and the 157 // profile switcher menu up to date, with the correct list of profiles and the
159 // correct email address (or none for signed out users) for each. 158 // correct email address (or none for signed out users) for each.
160 SigninManagerFactory::GetInstance()->AddObserver(this); 159 SigninManagerFactory::GetInstance()->AddObserver(this);
161 160
(...skipping 12 matching lines...) Expand all
174 } 173 }
175 174
176 profile_manager->GetProfileInfoCache().AddObserver(this); 175 profile_manager->GetProfileInfoCache().AddObserver(this);
177 speech_ui_.reset(new app_list::SpeechUIModel); 176 speech_ui_.reset(new app_list::SpeechUIModel);
178 177
179 #if defined(GOOGLE_CHROME_BUILD) 178 #if defined(GOOGLE_CHROME_BUILD)
180 speech_ui_->set_logo( 179 speech_ui_->set_logo(
181 *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 180 *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
182 IDR_APP_LIST_GOOGLE_LOGO_VOICE_SEARCH)); 181 IDR_APP_LIST_GOOGLE_LOGO_VOICE_SEARCH));
183 #endif 182 #endif
184 SetProfile(profile);
185 183
186 registrar_.Add(this, 184 registrar_.Add(this,
187 chrome::NOTIFICATION_APP_TERMINATING, 185 chrome::NOTIFICATION_APP_TERMINATING,
188 content::NotificationService::AllSources()); 186 content::NotificationService::AllSources());
189 } 187 }
190 188
191 AppListViewDelegate::~AppListViewDelegate() { 189 AppListViewDelegate::~AppListViewDelegate() {
192 // Note that the destructor is not always called. E.g. on Mac, this is owned 190 // Note that the destructor is not always called. E.g. on Mac, this is owned
193 // by a leaky singleton. Essential shutdown work must be done by observing 191 // by a leaky singleton. Essential shutdown work must be done by observing
194 // chrome::NOTIFICATION_APP_TERMINATING. 192 // chrome::NOTIFICATION_APP_TERMINATING.
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 650
653 // SigninManagerFactory is not a leaky singleton (unlike this class), and 651 // SigninManagerFactory is not a leaky singleton (unlike this class), and
654 // its destructor will check that it has no remaining observers. 652 // its destructor will check that it has no remaining observers.
655 scoped_observer_.RemoveAll(); 653 scoped_observer_.RemoveAll();
656 SigninManagerFactory::GetInstance()->RemoveObserver(this); 654 SigninManagerFactory::GetInstance()->RemoveObserver(this);
657 break; 655 break;
658 default: 656 default:
659 NOTREACHED(); 657 NOTREACHED();
660 } 658 }
661 } 659 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | chrome/browser/ui/ash/chrome_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698