| 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/installation/InstallationServiceImpl.h" | 5 #include "modules/installation/InstallationServiceImpl.h" |
| 6 | 6 |
| 7 #include <utility> |
| 7 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
| 8 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 9 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 #include "wtf/PtrUtil.h" | 12 #include "wtf/PtrUtil.h" |
| 12 #include <utility> | |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 InstallationServiceImpl::InstallationServiceImpl(LocalFrame& frame) | 16 InstallationServiceImpl::InstallationServiceImpl(LocalFrame& frame) |
| 17 : m_frame(frame) {} | 17 : m_frame(frame) {} |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 void InstallationServiceImpl::create( | 20 void InstallationServiceImpl::create( |
| 21 LocalFrame* frame, | 21 LocalFrame* frame, |
| 22 mojom::blink::InstallationServiceRequest request) { | 22 mojom::blink::InstallationServiceRequest request) { |
| 23 mojo::MakeStrongBinding(WTF::makeUnique<InstallationServiceImpl>(*frame), | 23 mojo::MakeStrongBinding(WTF::makeUnique<InstallationServiceImpl>(*frame), |
| 24 std::move(request)); | 24 std::move(request)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void InstallationServiceImpl::OnInstall() { | 27 void InstallationServiceImpl::OnInstall() { |
| 28 if (!m_frame) | 28 if (!m_frame) |
| 29 return; | 29 return; |
| 30 | 30 |
| 31 LocalDOMWindow* domWindow = m_frame->domWindow(); | 31 LocalDOMWindow* domWindow = m_frame->domWindow(); |
| 32 if (!domWindow) | 32 if (!domWindow) |
| 33 return; | 33 return; |
| 34 | 34 |
| 35 domWindow->dispatchEvent(Event::create(EventTypeNames::appinstalled)); | 35 domWindow->dispatchEvent(Event::create(EventTypeNames::appinstalled)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace blink | 38 } // namespace blink |
| OLD | NEW |