delayed_native_view_host.h 923 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) 2018 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_BROWSER_UI_COCOA_DELAYED_NATIVE_VIEW_HOST_H_
  5. #define ATOM_BROWSER_UI_COCOA_DELAYED_NATIVE_VIEW_HOST_H_
  6. #include "ui/views/controls/native/native_view_host.h"
  7. namespace atom {
  8. // Automatically attach the native view after the NativeViewHost is attached to
  9. // a widget. (Attaching it directly would cause crash.)
  10. class DelayedNativeViewHost : public views::NativeViewHost {
  11. public:
  12. explicit DelayedNativeViewHost(gfx::NativeView native_view);
  13. ~DelayedNativeViewHost() override;
  14. // views::View:
  15. void ViewHierarchyChanged(
  16. const ViewHierarchyChangedDetails& details) override;
  17. private:
  18. gfx::NativeView native_view_;
  19. DISALLOW_COPY_AND_ASSIGN(DelayedNativeViewHost);
  20. };
  21. } // namespace atom
  22. #endif // ATOM_BROWSER_UI_COCOA_DELAYED_NATIVE_VIEW_HOST_H_