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

Side by Side Diff: chrome/test/live_sync/live_sync_extension_helper.h

Issue 6873061: [Sync] Revamp and re-enable themes/extensions sync integration tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_
6 #define CHROME_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_
7 #pragma once
8
9 #include <map>
10 #include <string>
11
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h"
15 #include "chrome/common/extensions/extension.h"
16
17 class Extension;
18 class LiveSyncTest;
19 class Profile;
20
21 class LiveSyncExtensionHelper {
22 public:
23 LiveSyncExtensionHelper();
24 ~LiveSyncExtensionHelper();
25
26 // Returns a generated extension ID for the given name.
27 static std::string NameToId(const std::string& name);
28
29 // Initializes the profiles in |test| and registers them with
30 // internal data structures.
31 void Setup(LiveSyncTest* test);
32
33 // Installs the extension with the given name to |profile|.
34 void InstallExtension(
35 Profile* profile, const std::string& name, Extension::Type type);
36
37 // Returns true iff the extension with the given id is pending
38 // install in |profile|.
39 bool IsExtensionPendingInstallForSync(
40 Profile* profile, const std::string& id) const;
41
42 // Installs all extensions pending sync in |profile| of the given
43 // type.
44 void InstallExtensionsPendingForSync(Profile* profile, Extension::Type type);
45
46 private:
47 typedef std::map<std::string, scoped_refptr<Extension> > ExtensionNameMap;
48 typedef std::map<Profile*, ExtensionNameMap> ProfileExtensionNameMap;
49 typedef std::map<std::string, std::string> StringMap;
50
51 // Initializes extensions for |profile| and creates an entry in
52 // |profile_extensions_| for it.
53 void SetupProfile(Profile* profile);
54
55 // Returns an extension for the given name in |profile|. type and
56 // index. Two extensions with the name but different profiles will
57 // have the same id.
58 scoped_refptr<Extension> GetExtension(
59 Profile* profile, const std::string& name,
60 Extension::Type type) WARN_UNUSED_RESULT;
61
62 ProfileExtensionNameMap profile_extensions_;
63 StringMap id_to_name_;
64
65 DISALLOW_COPY_AND_ASSIGN(LiveSyncExtensionHelper);
66 };
67
68 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698