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_CHROMEOS_DRIVE_DRIVE_APP_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_APP_REGISTRY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_APP_REGISTRY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_APP_REGISTRY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 // https://chrome.google.com/webstore/category/collection/drive_apps for | 29 // https://chrome.google.com/webstore/category/collection/drive_apps for |
30 // Drive apps available on the webstore. | 30 // Drive apps available on the webstore. |
31 struct DriveAppInfo { | 31 struct DriveAppInfo { |
32 DriveAppInfo(); | 32 DriveAppInfo(); |
33 DriveAppInfo(const std::string& app_id, | 33 DriveAppInfo(const std::string& app_id, |
34 const google_apis::InstalledApp::IconList& app_icons, | 34 const google_apis::InstalledApp::IconList& app_icons, |
35 const google_apis::InstalledApp::IconList& document_icons, | 35 const google_apis::InstalledApp::IconList& document_icons, |
36 const std::string& web_store_id, | 36 const std::string& web_store_id, |
37 const std::string& app_name, | 37 const std::string& app_name, |
38 const std::string& object_type, | 38 const std::string& object_type, |
39 bool is_primary_selector); | 39 bool is_primary_selector, |
| 40 const GURL& create_url); |
40 ~DriveAppInfo(); | 41 ~DriveAppInfo(); |
41 | 42 |
42 // Drive app id. | 43 // Drive app id. |
43 std::string app_id; | 44 std::string app_id; |
44 // Drive application icon URLs for this app, paired with their size (length of | 45 // Drive application icon URLs for this app, paired with their size (length of |
45 // a side in pixels). | 46 // a side in pixels). |
46 google_apis::InstalledApp::IconList app_icons; | 47 google_apis::InstalledApp::IconList app_icons; |
47 // Drive document icon URLs for this app, paired with their size (length of | 48 // Drive document icon URLs for this app, paired with their size (length of |
48 // a side in pixels). | 49 // a side in pixels). |
49 google_apis::InstalledApp::IconList document_icons; | 50 google_apis::InstalledApp::IconList document_icons; |
50 // Web store id/extension id; | 51 // Web store id/extension id; |
51 std::string web_store_id; | 52 std::string web_store_id; |
52 // App name. | 53 // App name. |
53 std::string app_name; | 54 std::string app_name; |
54 // Object (file) type description handled by this app. | 55 // Object (file) type description handled by this app. |
55 std::string object_type; | 56 std::string object_type; |
56 // Is app the primary selector for file (default open action). | 57 // Is app the primary selector for file (default open action). |
57 bool is_primary_selector; | 58 bool is_primary_selector; |
| 59 // URL for opening a new file in the app. |
| 60 GURL create_url; |
58 }; | 61 }; |
59 | 62 |
60 // Keeps the track of installed drive applications in-memory. | 63 // Keeps the track of installed drive applications in-memory. |
61 class DriveAppRegistry { | 64 class DriveAppRegistry { |
62 public: | 65 public: |
63 explicit DriveAppRegistry(JobScheduler* scheduler); | 66 explicit DriveAppRegistry(JobScheduler* scheduler); |
64 ~DriveAppRegistry(); | 67 ~DriveAppRegistry(); |
65 | 68 |
66 // Returns a list of Drive app information for the |file_extension| with | 69 // Returns a list of Drive app information for the |file_extension| with |
67 // |mime_type|. | 70 // |mime_type|. |
(...skipping 21 matching lines...) Expand all Loading... |
89 // Helper function for loading Drive application file |selectors| into | 92 // Helper function for loading Drive application file |selectors| into |
90 // corresponding |map|. | 93 // corresponding |map|. |
91 static void AddAppSelectorList( | 94 static void AddAppSelectorList( |
92 const std::string& web_store_id, | 95 const std::string& web_store_id, |
93 const std::string& app_name, | 96 const std::string& app_name, |
94 const google_apis::InstalledApp::IconList& app_icons, | 97 const google_apis::InstalledApp::IconList& app_icons, |
95 const google_apis::InstalledApp::IconList& document_icons, | 98 const google_apis::InstalledApp::IconList& document_icons, |
96 const std::string& object_type, | 99 const std::string& object_type, |
97 const std::string& app_id, | 100 const std::string& app_id, |
98 bool is_primary_selector, | 101 bool is_primary_selector, |
| 102 const GURL& create_url, |
99 const ScopedVector<std::string>& selectors, | 103 const ScopedVector<std::string>& selectors, |
100 DriveAppFileSelectorMap* map); | 104 DriveAppFileSelectorMap* map); |
101 | 105 |
102 // Finds matching |apps| from |map| based on provided file |selector|. | 106 // Finds matching |apps| from |map| based on provided file |selector|. |
103 void FindAppsForSelector(const std::string& selector, | 107 void FindAppsForSelector(const std::string& selector, |
104 const DriveAppFileSelectorMap& map, | 108 const DriveAppFileSelectorMap& map, |
105 std::vector<DriveAppInfo*>* matched_apps) const; | 109 std::vector<DriveAppInfo*>* matched_apps) const; |
106 | 110 |
107 JobScheduler* scheduler_; | 111 JobScheduler* scheduler_; |
108 | 112 |
(...skipping 22 matching lines...) Expand all Loading... |
131 // Icons do not have to be sorted by the icon size. If there are no icons in | 135 // Icons do not have to be sorted by the icon size. If there are no icons in |
132 // the list, returns an empty URL. | 136 // the list, returns an empty URL. |
133 GURL FindPreferredIcon(const google_apis::InstalledApp::IconList& icons, | 137 GURL FindPreferredIcon(const google_apis::InstalledApp::IconList& icons, |
134 int preferred_size); | 138 int preferred_size); |
135 | 139 |
136 } // namespace util | 140 } // namespace util |
137 | 141 |
138 } // namespace drive | 142 } // namespace drive |
139 | 143 |
140 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_APP_REGISTRY_H_ | 144 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_APP_REGISTRY_H_ |
OLD | NEW |