OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions/extension_toolbar_model.h" | 5 #include "chrome/browser/extensions/extension_toolbar_model.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_prefs.h" | 7 #include "chrome/browser/extensions/extension_prefs.h" |
8 #include "chrome/browser/extensions/extensions_service.h" | 8 #include "chrome/browser/extensions/extensions_service.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 Source<Profile>(service_->profile())); | 26 Source<Profile>(service_->profile())); |
27 registrar_.Add(this, NotificationType::EXTENSIONS_READY, | 27 registrar_.Add(this, NotificationType::EXTENSIONS_READY, |
28 Source<Profile>(service_->profile())); | 28 Source<Profile>(service_->profile())); |
29 | 29 |
30 visible_icon_count_ = prefs_->GetInteger(prefs::kExtensionToolbarSize); | 30 visible_icon_count_ = prefs_->GetInteger(prefs::kExtensionToolbarSize); |
31 } | 31 } |
32 | 32 |
33 ExtensionToolbarModel::~ExtensionToolbarModel() { | 33 ExtensionToolbarModel::~ExtensionToolbarModel() { |
34 } | 34 } |
35 | 35 |
| 36 void ExtensionToolbarModel::DestroyingProfile() { |
| 37 registrar_.RemoveAll(); |
| 38 } |
| 39 |
36 void ExtensionToolbarModel::AddObserver(Observer* observer) { | 40 void ExtensionToolbarModel::AddObserver(Observer* observer) { |
37 observers_.AddObserver(observer); | 41 observers_.AddObserver(observer); |
38 } | 42 } |
39 | 43 |
40 void ExtensionToolbarModel::RemoveObserver(Observer* observer) { | 44 void ExtensionToolbarModel::RemoveObserver(Observer* observer) { |
41 observers_.RemoveObserver(observer); | 45 observers_.RemoveObserver(observer); |
42 } | 46 } |
43 | 47 |
44 void ExtensionToolbarModel::MoveBrowserAction(Extension* extension, | 48 void ExtensionToolbarModel::MoveBrowserAction(Extension* extension, |
45 int index) { | 49 int index) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 int incognito_index = 0, i = 0; | 228 int incognito_index = 0, i = 0; |
225 for (ExtensionList::iterator iter = begin(); iter != end(); | 229 for (ExtensionList::iterator iter = begin(); iter != end(); |
226 ++iter, ++i) { | 230 ++iter, ++i) { |
227 if (original_index == i) | 231 if (original_index == i) |
228 break; | 232 break; |
229 if (service_->IsIncognitoEnabled(*iter)) | 233 if (service_->IsIncognitoEnabled(*iter)) |
230 ++incognito_index; | 234 ++incognito_index; |
231 } | 235 } |
232 return incognito_index; | 236 return incognito_index; |
233 } | 237 } |
OLD | NEW |