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

Side by Side Diff: chrome/browser/profiles/avatar_menu_model.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 (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/common/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 namespace { 25 namespace {
26 26
27 class ProfileSwitchObserver : public ProfileManagerObserver { 27 class ProfileSwitchObserver : public ProfileManagerObserver {
28 public: 28 public:
29 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE { 29 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE {
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 15 matching lines...) Expand all
46 Browser* browser) 46 Browser* browser)
47 : profile_info_(profile_cache), 47 : profile_info_(profile_cache),
48 observer_(observer), 48 observer_(observer),
49 browser_(browser) { 49 browser_(browser) {
50 DCHECK(profile_info_); 50 DCHECK(profile_info_);
51 DCHECK(observer_); 51 DCHECK(observer_);
52 // Don't DCHECK(browser_) so that unit tests can reuse this ctor. 52 // Don't DCHECK(browser_) so that unit tests can reuse this ctor.
53 53
54 // Register this as an observer of the info cache. 54 // Register this as an observer of the info cache.
55 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 55 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
56 NotificationService::AllSources()); 56 content::NotificationService::AllSources());
57 57
58 // Build the initial menu. 58 // Build the initial menu.
59 RebuildMenu(); 59 RebuildMenu();
60 } 60 }
61 61
62 AvatarMenuModel::~AvatarMenuModel() { 62 AvatarMenuModel::~AvatarMenuModel() {
63 ClearMenu(); 63 ClearMenu();
64 } 64 }
65 65
66 AvatarMenuModel::Item::Item(size_t model_index, const gfx::Image& icon) 66 AvatarMenuModel::Item::Item(size_t model_index, const gfx::Image& icon)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 item->active = browser_->profile()->GetPath() == path; 139 item->active = browser_->profile()->GetPath() == path;
140 } 140 }
141 items_.push_back(item); 141 items_.push_back(item);
142 } 142 }
143 } 143 }
144 144
145 void AvatarMenuModel::ClearMenu() { 145 void AvatarMenuModel::ClearMenu() {
146 STLDeleteContainerPointers(items_.begin(), items_.end()); 146 STLDeleteContainerPointers(items_.begin(), items_.end());
147 items_.clear(); 147 items_.clear();
148 } 148 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | chrome/browser/profiles/off_the_record_profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698