Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_ | 5 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_ |
| 6 #define CHROME_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_ | 6 #define CHROME_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 | 16 |
| 17 class Extension; | 17 class Extension; |
| 18 class LiveSyncTest; | 18 class LiveSyncTest; |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 class LiveSyncExtensionHelper { | 21 class LiveSyncExtensionHelper { |
| 22 public: | 22 public: |
| 23 enum ExtensionState { DISABLED, PENDING, ENABLED }; | 23 enum ExtensionState { DISABLED, PENDING, ENABLED }; |
|
akalin
2011/06/09 03:21:59
It's probably better to have something like this:
braffert
2011/06/09 18:20:42
I agree - done.
| |
| 24 enum IncognitoExtensionState { INCOGNITO_ENABLED, INCOGNITO_DISABLED }; | |
| 24 | 25 |
| 25 typedef std::map<std::string, ExtensionState> ExtensionStateMap; | 26 typedef std::map<std::string, std::pair<ExtensionState, |
| 27 IncognitoExtensionState> > ExtensionStateMap; | |
| 26 | 28 |
| 27 LiveSyncExtensionHelper(); | 29 LiveSyncExtensionHelper(); |
| 28 ~LiveSyncExtensionHelper(); | 30 ~LiveSyncExtensionHelper(); |
| 29 | 31 |
| 30 // Returns a generated extension ID for the given name. | 32 // Returns a generated extension ID for the given name. |
| 31 static std::string NameToId(const std::string& name); | 33 static std::string NameToId(const std::string& name); |
| 32 | 34 |
| 33 // Initializes the profiles in |test| and registers them with | 35 // Initializes the profiles in |test| and registers them with |
| 34 // internal data structures. | 36 // internal data structures. |
| 35 void Setup(LiveSyncTest* test); | 37 void Setup(LiveSyncTest* test); |
| 36 | 38 |
| 37 // Installs the extension with the given name to |profile|. | 39 // Installs the extension with the given name to |profile|. |
| 38 void InstallExtension( | 40 void InstallExtension( |
| 39 Profile* profile, const std::string& name, Extension::Type type); | 41 Profile* profile, const std::string& name, Extension::Type type); |
| 40 | 42 |
| 41 // Uninstalls the extension with the given name from |profile|. | 43 // Uninstalls the extension with the given name from |profile|. |
| 42 void UninstallExtension(Profile* profile, const std::string& name); | 44 void UninstallExtension(Profile* profile, const std::string& name); |
| 43 | 45 |
| 46 // Enables the extension with the given name on |profile|. | |
| 47 void EnableExtension(Profile* profile, const std::string& name); | |
| 48 | |
| 49 // Disables the extension with the given name on |profile|. | |
| 50 void DisableExtension(Profile* profile, const std::string& name); | |
| 51 | |
| 52 // Enables the extension with the given name to run in incognito mode | |
| 53 void IncognitoEnableExtension(Profile* profile, const std::string& name); | |
| 54 | |
| 55 // Disables the extension with the given name from running in incognito mode | |
| 56 void IncognitoDisableExtension(Profile* profile, const std::string& name); | |
| 57 | |
| 44 // Returns true iff the extension with the given id is pending | 58 // Returns true iff the extension with the given id is pending |
| 45 // install in |profile|. | 59 // install in |profile|. |
| 46 bool IsExtensionPendingInstallForSync( | 60 bool IsExtensionPendingInstallForSync( |
| 47 Profile* profile, const std::string& id) const; | 61 Profile* profile, const std::string& id) const; |
| 48 | 62 |
| 49 // Installs all extensions pending sync in |profile| of the given | 63 // Installs all extensions pending sync in |profile| of the given |
| 50 // type. | 64 // type. |
| 51 void InstallExtensionsPendingForSync(Profile* profile, Extension::Type type); | 65 void InstallExtensionsPendingForSync(Profile* profile, Extension::Type type); |
| 52 | 66 |
| 53 // Returns a map from |profile|'s installed extensions to their | 67 // Returns a map from |profile|'s installed extensions to their |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 70 Profile* profile, const std::string& name, | 84 Profile* profile, const std::string& name, |
| 71 Extension::Type type) WARN_UNUSED_RESULT; | 85 Extension::Type type) WARN_UNUSED_RESULT; |
| 72 | 86 |
| 73 ProfileExtensionNameMap profile_extensions_; | 87 ProfileExtensionNameMap profile_extensions_; |
| 74 StringMap id_to_name_; | 88 StringMap id_to_name_; |
| 75 | 89 |
| 76 DISALLOW_COPY_AND_ASSIGN(LiveSyncExtensionHelper); | 90 DISALLOW_COPY_AND_ASSIGN(LiveSyncExtensionHelper); |
| 77 }; | 91 }; |
| 78 | 92 |
| 79 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_ | 93 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SYNC_EXTENSION_HELPER_H_ |
| OLD | NEW |