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
3 // found in the LICENSE file.
5 #include "apps/shell/shell_app_sorting.h"
7 #include "sync/api/string_ordinal.h"
11 // Ordinals for a single app on a single page.
12 const char kFirstApp
[] = "a";
13 const char kNextApp
[] = "b";
14 const char kFirstPage
[] = "a";
20 ShellAppSorting::ShellAppSorting() {
23 ShellAppSorting::~ShellAppSorting() {
26 void ShellAppSorting::SetExtensionScopedPrefs(
27 extensions::ExtensionScopedPrefs
* prefs
) {
30 void ShellAppSorting::SetExtensionSyncService(
31 ExtensionSyncService
* extension_sync_service
) {
34 void ShellAppSorting::Initialize(
35 const extensions::ExtensionIdList
& extension_ids
) {
38 void ShellAppSorting::FixNTPOrdinalCollisions() {
41 void ShellAppSorting::EnsureValidOrdinals(
42 const std::string
& extension_id
,
43 const syncer::StringOrdinal
& suggested_page
) {
46 void ShellAppSorting::OnExtensionMoved(
47 const std::string
& moved_extension_id
,
48 const std::string
& predecessor_extension_id
,
49 const std::string
& successor_extension_id
) {
52 syncer::StringOrdinal
ShellAppSorting::GetAppLaunchOrdinal(
53 const std::string
& extension_id
) const {
54 return syncer::StringOrdinal(kFirstApp
);
57 void ShellAppSorting::SetAppLaunchOrdinal(
58 const std::string
& extension_id
,
59 const syncer::StringOrdinal
& new_app_launch_ordinal
) {
62 syncer::StringOrdinal
ShellAppSorting::CreateFirstAppLaunchOrdinal(
63 const syncer::StringOrdinal
& page_ordinal
) const {
64 return syncer::StringOrdinal(kFirstApp
);
67 syncer::StringOrdinal
ShellAppSorting::CreateNextAppLaunchOrdinal(
68 const syncer::StringOrdinal
& page_ordinal
) const {
69 return syncer::StringOrdinal(kNextApp
);
72 syncer::StringOrdinal
ShellAppSorting::CreateFirstAppPageOrdinal() const {
73 return syncer::StringOrdinal(kFirstPage
);
76 syncer::StringOrdinal
ShellAppSorting::GetNaturalAppPageOrdinal() const {
77 return syncer::StringOrdinal(kFirstPage
);
80 syncer::StringOrdinal
ShellAppSorting::GetPageOrdinal(
81 const std::string
& extension_id
) const {
82 return syncer::StringOrdinal(kFirstPage
);
85 void ShellAppSorting::SetPageOrdinal(
86 const std::string
& extension_id
,
87 const syncer::StringOrdinal
& new_page_ordinal
) {
90 void ShellAppSorting::ClearOrdinals(const std::string
& extension_id
) {
93 int ShellAppSorting::PageStringOrdinalAsInteger(
94 const syncer::StringOrdinal
& page_ordinal
) const {
98 syncer::StringOrdinal
ShellAppSorting::PageIntegerAsStringOrdinal(
100 return syncer::StringOrdinal(kFirstPage
);
103 void ShellAppSorting::MarkExtensionAsHidden(
104 const std::string
& extension_id
) {