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

Side by Side Diff: third_party/WebKit/Source/modules/installedapp/InstalledAppController.h

Issue 2488573002: Refactor getInstalledRelatedApps code and add manifest logic and tests. (Closed)
Patch Set: Use SecurityOrigin, not WebSecurityOrigin. Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 InstalledAppController_h 5 #ifndef InstalledAppController_h
6 #define InstalledAppController_h 6 #define InstalledAppController_h
7 7
8 #include "core/dom/ContextLifecycleObserver.h" 8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "modules/ModulesExport.h" 10 #include "modules/ModulesExport.h"
11 #include "platform/Supplementable.h" 11 #include "platform/Supplementable.h"
12 #include "public/platform/modules/installedapp/WebInstalledAppClient.h" 12 #include "public/platform/WebVector.h"
13 #include "public/platform/modules/installedapp/WebRelatedApplication.h"
14 #include "public/platform/modules/installedapp/WebRelatedAppsFetcher.h"
15 #include "wtf/RefPtr.h"
16 #include "wtf/Vector.h"
17
18 #include <memory>
13 19
14 namespace blink { 20 namespace blink {
15 21
16 class WebSecurityOrigin; 22 class SecurityOrigin;
17 23
18 class MODULES_EXPORT InstalledAppController final 24 class MODULES_EXPORT InstalledAppController final
19 : public GarbageCollectedFinalized<InstalledAppController>, 25 : public GarbageCollectedFinalized<InstalledAppController>,
20 public Supplement<LocalFrame>, 26 public Supplement<LocalFrame>,
21 public ContextLifecycleObserver { 27 public ContextLifecycleObserver {
22 USING_GARBAGE_COLLECTED_MIXIN(InstalledAppController); 28 USING_GARBAGE_COLLECTED_MIXIN(InstalledAppController);
23 WTF_MAKE_NONCOPYABLE(InstalledAppController); 29 WTF_MAKE_NONCOPYABLE(InstalledAppController);
24 30
25 public: 31 public:
26 virtual ~InstalledAppController(); 32 virtual ~InstalledAppController();
27 33
28 void getInstalledApps(const WebSecurityOrigin&, 34 // Gets a list of related apps from a particular origin's manifest that belong
29 std::unique_ptr<AppInstalledCallbacks>); 35 // to the current underlying platform, and are installed.
36 void getInstalledRelatedApps(WTF::RefPtr<SecurityOrigin>,
37 std::unique_ptr<AppInstalledCallbacks>);
30 38
31 static void provideTo(LocalFrame&, WebInstalledAppClient*); 39 static void provideTo(LocalFrame&, WebRelatedAppsFetcher*);
32 static InstalledAppController* from(LocalFrame&); 40 static InstalledAppController* from(LocalFrame&);
33 static const char* supplementName(); 41 static const char* supplementName();
34 42
35 DECLARE_VIRTUAL_TRACE(); 43 DECLARE_VIRTUAL_TRACE();
36 44
37 private: 45 private:
38 InstalledAppController(LocalFrame&, WebInstalledAppClient*); 46 class GetRelatedAppsCallbacks;
47
48 InstalledAppController(LocalFrame&, WebRelatedAppsFetcher*);
39 49
40 // Inherited from ContextLifecycleObserver. 50 // Inherited from ContextLifecycleObserver.
41 void contextDestroyed(ExecutionContext*) override; 51 void contextDestroyed(ExecutionContext*) override;
42 52
43 WebInstalledAppClient* m_client; 53 // For a given security origin, takes a set of related applications and
54 // filters them by those which belong to the current underlying platform, and
55 // are actually installed. Passes the filtered list to the callback.
56 void filterByInstalledApps(WTF::RefPtr<SecurityOrigin>,
57 const WebVector<WebRelatedApplication>&,
58 std::unique_ptr<AppInstalledCallbacks>);
59
60 WebRelatedAppsFetcher* m_relatedAppsFetcher;
44 }; 61 };
45 62
46 } // namespace blink 63 } // namespace blink
47 64
48 #endif // InstalledAppController_h 65 #endif // InstalledAppController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698