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_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "chrome/browser/web_applications/web_app.h" | 17 #include "chrome/browser/web_applications/web_app.h" |
18 #include "extensions/common/manifest_handlers/file_handler_info.h" | |
19 | 18 |
20 namespace base { | 19 namespace base { |
21 class CommandLine; | 20 class CommandLine; |
22 } | 21 } |
23 | 22 |
24 // Whether to enable update and launch of app shims in tests. (Normally shims | 23 // Whether to enable update and launch of app shims in tests. (Normally shims |
25 // are never created or launched in tests). Note that update only creates | 24 // are never created or launched in tests). Note that update only creates |
26 // internal shim bundles, i.e. it does not create new shims in ~/Applications. | 25 // internal shim bundles, i.e. it does not create new shims in ~/Applications. |
27 extern bool g_app_shims_allow_update_and_launch_in_tests; | 26 extern bool g_app_shims_allow_update_and_launch_in_tests; |
28 | 27 |
(...skipping 18 matching lines...) Expand all Loading... |
47 // Creates a shortcut for a web application. The shortcut is a stub app | 46 // Creates a shortcut for a web application. The shortcut is a stub app |
48 // that simply loads the browser framework and runs the given app. | 47 // that simply loads the browser framework and runs the given app. |
49 class WebAppShortcutCreator { | 48 class WebAppShortcutCreator { |
50 public: | 49 public: |
51 // Creates a new shortcut based on information in |shortcut_info|. | 50 // Creates a new shortcut based on information in |shortcut_info|. |
52 // A copy of the shortcut is placed in |app_data_dir|. | 51 // A copy of the shortcut is placed in |app_data_dir|. |
53 // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. | 52 // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. |
54 // Retains the pointer |shortcut_info|; the ShortcutInfo object must outlive | 53 // Retains the pointer |shortcut_info|; the ShortcutInfo object must outlive |
55 // the WebAppShortcutCreator. | 54 // the WebAppShortcutCreator. |
56 WebAppShortcutCreator(const base::FilePath& app_data_dir, | 55 WebAppShortcutCreator(const base::FilePath& app_data_dir, |
57 const ShortcutInfo* shortcut_info, | 56 const ShortcutInfo* shortcut_info); |
58 const extensions::FileHandlersInfo& file_handlers_info); | |
59 | 57 |
60 virtual ~WebAppShortcutCreator(); | 58 virtual ~WebAppShortcutCreator(); |
61 | 59 |
62 // Returns the base name for the shortcut. | 60 // Returns the base name for the shortcut. |
63 base::FilePath GetShortcutBasename() const; | 61 base::FilePath GetShortcutBasename() const; |
64 | 62 |
65 // Returns a path to the Chrome Apps folder in the relevant applications | 63 // Returns a path to the Chrome Apps folder in the relevant applications |
66 // folder. E.g. ~/Applications or /Applications. | 64 // folder. E.g. ~/Applications or /Applications. |
67 virtual base::FilePath GetApplicationsDirname() const; | 65 virtual base::FilePath GetApplicationsDirname() const; |
68 | 66 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Updates the icon for the shortcut. | 118 // Updates the icon for the shortcut. |
121 bool UpdateIcon(const base::FilePath& app_path) const; | 119 bool UpdateIcon(const base::FilePath& app_path) const; |
122 | 120 |
123 // Path to the data directory for this app. For example: | 121 // Path to the data directory for this app. For example: |
124 // ~/Library/Application Support/Chromium/Default/Web Applications/_crx_abc/ | 122 // ~/Library/Application Support/Chromium/Default/Web Applications/_crx_abc/ |
125 base::FilePath app_data_dir_; | 123 base::FilePath app_data_dir_; |
126 | 124 |
127 // Information about the app. Owned by the caller of the constructor. | 125 // Information about the app. Owned by the caller of the constructor. |
128 const ShortcutInfo* info_; | 126 const ShortcutInfo* info_; |
129 | 127 |
130 // The app's file handlers. | |
131 extensions::FileHandlersInfo file_handlers_info_; | |
132 | |
133 DISALLOW_COPY_AND_ASSIGN(WebAppShortcutCreator); | 128 DISALLOW_COPY_AND_ASSIGN(WebAppShortcutCreator); |
134 }; | 129 }; |
135 | 130 |
136 } // namespace web_app | 131 } // namespace web_app |
137 | 132 |
138 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 133 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
OLD | NEW |