| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome_app_sorting.h" | 5 #include "chrome/browser/extensions/chrome_app_sorting.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (page_index < ntp_ordinal_map_.size()) { | 428 if (page_index < ntp_ordinal_map_.size()) { |
| 429 PageOrdinalMap::const_iterator it = ntp_ordinal_map_.begin(); | 429 PageOrdinalMap::const_iterator it = ntp_ordinal_map_.begin(); |
| 430 std::advance(it, page_index); | 430 std::advance(it, page_index); |
| 431 return it->first; | 431 return it->first; |
| 432 } | 432 } |
| 433 | 433 |
| 434 CreateOrdinalsIfNecessary(page_index + 1); | 434 CreateOrdinalsIfNecessary(page_index + 1); |
| 435 return ntp_ordinal_map_.rbegin()->first; | 435 return ntp_ordinal_map_.rbegin()->first; |
| 436 } | 436 } |
| 437 | 437 |
| 438 void ChromeAppSorting::MarkExtensionAsHidden(const std::string& extension_id) { | 438 void ChromeAppSorting::SetExtensionVisible(const std::string& extension_id, |
| 439 ntp_hidden_extensions_.insert(extension_id); | 439 bool visible) { |
| 440 if (visible) |
| 441 ntp_hidden_extensions_.erase(extension_id); |
| 442 else |
| 443 ntp_hidden_extensions_.insert(extension_id); |
| 440 } | 444 } |
| 441 | 445 |
| 442 syncer::StringOrdinal ChromeAppSorting::GetMinOrMaxAppLaunchOrdinalsOnPage( | 446 syncer::StringOrdinal ChromeAppSorting::GetMinOrMaxAppLaunchOrdinalsOnPage( |
| 443 const syncer::StringOrdinal& target_page_ordinal, | 447 const syncer::StringOrdinal& target_page_ordinal, |
| 444 AppLaunchOrdinalReturn return_type) const { | 448 AppLaunchOrdinalReturn return_type) const { |
| 445 CHECK(target_page_ordinal.IsValid()); | 449 CHECK(target_page_ordinal.IsValid()); |
| 446 | 450 |
| 447 syncer::StringOrdinal return_value; | 451 syncer::StringOrdinal return_value; |
| 448 | 452 |
| 449 PageOrdinalMap::const_iterator page = | 453 PageOrdinalMap::const_iterator page = |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 for (AppLaunchOrdinalMap::const_iterator it = m.begin(); it != m.end(); | 618 for (AppLaunchOrdinalMap::const_iterator it = m.begin(); it != m.end(); |
| 615 ++it) { | 619 ++it) { |
| 616 const std::string& id = it->second; | 620 const std::string& id = it->second; |
| 617 if (ntp_hidden_extensions_.count(id) == 0) | 621 if (ntp_hidden_extensions_.count(id) == 0) |
| 618 result++; | 622 result++; |
| 619 } | 623 } |
| 620 return result; | 624 return result; |
| 621 } | 625 } |
| 622 | 626 |
| 623 } // namespace extensions | 627 } // namespace extensions |
| OLD | NEW |