diff --git a/brightray/.gitattributes b/brightray/.gitattributes new file mode 100644 index 0000000000..dfe0770424 --- /dev/null +++ b/brightray/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/brightray/.gitignore b/brightray/.gitignore index dde2688146..4f72578167 100644 --- a/brightray/.gitignore +++ b/brightray/.gitignore @@ -1,2 +1,6 @@ +/brightray.opensdf +/brightray.sdf +/brightray.sln +/brightray.vcxproj* /brightray.xcodeproj/ /build/ diff --git a/brightray/README.md b/brightray/README.md index 725a4718af..16569743d0 100644 --- a/brightray/README.md +++ b/brightray/README.md @@ -11,6 +11,15 @@ sample application written using Brightray. ## Development +### Prerequisites + +* Python 2.7 +* gyp +* Mac: + * Xcode +* Windows: + * Visual Studio 2010 SP1 + ### One-time setup You must previously have built and uploaded libchromiumcontent using its diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index aefa2305f8..71f73b98b5 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -9,10 +9,12 @@ 'include_dirs': [ '.', '<(libchromiumcontent_include_dir)', + '<(libchromiumcontent_include_dir)/third_party/skia/include/config', ], 'direct_dependent_settings': { 'include_dirs': [ '<(libchromiumcontent_include_dir)', + '<(libchromiumcontent_include_dir)/third_party/skia/include/config', ], }, 'sources': [ diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index 85416178df..bc07c9da19 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -31,14 +31,58 @@ ], }, 'configurations': { + 'Common_Base': { + 'abstract': 1, + 'msvs_configuration_attributes': { + 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)', + 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', + 'CharacterSet': '1', + }, + }, 'Debug': { + 'inherit_from': [ + 'Common_Base', + ], 'xcode_settings': { 'COPY_PHASE_STRIP': 'NO', 'GCC_OPTIMIZATION_LEVEL': '0', }, }, 'Release': { + 'inherit_from': [ + 'Common_Base', + ], }, }, }, + 'conditions': [ + ['OS=="win"', { + 'target_defaults': { + 'defines': [ + '_WIN32_WINNT=0x0602', + 'WINVER=0x0602', + 'WIN32', + '_WINDOWS', + 'NOMINMAX', + 'PSAPI_VERSION=1', + '_CRT_RAND_S', + 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS', + 'WIN32_LEAN_AND_MEAN', + '_ATL_NO_OPENGL', + ], + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalOptions': ['/MP'], + 'MinimalRebuild': 'false', + 'BufferSecurityCheck': 'true', + 'EnableFunctionLevelLinking': 'true', + 'RuntimeTypeInfo': 'false', + 'WarningLevel': '4', + 'WarnAsError': 'true', + 'DebugInformationFormat': '3', + }, + }, + }], + ], } diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 2b21447619..c8b923977d 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -41,7 +41,7 @@ private: }; BrowserContext::BrowserContext() : resource_context_(new ResourceContext) { - auto prefs_path = GetPath().Append("Preferences"); + auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences")); PrefServiceBuilder builder; builder.WithUserFilePrefs(prefs_path, JsonPrefStore::GetTaskRunnerForFile(prefs_path, content::BrowserThread::GetBlockingPool())); @@ -74,7 +74,7 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(content::Prot base::FilePath BrowserContext::GetPath() { base::FilePath path; CHECK(PathService::Get(base::DIR_APP_DATA, &path)); - return path.Append(GetApplicationName()); + return path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName())); } bool BrowserContext::IsOffTheRecord() const { diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 8efde3c25d..95293e062b 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -32,7 +32,7 @@ public: static void RegisterPrefs(PrefRegistrySimple*); InspectableWebContentsImpl(content::WebContents*); - virtual ~InspectableWebContentsImpl() OVERRIDE; + virtual ~InspectableWebContentsImpl(); virtual InspectableWebContentsView* GetView() const OVERRIDE; virtual content::WebContents* GetWebContents() const OVERRIDE; diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 58a251c239..5726500f6c 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -123,8 +123,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() scoped_ptr job_factory( new net::URLRequestJobFactoryImpl()); - for (auto& it : protocol_handlers_) { - bool set_protocol = job_factory->SetProtocolHandler(it.first, it.second.release()); + for (auto it = protocol_handlers_.begin(), + end = protocol_handlers_.end(); it != end; ++it) { + bool set_protocol = job_factory->SetProtocolHandler(it->first, it->second.release()); DCHECK(set_protocol); } protocol_handlers_.clear(); diff --git a/brightray/script/build b/brightray/script/build index 773b847aee..6463d9d1d9 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -2,17 +2,35 @@ import os import subprocess +import sys SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +GYP = { + 'darwin': 'gyp', + 'win32': 'gyp.bat', +}[sys.platform] def main(): os.chdir(SOURCE_ROOT) - subprocess.check_call(['gyp', '--depth', '.', 'brightray.gyp']) - subprocess.check_call(['xcodebuild']) + run_gyp() + build() + + +def run_gyp(): + subprocess.check_call([GYP, '--depth', '.', 'brightray.gyp']) + + +def build(): + if sys.platform == 'darwin': + subprocess.check_call(['xcodebuild']) + return + + assert sys.platform == 'win32', sys.platform + msbuild = os.path.join(os.environ['windir'], 'Microsoft.NET', 'Framework', 'v4.0.30319', 'MSBuild.exe') + subprocess.check_call([msbuild, 'brightray.sln']) if __name__ == '__main__': - import sys sys.exit(main()) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index e70a88f332..4aae27b02c 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit e70a88f3323aaf1a24e36bd5449b3e1bab5c57a3 +Subproject commit 4aae27b02c48decf86ad8656530d52632d6dd169