| 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_APP_APP_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_APP_APP_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_APP_APP_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_APP_APP_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 | 10 |
| 11 class Profile; | 11 class Profile; |
| 12 class GURL; |
| 12 | 13 |
| 13 namespace extensions { | 14 namespace extensions { |
| 14 | 15 |
| 15 class Extension; | 16 class Extension; |
| 16 | 17 |
| 17 class AppNotifyFunction : public SyncExtensionFunction { | 18 class AppNotifyFunction : public SyncExtensionFunction { |
| 18 public: | 19 public: |
| 19 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.notify"); | 20 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.notify"); |
| 20 | 21 |
| 21 protected: | 22 protected: |
| 22 virtual ~AppNotifyFunction() {} | 23 virtual ~AppNotifyFunction() {} |
| 23 virtual bool RunImpl() OVERRIDE; | 24 virtual bool RunImpl() OVERRIDE; |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 class AppClearAllNotificationsFunction : public SyncExtensionFunction { | 27 class AppClearAllNotificationsFunction : public SyncExtensionFunction { |
| 27 public: | 28 public: |
| 28 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.clearAllNotifications"); | 29 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.clearAllNotifications"); |
| 29 | 30 |
| 30 protected: | 31 protected: |
| 31 virtual ~AppClearAllNotificationsFunction() {} | 32 virtual ~AppClearAllNotificationsFunction() {} |
| 32 virtual bool RunImpl() OVERRIDE; | 33 virtual bool RunImpl() OVERRIDE; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 class AppEventRouter { | 36 class AppEventRouter { |
| 36 public: | 37 public: |
| 37 // Dispatches the onLaunched event to the given app. | 38 // Dispatches the onLaunched event to the given app, providing no launch |
| 39 // data. |
| 38 static void DispatchOnLaunchedEvent(Profile* profile, | 40 static void DispatchOnLaunchedEvent(Profile* profile, |
| 39 const Extension* extension); | 41 const Extension* extension); |
| 42 |
| 43 // Dispatches the onLaunched event to the given app, providing launch data of |
| 44 // the form: |
| 45 // { |
| 46 // "intent" : { |
| 47 // "action" : |action|, |
| 48 // "type" : "chrome-extension://fileentry", |
| 49 // "data" : a FileEntry, |
| 50 // "postResults" : a null function, |
| 51 // "postFailure" : a null function |
| 52 // } |
| 53 // } |
| 54 |
| 55 // launchData.intent.data and launchData.intent.postResults are created in a |
| 56 // custom dispatch event in javascript. The FileEntry is created from |
| 57 // |file_system_id| and |base_name|. |
| 58 static void DispatchOnLaunchedEventWithFileEntry( |
| 59 Profile* profile, |
| 60 const Extension* extension, |
| 61 const string16& action, |
| 62 const std::string& file_system_id, |
| 63 const FilePath& base_name); |
| 40 }; | 64 }; |
| 41 | 65 |
| 42 } // namespace extensions | 66 } // namespace extensions |
| 43 | 67 |
| 44 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_APP_API_H_ | 68 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_APP_API_H_ |
| OLD | NEW |