| OLD | NEW |
| (Empty) |
| 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 // Defines the Chrome Extensions Managed Mode API relevant classes to realize | |
| 6 // the API as specified in the extension API JSON. | |
| 7 | |
| 8 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGED_MODE_API_H_ | |
| 9 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGED_MODE_API_H_ | |
| 10 | |
| 11 #include "chrome/browser/extensions/extension_function.h" | |
| 12 #include "chrome/browser/prefs/pref_change_registrar.h" | |
| 13 #include "content/public/browser/notification_observer.h" | |
| 14 | |
| 15 class Profile; | |
| 16 | |
| 17 class ExtensionManagedModeEventRouter : public content::NotificationObserver { | |
| 18 public: | |
| 19 explicit ExtensionManagedModeEventRouter(Profile* profile); | |
| 20 virtual ~ExtensionManagedModeEventRouter(); | |
| 21 | |
| 22 void Init(); | |
| 23 | |
| 24 // content::NotificationObserver implementation: | |
| 25 virtual void Observe(int type, | |
| 26 const content::NotificationSource& source, | |
| 27 const content::NotificationDetails& details) OVERRIDE; | |
| 28 | |
| 29 private: | |
| 30 PrefChangeRegistrar registrar_; | |
| 31 Profile* profile_; | |
| 32 | |
| 33 DISALLOW_COPY_AND_ASSIGN(ExtensionManagedModeEventRouter); | |
| 34 }; | |
| 35 | |
| 36 class GetManagedModeFunction : public SyncExtensionFunction { | |
| 37 public: | |
| 38 DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.get") | |
| 39 | |
| 40 protected: | |
| 41 virtual ~GetManagedModeFunction(); | |
| 42 | |
| 43 // ExtensionFunction: | |
| 44 virtual bool RunImpl() OVERRIDE; | |
| 45 }; | |
| 46 | |
| 47 class EnterManagedModeFunction : public AsyncExtensionFunction { | |
| 48 public: | |
| 49 DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.enter") | |
| 50 | |
| 51 protected: | |
| 52 virtual ~EnterManagedModeFunction(); | |
| 53 | |
| 54 // ExtensionFunction: | |
| 55 virtual bool RunImpl() OVERRIDE; | |
| 56 | |
| 57 private: | |
| 58 // Called when we have either successfully entered managed mode or failed. | |
| 59 void SendResult(bool success); | |
| 60 }; | |
| 61 | |
| 62 | |
| 63 class GetPolicyFunction : public SyncExtensionFunction { | |
| 64 public: | |
| 65 DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.getPolicy") | |
| 66 | |
| 67 protected: | |
| 68 virtual ~GetPolicyFunction(); | |
| 69 | |
| 70 // ExtensionFunction: | |
| 71 virtual bool RunImpl() OVERRIDE; | |
| 72 }; | |
| 73 | |
| 74 class SetPolicyFunction : public SyncExtensionFunction { | |
| 75 public: | |
| 76 DECLARE_EXTENSION_FUNCTION_NAME("managedModePrivate.setPolicy") | |
| 77 | |
| 78 protected: | |
| 79 virtual ~SetPolicyFunction(); | |
| 80 | |
| 81 // ExtensionFunction: | |
| 82 virtual bool RunImpl() OVERRIDE; | |
| 83 }; | |
| 84 | |
| 85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGED_MODE_API_H_ | |
| OLD | NEW |