]> khamidou — GitHub mirrors - electron.git/commitdiff
Avoid duplicate code in main delegate.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 9 Jul 2014 09:15:28 +0000 (17:15 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 9 Jul 2014 09:15:28 +0000 (17:15 +0800)
atom/app/atom_main_delegate.cc
atom/app/atom_main_delegate.h
atom/app/atom_main_delegate_mac.mm
vendor/brightray

index fae7d8143238a8fcd10d6234038860f7c2e2f555..705ea4aaa8062da69ac1b6f9c558a15b8794fbf1 100644 (file)
@@ -11,9 +11,7 @@
 #include "base/command_line.h"
 #include "base/debug/stack_trace.h"
 #include "base/logging.h"
-#include "base/path_service.h"
 #include "content/public/common/content_switches.h"
-#include "ui/base/resource/resource_bundle.h"
 
 namespace atom {
 
@@ -48,17 +46,11 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
   base::debug::EnableInProcessStackDumping();
 #endif
 
-#if defined(OS_MACOSX)
-  OverrideChildProcessPath();
-  OverrideFrameworkBundlePath();
-#endif
-
-  SetContentClient(&content_client_);
-  return false;
+  return brightray::MainDelegate::BasicStartupComplete(exit_code);
 }
 
 void AtomMainDelegate::PreSandboxStartup() {
-  InitializeResourceBundle();
+  brightray::MainDelegate::PreSandboxStartup();
 
   CommandLine* command_line = CommandLine::ForCurrentProcess();
   std::string process_type = command_line->GetSwitchValueASCII(
@@ -78,19 +70,6 @@ void AtomMainDelegate::PreSandboxStartup() {
   command_line->AppendSwitch("atom-shell-switches-end");
 }
 
-void AtomMainDelegate::InitializeResourceBundle() {
-  base::FilePath path;
-#if defined(OS_MACOSX)
-  path = GetResourcesPakFilePath();
-#else
-  base::FilePath pak_dir;
-  PathService::Get(base::DIR_MODULE, &pak_dir);
-  path = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak"));
-#endif
-
-  ui::ResourceBundle::InitSharedInstanceWithPakPath(path);
-}
-
 content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
   browser_client_.reset(new AtomBrowserClient);
   return browser_client_.get();
index 650e9f3c765ba33528b4eb99884733dfe62a6492..0837df721778df4a61da3de05b0ca6305712c8e3 100644 (file)
@@ -18,12 +18,10 @@ class AtomMainDelegate : public brightray::MainDelegate {
  protected:
   virtual bool BasicStartupComplete(int* exit_code) OVERRIDE;
   virtual void PreSandboxStartup() OVERRIDE;
-  virtual void InitializeResourceBundle();
 
 #if defined(OS_MACOSX)
-  virtual base::FilePath GetResourcesPakFilePath();
-  virtual void OverrideChildProcessPath();
-  virtual void OverrideFrameworkBundlePath();
+  virtual void OverrideChildProcessPath() OVERRIDE;
+  virtual void OverrideFrameworkBundlePath() OVERRIDE;
 #endif
 
  private:
index e8a45585ee8586c689f43331c1b1acb1a255ae35..0e3e50203ad50fd33d374df137bb21016026c505 100644 (file)
@@ -4,16 +4,11 @@
 
 #include "atom/app/atom_main_delegate.h"
 
-#import "base/mac/bundle_locations.h"
-#import "base/mac/foundation_util.h"
-#import "base/mac/mac_util.h"
-#include "base/command_line.h"
+#include "base/mac/bundle_locations.h"
+#include "base/files/file_path.h"
 #include "base/path_service.h"
-#include "base/strings/sys_string_conversions.h"
+#include "brightray/common/mac/main_application_bundle.h"
 #include "content/public/common/content_paths.h"
-#include "content/public/common/content_switches.h"
-#include "vendor/brightray/common/application_info.h"
-#include "vendor/brightray/common/mac/main_application_bundle.h"
 
 namespace atom {
 
@@ -26,12 +21,6 @@ base::FilePath GetFrameworksPath() {
 
 }  // namespace
 
-base::FilePath AtomMainDelegate::GetResourcesPakFilePath() {
-  NSString* path = [base::mac::FrameworkBundle()
-      pathForResource:@"content_shell" ofType:@"pak"];
-  return base::mac::NSStringToFilePath(path);
-}
-
 void AtomMainDelegate::OverrideFrameworkBundlePath() {
   base::mac::SetOverrideFrameworkBundlePath(
       GetFrameworksPath().Append("Atom Framework.framework"));
index 842b674b6afa26ffc9d3d97f2ff96f0bb8498d74..c1c4cfcaad43ca4a802e15328a39f574a97fa272 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 842b674b6afa26ffc9d3d97f2ff96f0bb8498d74
+Subproject commit c1c4cfcaad43ca4a802e15328a39f574a97fa272