| 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_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 12 #include "extensions/browser/browser_context_keyed_api_factory.h" | 12 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 13 #include "ui/message_center/notification_types.h" |
| 13 | 14 |
| 14 namespace extensions { | 15 namespace extensions { |
| 15 | 16 |
| 16 class AutotestPrivateLogoutFunction : public ChromeSyncExtensionFunction { | 17 class AutotestPrivateLogoutFunction : public ChromeSyncExtensionFunction { |
| 17 public: | 18 public: |
| 18 DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT) | 19 DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT) |
| 19 | 20 |
| 20 private: | 21 private: |
| 21 ~AutotestPrivateLogoutFunction() override {} | 22 ~AutotestPrivateLogoutFunction() override {} |
| 22 bool RunSync() override; | 23 bool RunSync() override; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 : public ChromeSyncExtensionFunction { | 154 : public ChromeSyncExtensionFunction { |
| 154 public: | 155 public: |
| 155 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setPrimaryButtonRight", | 156 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setPrimaryButtonRight", |
| 156 AUTOTESTPRIVATE_SETPRIMARYBUTTONRIGHT) | 157 AUTOTESTPRIVATE_SETPRIMARYBUTTONRIGHT) |
| 157 | 158 |
| 158 private: | 159 private: |
| 159 ~AutotestPrivateSetPrimaryButtonRightFunction() override {} | 160 ~AutotestPrivateSetPrimaryButtonRightFunction() override {} |
| 160 bool RunSync() override; | 161 bool RunSync() override; |
| 161 }; | 162 }; |
| 162 | 163 |
| 164 class AutotestPrivateGetVisibleNotificationsFunction |
| 165 : public ChromeSyncExtensionFunction { |
| 166 public: |
| 167 DECLARE_EXTENSION_FUNCTION("autotestPrivate.getVisibleNotifications", |
| 168 AUTOTESTPRIVATE_GETVISIBLENOTIFICATIONS) |
| 169 |
| 170 private: |
| 171 static std::string ConvertToString(message_center::NotificationType type); |
| 172 |
| 173 ~AutotestPrivateGetVisibleNotificationsFunction() override {} |
| 174 bool RunSync() override; |
| 175 }; |
| 176 |
| 163 // Don't kill the browser when we're in a browser test. | 177 // Don't kill the browser when we're in a browser test. |
| 164 void SetAutotestPrivateTest(); | 178 void SetAutotestPrivateTest(); |
| 165 | 179 |
| 166 // The profile-keyed service that manages the autotestPrivate extension API. | 180 // The profile-keyed service that manages the autotestPrivate extension API. |
| 167 class AutotestPrivateAPI : public BrowserContextKeyedAPI { | 181 class AutotestPrivateAPI : public BrowserContextKeyedAPI { |
| 168 public: | 182 public: |
| 169 static BrowserContextKeyedAPIFactory<AutotestPrivateAPI>* | 183 static BrowserContextKeyedAPIFactory<AutotestPrivateAPI>* |
| 170 GetFactoryInstance(); | 184 GetFactoryInstance(); |
| 171 | 185 |
| 172 // TODO(achuith): Replace these with a mock object for system calls. | 186 // TODO(achuith): Replace these with a mock object for system calls. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 188 }; | 202 }; |
| 189 | 203 |
| 190 template <> | 204 template <> |
| 191 KeyedService* | 205 KeyedService* |
| 192 BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( | 206 BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( |
| 193 content::BrowserContext* context) const; | 207 content::BrowserContext* context) const; |
| 194 | 208 |
| 195 } // namespace extensions | 209 } // namespace extensions |
| 196 | 210 |
| 197 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H
_ | 211 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H
_ |
| OLD | NEW |