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

Unified Diff: chrome/browser/extensions/extension_toolbar_model.cc

Issue 368133005: Fixes for re-enabling more MSVC level 4 warnings: chrome/browser/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_toolbar_model.cc
diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc
index 4e1a472ff29b9f1c8d99e2c210ebd31e095fb78b..86a64d7f4064e2e89bf1631d459205f85dc65b0a 100644
--- a/chrome/browser/extensions/extension_toolbar_model.cc
+++ b/chrome/browser/extensions/extension_toolbar_model.cc
@@ -256,7 +256,7 @@ size_t ExtensionToolbarModel::FindNewPositionFromLastKnownGood(
}
}
- return -1;
+ return toolbar_items_.size(); // Is this correct? Or maybe |new_index|?
Peter Kasting 2014/07/03 01:18:50 This line needs review.
Finnur 2014/07/03 12:17:54 It is definitely wrong to return |new_index| becau
Peter Kasting 2014/07/07 19:15:29 Done.
}
void ExtensionToolbarModel::AddExtension(const Extension* extension) {
@@ -264,7 +264,7 @@ void ExtensionToolbarModel::AddExtension(const Extension* extension) {
if (!ExtensionActionManager::Get(profile_)->GetBrowserAction(*extension))
return;
- size_t new_index = -1;
+ size_t new_index = toolbar_items_.size();
// See if we have a last known good position for this extension.
ExtensionIdList::iterator last_pos = std::find(last_known_positions_.begin(),
@@ -280,10 +280,9 @@ void ExtensionToolbarModel::AddExtension(const Extension* extension) {
}
} else {
// This is a never before seen extension, that was added to the end. Make
- // sure to reflect that.
+ // sure to reflect that. (|new_index| was set above.)
toolbar_items_.push_back(make_scoped_refptr(extension));
last_known_positions_.push_back(extension->id());
- new_index = toolbar_items_.size() - 1;
Finnur 2014/07/03 12:17:54 This removal is not correct, I believe. |new_index
Peter Kasting 2014/07/07 19:15:29 I think you're misreading the code. Note that in
Finnur 2014/07/08 10:48:24 Sure. But I must still be misreading the CL becaus
Peter Kasting 2014/07/08 19:21:25 Now I'm the one confused. I'm not changing the pu
Finnur 2014/07/08 23:31:20 My apologies. I was trying to get a review in (to
UpdatePrefs();
}

Powered by Google App Engine
This is Rietveld 408576698