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