| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "sync/api/string_ordinal.h" |
| 12 | 13 |
| 13 class Profile; | 14 class Profile; |
| 14 class StringOrdinal; | |
| 15 class SyncTest; | 15 class SyncTest; |
| 16 | 16 |
| 17 class SyncAppHelper { | 17 class SyncAppHelper { |
| 18 public: | 18 public: |
| 19 // Singleton implementation. | 19 // Singleton implementation. |
| 20 static SyncAppHelper* GetInstance(); | 20 static SyncAppHelper* GetInstance(); |
| 21 | 21 |
| 22 // Initializes the profiles in |test| and registers them with | 22 // Initializes the profiles in |test| and registers them with |
| 23 // internal data structures. | 23 // internal data structures. |
| 24 void SetupIfNecessary(SyncTest* test); | 24 void SetupIfNecessary(SyncTest* test); |
| 25 | 25 |
| 26 // Returns true iff |profile1| and |profile2| have the same apps and | 26 // Returns true iff |profile1| and |profile2| have the same apps and |
| 27 // they are all in the same state. | 27 // they are all in the same state. |
| 28 bool AppStatesMatch(Profile* profile1, Profile* profile2); | 28 bool AppStatesMatch(Profile* profile1, Profile* profile2); |
| 29 | 29 |
| 30 // Gets the page ordinal value for the applications with |name| in |profile|. | 30 // Gets the page ordinal value for the applications with |name| in |profile|. |
| 31 StringOrdinal GetPageOrdinalForApp(Profile* profile, const std::string& name); | 31 syncer::StringOrdinal GetPageOrdinalForApp(Profile* profile, |
| 32 const std::string& name); |
| 32 | 33 |
| 33 // Sets a new |page_ordinal| value for the application with |name| in | 34 // Sets a new |page_ordinal| value for the application with |name| in |
| 34 // |profile|. | 35 // |profile|. |
| 35 void SetPageOrdinalForApp(Profile* profile, | 36 void SetPageOrdinalForApp(Profile* profile, |
| 36 const std::string& name, | 37 const std::string& name, |
| 37 const StringOrdinal& page_ordinal); | 38 const syncer::StringOrdinal& page_ordinal); |
| 38 | 39 |
| 39 // Gets the app launch ordinal value for the application with |name| in | 40 // Gets the app launch ordinal value for the application with |name| in |
| 40 // |profile|. | 41 // |profile|. |
| 41 StringOrdinal GetAppLaunchOrdinalForApp(Profile* profile, | 42 syncer::StringOrdinal GetAppLaunchOrdinalForApp(Profile* profile, |
| 42 const std::string& name); | 43 const std::string& name); |
| 43 | 44 |
| 44 // Sets a new |app_launch_ordinal| value for the application with |name| in | 45 // Sets a new |app_launch_ordinal| value for the application with |name| in |
| 45 // |profile|. | 46 // |profile|. |
| 46 void SetAppLaunchOrdinalForApp(Profile* profile, | 47 void SetAppLaunchOrdinalForApp( |
| 47 const std::string& name, | 48 Profile* profile, |
| 48 const StringOrdinal& app_launch_ordinal); | 49 const std::string& name, |
| 50 const syncer::StringOrdinal& app_launch_ordinal); |
| 49 | 51 |
| 50 // Fix any NTP icon collisions that are currently in |profile|. | 52 // Fix any NTP icon collisions that are currently in |profile|. |
| 51 void FixNTPOrdinalCollisions(Profile* profile); | 53 void FixNTPOrdinalCollisions(Profile* profile); |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 friend struct DefaultSingletonTraits<SyncAppHelper>; | 56 friend struct DefaultSingletonTraits<SyncAppHelper>; |
| 55 | 57 |
| 56 SyncAppHelper(); | 58 SyncAppHelper(); |
| 57 ~SyncAppHelper(); | 59 ~SyncAppHelper(); |
| 58 | 60 |
| 59 bool setup_completed_; | 61 bool setup_completed_; |
| 60 | 62 |
| 61 DISALLOW_COPY_AND_ASSIGN(SyncAppHelper); | 63 DISALLOW_COPY_AND_ASSIGN(SyncAppHelper); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_HELPER_H_ | 66 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_HELPER_H_ |
| OLD | NEW |