Chromium Code Reviews| 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 Extension; | 11 class Extension; |
| 12 class Profile; | 12 class Profile; |
| 13 class GURL; | |
| 13 | 14 |
| 14 namespace extensions { | 15 namespace extensions { |
| 15 | 16 |
| 16 class AppNotifyFunction : public SyncExtensionFunction { | 17 class AppNotifyFunction : public SyncExtensionFunction { |
| 17 public: | 18 public: |
| 18 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.notify"); | 19 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.notify"); |
| 19 | 20 |
| 20 protected: | 21 protected: |
| 21 virtual ~AppNotifyFunction() {} | 22 virtual ~AppNotifyFunction() {} |
| 22 virtual bool RunImpl() OVERRIDE; | 23 virtual bool RunImpl() OVERRIDE; |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 class AppClearAllNotificationsFunction : public SyncExtensionFunction { | 26 class AppClearAllNotificationsFunction : public SyncExtensionFunction { |
| 26 public: | 27 public: |
| 27 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.clearAllNotifications"); | 28 DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.clearAllNotifications"); |
| 28 | 29 |
| 29 protected: | 30 protected: |
| 30 virtual ~AppClearAllNotificationsFunction() {} | 31 virtual ~AppClearAllNotificationsFunction() {} |
| 31 virtual bool RunImpl() OVERRIDE; | 32 virtual bool RunImpl() OVERRIDE; |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 class AppEventRouter { | 35 class AppEventRouter { |
| 35 public: | 36 public: |
| 36 // Dispatches the onLaunched event to the given app. | 37 // Dispatches the onLaunched event to the given app, providing no launch |
| 38 // data. | |
| 37 static void DispatchOnLaunchedEvent(Profile* profile, | 39 static void DispatchOnLaunchedEvent(Profile* profile, |
| 38 const Extension* extension); | 40 const Extension* extension); |
| 41 | |
| 42 // Dispatches the onLaunched event to the given app, providing launch data of | |
| 43 // the form: | |
| 44 // { | |
| 45 // "intent" : { | |
| 46 // "action" : |action|, | |
| 47 // "type" : |mime_type|, | |
|
Greg Billock
2012/05/14 16:16:27
Should also have a "data" field.
benwells
2012/05/14 23:44:32
When sending onLaunched there is no data field. At
Greg Billock
2012/05/14 23:55:38
It's a valid intent, but I was thinking the API wo
benwells
2012/05/15 00:11:46
OK ... this could be added in future but for now I
Mihai Parparita -not on Chrome
2012/05/15 00:39:28
In that case, can "url" be named more specifically
benwells
2012/05/18 03:36:02
url is now gone, with a FileEntry instead in data.
| |
| 48 // "extra_data" : { | |
| 49 // "url" : |url| | |
| 50 // } | |
| 51 // } | |
| 52 // } | |
| 53 static void DispatchOnLaunchedEventWithUrl(Profile* profile, | |
|
Greg Billock
2012/05/14 16:16:27
How about "DispatchOnLaunchedEventWithIntent" and
benwells
2012/05/15 00:11:46
Yeah that would be nice. I started going down that
Greg Billock
2012/05/15 00:54:59
Couldn't it just be left blank if there's no "data
| |
| 54 const Extension* extension, | |
| 55 const string16& action, | |
| 56 const std::string& mime_type, | |
| 57 const GURL& url); | |
| 39 }; | 58 }; |
| 40 | 59 |
| 41 } // namespace extensions | 60 } // namespace extensions |
| 42 | 61 |
| 43 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_APP_API_H_ | 62 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_APP_API_H_ |
| OLD | NEW |