Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: chrome/browser/extensions/api/app_runtime/app_runtime_api.h

Issue 22944002: Implementation of the "Redirect URLs to Packaged Apps" feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review comments + lint errors Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_RUNTIME_APP_RUNTIME_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_
7 7
8 #include <string>
9
8 #include "base/string16.h" 10 #include "base/string16.h"
9 #include "chrome/browser/extensions/extension_function.h" 11 #include "chrome/browser/extensions/extension_function.h"
10 12
11 class Profile; 13 class Profile;
12 14
13 namespace content { 15 namespace content {
14 class WebContents; 16 class WebContents;
15 } 17 }
16 18
17 namespace extensions { 19 namespace extensions {
18 20
19 class Extension; 21 class Extension;
20 22
21 namespace app_file_handler_util { 23 namespace app_file_handler_util {
22 struct GrantedFileEntry; 24 struct GrantedFileEntry;
23 } 25 }
24 26
25 class AppEventRouter { 27 class AppEventRouter {
26 public: 28 public:
27 // Dispatches the onLaunched event to the given app, providing no launch 29 // Dispatches the onLaunched event to the given app, providing no launch
28 // data. 30 // data.
29 static void DispatchOnLaunchedEvent(Profile* profile, 31 static void DispatchOnLaunchedEvent(Profile* profile,
30 const Extension* extension); 32 const Extension* extension);
33
34 // Dispatches the onRestarted event to the given app, providing a list of
35 // restored file entries from the previous run.
31 static void DispatchOnRestartedEvent( 36 static void DispatchOnRestartedEvent(
32 Profile* profile, 37 Profile* profile,
33 const Extension* extension, 38 const Extension* extension,
34 const std::vector<app_file_handler_util::GrantedFileEntry>& file_entries); 39 const std::vector<app_file_handler_util::GrantedFileEntry>& file_entries);
35 40
36 // TODO(benwells): Update this comment, it is out of date. 41 // TODO(benwells): Update this comment, it is out of date.
37 // Dispatches the onLaunched event to the given app, providing launch data of 42 // Dispatches the onLaunched event to the given app, providing launch data of
38 // the form: 43 // the form:
39 // { 44 // {
40 // "intent" : { 45 // "intent" : {
41 // "type" : "chrome-extension://fileentry", 46 // "type" : "chrome-extension://fileentry",
42 // "data" : a FileEntry, 47 // "data" : a FileEntry,
43 // "postResults" : a null function, 48 // "postResults" : a null function,
44 // "postFailure" : a null function 49 // "postFailure" : a null function
45 // } 50 // }
46 // } 51 // }
47 52
48 // launchData.intent.data and launchData.intent.postResults are created in a 53 // The FileEntry is created from |file_system_id| and |base_name|.
49 // custom dispatch event in javascript. The FileEntry is created from 54 // |handler_id| corresponds to the id of the file_handlers item in the
50 // |file_system_id| and |base_name|. 55 // manifest that resulted in a match which triggered this launch.
51 static void DispatchOnLaunchedEventWithFileEntry( 56 static void DispatchOnLaunchedEventWithFileEntry(
52 Profile* profile, 57 Profile* profile,
53 const Extension* extension, 58 const Extension* extension,
54 const std::string& handler_id, 59 const std::string& handler_id,
55 const std::string& mime_type, 60 const std::string& mime_type,
56 const std::string& file_system_id, 61 const std::string& file_system_id,
57 const std::string& base_name); 62 const std::string& base_name);
63
64 // |handler_id| corresponds to the id of the url_handlers item
65 // in the manifest that resulted in a match which triggered this launch.
66 static void DispatchOnLaunchedEventWithUrl(
67 Profile* profile,
68 const Extension* extension,
69 const std::string& handler_id,
70 const GURL& url,
71 const GURL& referrer_url);
58 }; 72 };
59 73
60 } // namespace extensions 74 } // namespace extensions
61 75
62 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ 76 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698