| OLD | NEW |
| 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/profiles/avatar_menu_model.h" | 5 #include "chrome/browser/profiles/avatar_menu_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/profiles/avatar_menu_model_observer.h" | 11 #include "chrome/browser/profiles/avatar_menu_model_observer.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/profiles/profile_info_cache.h" | 13 #include "chrome/browser/profiles/profile_info_cache.h" |
| 14 #include "chrome/browser/profiles/profile_info_util.h" | 14 #include "chrome/browser/profiles/profile_info_util.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/profiles/profile_metrics.h" | 16 #include "chrome/browser/profiles/profile_metrics.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_init.h" | |
| 19 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 21 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 | 26 |
| 27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 void OnProfileCreated(bool always_create, | 31 void OnProfileCreated(bool always_create, |
| 32 Profile* profile, | 32 Profile* profile, |
| 33 Profile::CreateStatus status) { | 33 Profile::CreateStatus status) { |
| 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 35 | 35 |
| 36 if (status == Profile::CREATE_STATUS_INITIALIZED) { | 36 if (status == Profile::CREATE_STATUS_INITIALIZED) { |
| 37 ProfileManager::FindOrCreateNewWindowForProfile( | 37 ProfileManager::FindOrCreateNewWindowForProfile( |
| 38 profile, | 38 profile, |
| 39 BrowserInit::IS_NOT_PROCESS_STARTUP, | 39 StartupBrowserCreator::IS_NOT_PROCESS_STARTUP, |
| 40 BrowserInit::IS_NOT_FIRST_RUN, | 40 StartupBrowserCreator::IS_NOT_FIRST_RUN, |
| 41 always_create); | 41 always_create); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 AvatarMenuModel::AvatarMenuModel(ProfileInfoInterface* profile_cache, | 47 AvatarMenuModel::AvatarMenuModel(ProfileInfoInterface* profile_cache, |
| 48 AvatarMenuModelObserver* observer, | 48 AvatarMenuModelObserver* observer, |
| 49 Browser* browser) | 49 Browser* browser) |
| 50 : profile_info_(profile_cache), | 50 : profile_info_(profile_cache), |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 item->active = browser_->profile()->GetPath() == path; | 170 item->active = browser_->profile()->GetPath() == path; |
| 171 } | 171 } |
| 172 items_.push_back(item); | 172 items_.push_back(item); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 void AvatarMenuModel::ClearMenu() { | 176 void AvatarMenuModel::ClearMenu() { |
| 177 STLDeleteContainerPointers(items_.begin(), items_.end()); | 177 STLDeleteContainerPointers(items_.begin(), items_.end()); |
| 178 items_.clear(); | 178 items_.clear(); |
| 179 } | 179 } |
| OLD | NEW |