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

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

Issue 12390007: Merge 184833 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/browser/extensions/extension_sorting.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_sorting.cc
===================================================================
--- chrome/browser/extensions/extension_sorting.cc (revision 185166)
+++ chrome/browser/extensions/extension_sorting.cc (working copy)
@@ -364,7 +364,7 @@
for (PageOrdinalMap::const_iterator it = ntp_ordinal_map_.begin();
it != ntp_ordinal_map_.end(); ++it) {
- if (it->second.size() < kNaturalAppPageSize)
+ if (CountItemsVisibleOnNtp(it->second) < kNaturalAppPageSize)
return it->first;
}
@@ -445,6 +445,10 @@
return ntp_ordinal_map_.rbegin()->first;
}
+void ExtensionSorting::MarkExtensionAsHidden(const std::string& extension_id) {
+ ntp_hidden_extensions_.insert(extension_id);
+}
+
syncer::StringOrdinal ExtensionSorting::GetMinOrMaxAppLaunchOrdinalsOnPage(
const syncer::StringOrdinal& target_page_ordinal,
AppLaunchOrdinalReturn return_type) const {
@@ -610,3 +614,14 @@
return app_launch_ordinal.CreateBetween(app_it->first);
}
+size_t ExtensionSorting::CountItemsVisibleOnNtp(
+ const AppLaunchOrdinalMap& m) const {
+ size_t result = 0;
+ for (AppLaunchOrdinalMap::const_iterator it = m.begin(); it != m.end();
+ ++it) {
+ const std::string& id = it->second;
+ if (ntp_hidden_extensions_.count(id) == 0)
+ result++;
+ }
+ return result;
+}
« no previous file with comments | « chrome/browser/extensions/extension_sorting.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698