diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 0e19a903cb2c8..2eec6db994069 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -7,6 +7,7 @@ 'target_name': 'brightray', 'type': 'static_library', 'include_dirs': [ + '.', '<(libchromiumcontent_include_dir)', ], 'direct_dependent_settings': { @@ -28,6 +29,8 @@ 'browser/network_delegate.h', 'browser/url_request_context_getter.cc', 'browser/url_request_context_getter.h', + 'common/application_name.h', + 'common/application_name_mac.mm', 'common/main_delegate.cc', 'common/main_delegate.h', 'common/main_delegate_mac.mm', diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 51778133996b9..1b06fe0b1cf54 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -4,6 +4,8 @@ #include "browser_context.h" +#include "common/application_name.h" + #include "base/files/file_path.h" #include "base/path_service.h" #include "content/public/browser/browser_thread.h" @@ -53,10 +55,9 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(content::Prot } base::FilePath BrowserContext::GetPath() { - // FIXME: This should be an application-specific path. base::FilePath path; CHECK(PathService::Get(base::DIR_APP_DATA, &path)); - return path.Append("Brightray"); + return path.Append(GetApplicationName()); } bool BrowserContext::IsOffTheRecord() const { diff --git a/brightray/common/application_name.h b/brightray/common/application_name.h new file mode 100644 index 0000000000000..c00ea71aa02a7 --- /dev/null +++ b/brightray/common/application_name.h @@ -0,0 +1,12 @@ +#ifndef BRIGHTRAY_COMMON_APPLICATION_NAME_H_ +#define BRIGHTRAY_COMMON_APPLICATION_NAME_H_ + +#include + +namespace brightray { + +std::string GetApplicationName(); + +} + +#endif diff --git a/brightray/common/application_name_mac.mm b/brightray/common/application_name_mac.mm new file mode 100644 index 0000000000000..48bac02b6f82d --- /dev/null +++ b/brightray/common/application_name_mac.mm @@ -0,0 +1,12 @@ +#import "common/application_name.h" + +#import "base/mac/bundle_locations.h" +#import "base/mac/foundation_util.h" + +namespace brightray { + +std::string GetApplicationName() { + return [[base::mac::OuterBundle().infoDictionary objectForKey:base::mac::CFToNSCast(kCFBundleNameKey)] UTF8String]; +} + +} diff --git a/brightray/common/main_delegate_mac.mm b/brightray/common/main_delegate_mac.mm index e91312ef4427f..f53bc7866f04e 100644 --- a/brightray/common/main_delegate_mac.mm +++ b/brightray/common/main_delegate_mac.mm @@ -5,6 +5,7 @@ #import "main_delegate.h" +#include "common/application_name.h" #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" #include "base/path_service.h" @@ -35,23 +36,19 @@ return path.Append("Frameworks"); } -std::string OuterBundleName() { - return [[base::mac::OuterBundle().infoDictionary objectForKey:base::mac::CFToNSCast(kCFBundleNameKey)] UTF8String]; -} - } void MainDelegate::OverrideFrameworkBundlePath() { - base::FilePath helper_path = GetFrameworksPath().Append(OuterBundleName() + ".framework"); + base::FilePath helper_path = GetFrameworksPath().Append(GetApplicationName() + ".framework"); base::mac::SetOverrideFrameworkBundlePath(helper_path); } void MainDelegate::OverrideChildProcessPath() { - base::FilePath helper_path = GetFrameworksPath().Append(OuterBundleName() + " Helper.app") + base::FilePath helper_path = GetFrameworksPath().Append(GetApplicationName() + " Helper.app") .Append("Contents") .Append("MacOS") - .Append(OuterBundleName() + " Helper"); + .Append(GetApplicationName() + " Helper"); PathService::Override(content::CHILD_PROCESS_EXE, helper_path); }