From 90e1370d7f22e14765bfaa36df0e4051b6d66ff5 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 13:09:57 +0000 Subject: [PATCH 01/13] Update libchromiumcontent for Windows support * vendor/libchromiumcontent e70a88f...4aae27b (2): > Merge pull request #11 from brightray/windows-build > Merge pull request #10 from brightray/windows-scripts --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 39f0694cceac90f017291ddeb90544cd0777ff6a Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 16 May 2013 09:08:39 -0400 Subject: [PATCH 02/13] Add prerequisites to the README --- brightray/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) 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 From 0dfd5ec3206380f6c7741fda516ae338a84a7556 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 16 May 2013 08:59:24 -0400 Subject: [PATCH 03/13] Ensure consistent line endings in all files --- brightray/.gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 brightray/.gitattributes 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 From fd6e43baf9f9b62ed74513f6d26d081813e76392 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 15:21:03 +0000 Subject: [PATCH 04/13] Make script/build actually run gyp on Windows We don't yet build, but we're getting closer. --- brightray/script/build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/brightray/script/build b/brightray/script/build index 773b847aee..709af93ab0 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -2,17 +2,20 @@ 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([GYP, '--depth', '.', 'brightray.gyp']) subprocess.check_call(['xcodebuild']) if __name__ == '__main__': - import sys sys.exit(main()) From 3d83416c0466dff481db7ff4eb3ecc49e3c70670 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 15:21:16 +0000 Subject: [PATCH 05/13] Ignore .sln/.vcxproj files created by gyp --- brightray/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brightray/.gitignore b/brightray/.gitignore index dde2688146..c3ee68b0b5 100644 --- a/brightray/.gitignore +++ b/brightray/.gitignore @@ -1,2 +1,4 @@ +/brightray.sln +/brightray.vcxproj* /brightray.xcodeproj/ /build/ From a5b118ce348e669997a43a38c30f68c7c82dbe75 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 17:29:35 +0000 Subject: [PATCH 06/13] Use MSBuild to build on Windows --- brightray/script/build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/brightray/script/build b/brightray/script/build index 709af93ab0..6463d9d1d9 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -11,10 +11,25 @@ GYP = { 'win32': 'gyp.bat', }[sys.platform] + def main(): os.chdir(SOURCE_ROOT) + run_gyp() + build() + + +def run_gyp(): subprocess.check_call([GYP, '--depth', '.', 'brightray.gyp']) - subprocess.check_call(['xcodebuild']) + + +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__': From 689496afb8b9ab9fcd68e4baeab1d79c16b15147 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 14:13:09 -0400 Subject: [PATCH 07/13] Make sure sk_stdint.h is in the include path --- brightray/brightray.gyp | 2 ++ 1 file changed, 2 insertions(+) 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': [ From ae7331da8260ca79aea4839207e5ff531d5ab326 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 13:50:31 -0400 Subject: [PATCH 08/13] Add some build defaults for Windows These came from Chromium's build/common.gypi file. --- brightray/brightray.gypi | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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', + }, + }, + }], + ], } From 35199ba31fe119b39fa435026fe41dac168166cb Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 14:41:50 -0400 Subject: [PATCH 09/13] MSVC doesn't allow `override` on destructors --- brightray/browser/inspectable_web_contents_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From a6c5cb04f7739165ce25593836ac658c73713a52 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 14:43:42 -0400 Subject: [PATCH 10/13] Use FILE_PATH_LITERAL to fix build errors --- brightray/browser/browser_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 2b21447619..f4ab576e09 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())); From 5fa005d5da7aaf3be314cf2468c5f1b82bf688d6 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 14:47:33 -0400 Subject: [PATCH 11/13] Fix Windows build error about passing std::string to base::FilePath::Append --- brightray/browser/browser_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index f4ab576e09..c8b923977d 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -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 { From d07c45080d6debda5336b548d07aaca153480bf1 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 14 May 2013 14:50:24 -0400 Subject: [PATCH 12/13] Don't use range-based for loops VS2010 doesn't support them :-( --- brightray/browser/url_request_context_getter.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(); From e531f46a4b7b2dac0f4ca2926da7100048838ace Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 16 May 2013 09:16:29 -0400 Subject: [PATCH 13/13] Ignore files created by Visual Studio --- brightray/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brightray/.gitignore b/brightray/.gitignore index c3ee68b0b5..4f72578167 100644 --- a/brightray/.gitignore +++ b/brightray/.gitignore @@ -1,3 +1,5 @@ +/brightray.opensdf +/brightray.sdf /brightray.sln /brightray.vcxproj* /brightray.xcodeproj/