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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "chrome/browser/shell_integration.h" | 12 #include "chrome/browser/shell_integration.h" |
13 | 13 |
14 @class NSDictionary; | 14 @class NSDictionary; |
15 @class NSString; | 15 @class NSString; |
16 | 16 |
17 namespace web_app { | 17 namespace web_app { |
18 | 18 |
19 // Creates a shortcut for a web application. The shortcut is a stub app | 19 // Creates a shortcut for a web application. The shortcut is a stub app |
20 // that simply loads the browser framework and runs the given app. | 20 // that simply loads the browser framework and runs the given app. |
21 class WebAppShortcutCreator { | 21 class WebAppShortcutCreator { |
22 public: | 22 public: |
23 // Creates a new shortcut based on information in |shortcut_info|. | 23 // Creates a new shortcut based on information in |shortcut_info|. |
24 // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. | 24 // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. |
| 25 // The shortcut store its data directory in |data_dir|. |
25 explicit WebAppShortcutCreator( | 26 explicit WebAppShortcutCreator( |
| 27 const FilePath& data_dir, |
26 const ShellIntegration::ShortcutInfo& shortcut_info, | 28 const ShellIntegration::ShortcutInfo& shortcut_info, |
27 const string16& chrome_bundle_id); | 29 const string16& chrome_bundle_id); |
28 virtual ~WebAppShortcutCreator(); | 30 virtual ~WebAppShortcutCreator(); |
29 | 31 |
30 // Copies the app launcher template into place and fills in all relevant | 32 // Copies the app launcher template into place and fills in all relevant |
31 // information. | 33 // information. |
32 bool CreateShortcut(); | 34 bool CreateShortcut(); |
33 | 35 |
34 protected: | 36 protected: |
35 // Returns a path to the app loader. | 37 // Returns a path to the app loader. |
(...skipping 13 matching lines...) Expand all Loading... |
49 | 51 |
50 // Returns the bundle identifier to use for this app bundle. | 52 // Returns the bundle identifier to use for this app bundle. |
51 // |plist| is a dictionary containg a copy of the template plist file to | 53 // |plist| is a dictionary containg a copy of the template plist file to |
52 // be used for creating the app bundle. | 54 // be used for creating the app bundle. |
53 NSString* GetBundleIdentifier(NSDictionary* plist) const; | 55 NSString* GetBundleIdentifier(NSDictionary* plist) const; |
54 | 56 |
55 // Show the bundle we just generated in the Finder. | 57 // Show the bundle we just generated in the Finder. |
56 virtual void RevealGeneratedBundleInFinder( | 58 virtual void RevealGeneratedBundleInFinder( |
57 const FilePath& generated_bundle) const; | 59 const FilePath& generated_bundle) const; |
58 | 60 |
| 61 // Path to the app's data directory. For example: |
| 62 // ~/Library/Application Support/Chromium/Default/Web Applications/_crx_abc/ |
| 63 FilePath data_dir_; |
| 64 |
59 // Information about the app. | 65 // Information about the app. |
60 ShellIntegration::ShortcutInfo info_; | 66 ShellIntegration::ShortcutInfo info_; |
61 | 67 |
62 // The CFBundleIdentifier of the Chrome browser bundle. | 68 // The CFBundleIdentifier of the Chrome browser bundle. |
63 string16 chrome_bundle_id_; | 69 string16 chrome_bundle_id_; |
64 }; | 70 }; |
65 | 71 |
66 } // namespace web_app | 72 } // namespace web_app |
67 | 73 |
68 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 74 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
OLD | NEW |