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

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: Rebase. 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/Vector.h"
16
17 #include <memory>
13 18
14 namespace blink { 19 namespace blink {
15 20
16 class WebSecurityOrigin; 21 class WebSecurityOrigin;
17 22
18 class MODULES_EXPORT InstalledAppController final 23 class MODULES_EXPORT InstalledAppController final
19 : public GarbageCollectedFinalized<InstalledAppController>, 24 : public GarbageCollectedFinalized<InstalledAppController>,
20 public Supplement<LocalFrame>, 25 public Supplement<LocalFrame>,
21 public ContextLifecycleObserver { 26 public ContextLifecycleObserver {
22 USING_GARBAGE_COLLECTED_MIXIN(InstalledAppController); 27 USING_GARBAGE_COLLECTED_MIXIN(InstalledAppController);
23 WTF_MAKE_NONCOPYABLE(InstalledAppController); 28 WTF_MAKE_NONCOPYABLE(InstalledAppController);
24 29
25 public: 30 public:
26 virtual ~InstalledAppController(); 31 virtual ~InstalledAppController();
27 32
28 void getInstalledApps(const WebSecurityOrigin&, 33 // Gets a list of related apps from a particular origin's manifest that belong
29 std::unique_ptr<AppInstalledCallbacks>); 34 // to the current underlying platform, and are installed.
35 // TODO(mgiuca): Don't use a Web* type here. DO NOT SUBMIT.
36 void getInstalledRelatedApps(const WebSecurityOrigin&,
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(
57 const blink::WebSecurityOrigin&,
58 const blink::WebVector<blink::WebRelatedApplication>&,
59 std::unique_ptr<blink::AppInstalledCallbacks>);
60
61 WebRelatedAppsFetcher* m_relatedAppsFetcher;
44 }; 62 };
45 63
46 } // namespace blink 64 } // namespace blink
47 65
48 #endif // InstalledAppController_h 66 #endif // InstalledAppController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698