main_delegate.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE-CHROMIUM file.
  4. #ifndef BRIGHTRAY_COMMON_MAIN_DELEGATE_H_
  5. #define BRIGHTRAY_COMMON_MAIN_DELEGATE_H_
  6. #include <memory>
  7. #include <string>
  8. #include "base/macros.h"
  9. #include "content/public/app/content_main_delegate.h"
  10. namespace base {
  11. class FilePath;
  12. }
  13. namespace ui {
  14. class ResourceBundle;
  15. }
  16. namespace brightray {
  17. class BrowserClient;
  18. class ContentClient;
  19. void LoadResourceBundle(const std::string& locale);
  20. void LoadCommonResources();
  21. class MainDelegate : public content::ContentMainDelegate {
  22. public:
  23. MainDelegate();
  24. ~MainDelegate();
  25. protected:
  26. // Subclasses can override this to provide their own ContentClient
  27. // implementation.
  28. virtual std::unique_ptr<ContentClient> CreateContentClient();
  29. // Subclasses can override this to provide their own BrowserClient
  30. // implementation.
  31. virtual std::unique_ptr<BrowserClient> CreateBrowserClient();
  32. #if defined(OS_MACOSX)
  33. // Subclasses can override this to custom the paths of child process and
  34. // framework bundle.
  35. virtual void OverrideChildProcessPath();
  36. virtual void OverrideFrameworkBundlePath();
  37. #endif
  38. bool BasicStartupComplete(int* exit_code) override;
  39. void PreSandboxStartup() override;
  40. private:
  41. content::ContentBrowserClient* CreateContentBrowserClient() override;
  42. std::unique_ptr<ContentClient> content_client_;
  43. std::unique_ptr<BrowserClient> browser_client_;
  44. DISALLOW_COPY_AND_ASSIGN(MainDelegate);
  45. };
  46. } // namespace brightray
  47. #endif // BRIGHTRAY_COMMON_MAIN_DELEGATE_H_