| 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/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/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 FOR_EACH_OBSERVER(Observer, observers_, BrowserActionMoved(extension, index)); | 72 FOR_EACH_OBSERVER(Observer, observers_, BrowserActionMoved(extension, index)); |
| 73 | 73 |
| 74 UpdatePrefs(); | 74 UpdatePrefs(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void ExtensionToolbarModel::SetVisibleIconCount(int count) { | 77 void ExtensionToolbarModel::SetVisibleIconCount(int count) { |
| 78 visible_icon_count_ = count == static_cast<int>(size()) ? -1 : count; | 78 visible_icon_count_ = count == static_cast<int>(size()) ? -1 : count; |
| 79 prefs_->SetInteger(prefs::kExtensionToolbarSize, visible_icon_count_); | 79 prefs_->SetInteger(prefs::kExtensionToolbarSize, visible_icon_count_); |
| 80 prefs_->ScheduleSavePersistentPrefs(); | |
| 81 } | 80 } |
| 82 | 81 |
| 83 void ExtensionToolbarModel::Observe(int type, | 82 void ExtensionToolbarModel::Observe(int type, |
| 84 const NotificationSource& source, | 83 const NotificationSource& source, |
| 85 const NotificationDetails& details) { | 84 const NotificationDetails& details) { |
| 86 if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { | 85 if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { |
| 87 InitializeExtensionList(); | 86 InitializeExtensionList(); |
| 88 return; | 87 return; |
| 89 } | 88 } |
| 90 | 89 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 int incognito_index = 0, i = 0; | 248 int incognito_index = 0, i = 0; |
| 250 for (ExtensionList::iterator iter = begin(); iter != end(); | 249 for (ExtensionList::iterator iter = begin(); iter != end(); |
| 251 ++iter, ++i) { | 250 ++iter, ++i) { |
| 252 if (original_index == i) | 251 if (original_index == i) |
| 253 break; | 252 break; |
| 254 if (service_->IsIncognitoEnabled((*iter)->id())) | 253 if (service_->IsIncognitoEnabled((*iter)->id())) |
| 255 ++incognito_index; | 254 ++incognito_index; |
| 256 } | 255 } |
| 257 return incognito_index; | 256 return incognito_index; |
| 258 } | 257 } |
| OLD | NEW |