OLD | NEW |
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 #include "modules/installedapp/InstalledAppController.h" | 5 #include "modules/installedapp/InstalledAppController.h" |
6 | 6 |
7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "public/platform/WebSecurityOrigin.h" | 9 #include "public/platform/WebSecurityOrigin.h" |
10 | 10 |
| 11 #include <utility> |
| 12 |
11 namespace blink { | 13 namespace blink { |
12 | 14 |
13 InstalledAppController::~InstalledAppController() | 15 InstalledAppController::~InstalledAppController() |
14 { | 16 { |
15 } | 17 } |
16 | 18 |
17 void InstalledAppController::provideTo(LocalFrame& frame, WebInstalledAppClient*
client) | 19 void InstalledAppController::provideTo(LocalFrame& frame, WebInstalledAppClient*
client) |
18 { | 20 { |
19 ASSERT(RuntimeEnabledFeatures::installedAppEnabled()); | 21 ASSERT(RuntimeEnabledFeatures::installedAppEnabled()); |
20 | 22 |
(...skipping 12 matching lines...) Expand all Loading... |
33 : LocalFrameLifecycleObserver(&frame) | 35 : LocalFrameLifecycleObserver(&frame) |
34 , m_client(client) | 36 , m_client(client) |
35 { | 37 { |
36 } | 38 } |
37 | 39 |
38 const char* InstalledAppController::supplementName() | 40 const char* InstalledAppController::supplementName() |
39 { | 41 { |
40 return "InstalledAppController"; | 42 return "InstalledAppController"; |
41 } | 43 } |
42 | 44 |
43 void InstalledAppController::getInstalledApps(const WebSecurityOrigin& url, WebP
assOwnPtr<AppInstalledCallbacks> callback) | 45 void InstalledAppController::getInstalledApps(const WebSecurityOrigin& url, std:
:unique_ptr<AppInstalledCallbacks> callback) |
44 { | 46 { |
45 // When detached, the client is no longer valid. | 47 // When detached, the client is no longer valid. |
46 if (!m_client) { | 48 if (!m_client) { |
47 callback.release()->onError(); | 49 callback.release()->onError(); |
48 return; | 50 return; |
49 } | 51 } |
50 | 52 |
51 // Client is expected to take ownership of the callback | 53 // Client is expected to take ownership of the callback |
52 m_client->getInstalledRelatedApps(url, callback); | 54 m_client->getInstalledRelatedApps(url, std::move(callback)); |
53 } | 55 } |
54 | 56 |
55 void InstalledAppController::willDetachFrameHost() | 57 void InstalledAppController::willDetachFrameHost() |
56 { | 58 { |
57 m_client = nullptr; | 59 m_client = nullptr; |
58 } | 60 } |
59 | 61 |
60 DEFINE_TRACE(InstalledAppController) | 62 DEFINE_TRACE(InstalledAppController) |
61 { | 63 { |
62 Supplement<LocalFrame>::trace(visitor); | 64 Supplement<LocalFrame>::trace(visitor); |
63 LocalFrameLifecycleObserver::trace(visitor); | 65 LocalFrameLifecycleObserver::trace(visitor); |
64 } | 66 } |
65 | 67 |
66 } // namespace blink | 68 } // namespace blink |
OLD | NEW |