OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profiles/avatar_menu_model_observer.h" | 10 #include "chrome/browser/profiles/avatar_menu_model_observer.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_info_cache.h" | 12 #include "chrome/browser/profiles/profile_info_cache.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_init.h" | 15 #include "chrome/browser/ui/browser_init.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
24 | 24 |
| 25 using content::BrowserThread; |
| 26 |
25 namespace { | 27 namespace { |
26 | 28 |
27 class ProfileSwitchObserver : public ProfileManagerObserver { | 29 class ProfileSwitchObserver : public ProfileManagerObserver { |
28 public: | 30 public: |
29 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE { | 31 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE { |
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
31 | 33 |
32 if (status == STATUS_INITIALIZED) { | 34 if (status == STATUS_INITIALIZED) { |
33 ProfileManager::NewWindowWithProfile(profile, | 35 ProfileManager::NewWindowWithProfile(profile, |
34 BrowserInit::IS_NOT_PROCESS_STARTUP, | 36 BrowserInit::IS_NOT_PROCESS_STARTUP, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 item->active = browser_->profile()->GetPath() == path; | 155 item->active = browser_->profile()->GetPath() == path; |
154 } | 156 } |
155 items_.push_back(item); | 157 items_.push_back(item); |
156 } | 158 } |
157 } | 159 } |
158 | 160 |
159 void AvatarMenuModel::ClearMenu() { | 161 void AvatarMenuModel::ClearMenu() { |
160 STLDeleteContainerPointers(items_.begin(), items_.end()); | 162 STLDeleteContainerPointers(items_.begin(), items_.end()); |
161 items_.clear(); | 163 items_.clear(); |
162 } | 164 } |
OLD | NEW |