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