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

Side by Side Diff: chrome/browser/chromeos/gdata/drive_webapps_registry.h

Issue 10829276: Get web application list using Drive V2 API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/drive_webapps_registry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CHROMEOS_GDATA_DRIVE_WEBAPPS_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_WEBAPPS_REGISTRY_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_WEBAPPS_REGISTRY_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_WEBAPPS_REGISTRY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" 14 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 16
17 namespace gdata { 17 namespace gdata {
18 18
19 class AppList;
20
19 // Data structure that defines WebApp 21 // Data structure that defines WebApp
20 struct DriveWebAppInfo { 22 struct DriveWebAppInfo {
21 DriveWebAppInfo(const std::string& app_id, 23 DriveWebAppInfo(const std::string& app_id,
22 const InstalledApp::IconList& app_icons, 24 const InstalledApp::IconList& app_icons,
23 const InstalledApp::IconList& document_icons, 25 const InstalledApp::IconList& document_icons,
24 const std::string& web_store_id, 26 const std::string& web_store_id,
25 const string16& app_name, 27 const string16& app_name,
26 const string16& object_type, 28 const string16& object_type,
27 bool is_primary_selector); 29 bool is_primary_selector);
28 ~DriveWebAppInfo(); 30 ~DriveWebAppInfo();
(...skipping 15 matching lines...) Expand all
44 // Is app the primary selector for file (default open action). 46 // Is app the primary selector for file (default open action).
45 bool is_primary_selector; 47 bool is_primary_selector;
46 }; 48 };
47 49
48 // DriveWebAppsRegistry abstraction layer. 50 // DriveWebAppsRegistry abstraction layer.
49 // The interface is defined to make DriveWebAppsRegistry mockable. 51 // The interface is defined to make DriveWebAppsRegistry mockable.
50 class DriveWebAppsRegistryInterface { 52 class DriveWebAppsRegistryInterface {
51 public: 53 public:
52 virtual ~DriveWebAppsRegistryInterface() {} 54 virtual ~DriveWebAppsRegistryInterface() {}
53 55
54 // Gets the list of web |apps| matching |file| and it |mime_type|. 56 // Gets the list of web |apps| matching |file| and its |mime_type|.
55 virtual void GetWebAppsForFile(const FilePath& file, 57 virtual void GetWebAppsForFile(const FilePath& file,
56 const std::string& mime_type, 58 const std::string& mime_type,
57 ScopedVector<DriveWebAppInfo>* apps) = 0; 59 ScopedVector<DriveWebAppInfo>* apps) = 0;
58 60
59 // Returns a set of filename extensions registered for the given 61 // Returns a set of filename extensions registered for the given
60 // |web_store_id|. 62 // |web_store_id|.
61 virtual std::set<std::string> GetExtensionsForWebStoreApp( 63 virtual std::set<std::string> GetExtensionsForWebStoreApp(
62 const std::string& web_store_id) = 0; 64 const std::string& web_store_id) = 0;
63 65
64 // Updates the list of drive-enabled WebApps with freshly fetched account 66 // Updates the list of drive-enabled WebApps with freshly fetched account
65 // metadata feed. 67 // metadata feed.
66 virtual void UpdateFromFeed(AccountMetadataFeed* metadata) = 0; 68 virtual void UpdateFromFeed(const AccountMetadataFeed& metadata) = 0;
69
70 // Updates the list of drive-enabled WebApps with freshly fetched account
71 // metadata feed.
72 virtual void UpdateFromApplicationList(const AppList& applist) = 0;
67 }; 73 };
68 74
69 // The production implementation of DriveWebAppsRegistryInterface. 75 // The production implementation of DriveWebAppsRegistryInterface.
70 // Keeps the track of installed drive web application and provider. 76 // Keeps the track of installed drive web application and provider.
71 class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface { 77 class DriveWebAppsRegistry : public DriveWebAppsRegistryInterface {
72 public: 78 public:
73 DriveWebAppsRegistry(); 79 DriveWebAppsRegistry();
74 virtual ~DriveWebAppsRegistry(); 80 virtual ~DriveWebAppsRegistry();
75 81
76 // DriveWebAppsRegistry overrides. 82 // DriveWebAppsRegistry overrides.
77 virtual void GetWebAppsForFile(const FilePath& file, 83 virtual void GetWebAppsForFile(const FilePath& file,
78 const std::string& mime_type, 84 const std::string& mime_type,
79 ScopedVector<DriveWebAppInfo>* apps) OVERRIDE; 85 ScopedVector<DriveWebAppInfo>* apps) OVERRIDE;
80 virtual std::set<std::string> GetExtensionsForWebStoreApp( 86 virtual std::set<std::string> GetExtensionsForWebStoreApp(
81 const std::string& web_store_id) OVERRIDE; 87 const std::string& web_store_id) OVERRIDE;
82 virtual void UpdateFromFeed(AccountMetadataFeed* metadata) OVERRIDE; 88 virtual void UpdateFromFeed(const AccountMetadataFeed& metadata) OVERRIDE;
89 virtual void UpdateFromApplicationList(const AppList& applist) OVERRIDE;
83 90
84 private: 91 private:
85 // Defines WebApp application details that are associated with a given 92 // Defines WebApp application details that are associated with a given
86 // file extension or content mimetype. 93 // file extension or content mimetype.
87 struct WebAppFileSelector { 94 struct WebAppFileSelector {
88 WebAppFileSelector(const GURL& product_link, 95 WebAppFileSelector(const GURL& product_link,
89 const InstalledApp::IconList& app_icons, 96 const InstalledApp::IconList& app_icons,
90 const InstalledApp::IconList& document_icons, 97 const InstalledApp::IconList& document_icons,
91 const string16& object_type, 98 const string16& object_type,
92 const std::string& app_id, 99 const std::string& app_id,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 149
143 // Map of MIME type to application info. 150 // Map of MIME type to application info.
144 WebAppFileSelectorMap webapp_mimetypes_map_; 151 WebAppFileSelectorMap webapp_mimetypes_map_;
145 152
146 DISALLOW_COPY_AND_ASSIGN(DriveWebAppsRegistry); 153 DISALLOW_COPY_AND_ASSIGN(DriveWebAppsRegistry);
147 }; 154 };
148 155
149 } // namespace gdata 156 } // namespace gdata
150 157
151 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_WEBAPPS_REGISTRY_H_ 158 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_WEBAPPS_REGISTRY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/drive_webapps_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698