main_delegate_mac.mm 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Copyright (c) 2013 Adam Roben <[email protected]>. All rights reserved.
  3. // Use of this source code is governed by a BSD-style license that can be
  4. // found in the LICENSE-CHROMIUM file.
  5. #import "brightray/common/main_delegate.h"
  6. #include "base/command_line.h"
  7. #include "base/mac/bundle_locations.h"
  8. #include "base/mac/foundation_util.h"
  9. #include "base/path_service.h"
  10. #include "base/strings/stringprintf.h"
  11. #include "base/strings/sys_string_conversions.h"
  12. #include "brightray/common/application_info.h"
  13. #include "brightray/common/mac/main_application_bundle.h"
  14. #include "content/public/common/content_paths.h"
  15. #include "content/public/common/content_switches.h"
  16. #include "ui/base/resource/resource_bundle.h"
  17. namespace brightray {
  18. namespace {
  19. base::FilePath GetFrameworksPath() {
  20. return MainApplicationBundlePath().Append("Contents").Append("Frameworks");
  21. }
  22. } // namespace
  23. void MainDelegate::OverrideFrameworkBundlePath() {
  24. base::FilePath helper_path =
  25. GetFrameworksPath().Append(GetApplicationName() + " Framework.framework");
  26. base::mac::SetOverrideFrameworkBundlePath(helper_path);
  27. }
  28. void MainDelegate::OverrideChildProcessPath() {
  29. base::FilePath helper_path = GetFrameworksPath()
  30. .Append(GetApplicationName() + " Helper.app")
  31. .Append("Contents")
  32. .Append("MacOS")
  33. .Append(GetApplicationName() + " Helper");
  34. base::PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
  35. }
  36. } // namespace brightray