Skip to content

Commit

Permalink
commit at CL 239258006
Browse files Browse the repository at this point in the history
  • Loading branch information
sorinj committed Mar 19, 2019
1 parent 7b2b1ef commit 03e83a6
Show file tree
Hide file tree
Showing 179 changed files with 1,022 additions and 341 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ omaha/common/omaha_customization_proxy_clsid.h
omaha/proxy_clsids.txt
omaha/*.idb
omaha/scons-out/**
third_party/libzip/**
third_party/zlib/**

# Ignore compiled Python files.
*.pyc
24 changes: 9 additions & 15 deletions omaha/base/browser_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "omaha/base/file.h"
#include "omaha/base/path.h"
#include "omaha/base/reg_key.h"
#include "omaha/base/string.h"
#include "omaha/base/utils.h"
#include "omaha/testing/unit_test.h"

Expand Down Expand Up @@ -223,42 +224,35 @@ TEST(BrowserUtilsTest, GetBrowserImagePath_AllSupportedBrowsers) {
return;
}

CString program_files_path;
EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES | CSIDL_FLAG_DONT_VERIFY,
&program_files_path));
CString path;

HRESULT hr = GetBrowserImagePath(BROWSER_IE, &path);
if (SUCCEEDED(hr)) {
EXPECT_EQ(0, path.CompareNoCase(program_files_path +
_T("\\Internet Explorer\\iexplore.exe")))
EXPECT_TRUE(File::Exists(path));
EXPECT_TRUE(
String_EndsWith(path, _T("\\Internet Explorer\\iexplore.exe"), true))
<< _T("Actual path: ") << path.GetString();
} else {
EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), hr);
}

hr = GetBrowserImagePath(BROWSER_FIREFOX, &path);
if (SUCCEEDED(hr)) {
EXPECT_TRUE(File::Exists(path));
EXPECT_TRUE(
0 == path.CompareNoCase(program_files_path +
_T("\\Mozilla Firefox\\firefox.exe")) ||
String_EndsWith(path, _T("\\Mozilla Firefox\\firefox.exe"), true) ||
0 == path.CompareNoCase(
_T("C:\\PROGRA~1\\MOZILL~1\\FIREFOX.EXE")) ||
0 == path.CompareNoCase(program_files_path +
_T("\\Minefield\\FIREFOX.EXE"))) // Trunk build
String_EndsWith(path, _T("\\Minefield\\FIREFOX.EXE"), true))
<< _T("Actual path: ") << path.GetString();
} else {
EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), hr);
}

hr = GetBrowserImagePath(BROWSER_CHROME, &path);
if (SUCCEEDED(hr)) {
EXPECT_TRUE(
0 == path.CompareNoCase(program_files_path +
_T("\\Google\\Chrome\\Application\\chrome.exe")) ||
0 == path.CompareNoCase(
GetLocalAppDataPath() +
_T("Google\\Chrome\\Application\\chrome.exe")))
EXPECT_TRUE(File::Exists(path));
EXPECT_TRUE(String_EndsWith(path, _T("\\Application\\chrome.exe"), true))
<< _T("Actual path: ") << path.GetString();
} else {
EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), hr);
Expand Down
63 changes: 51 additions & 12 deletions omaha/base/build.scons
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

Import('env')

import glob
import os
import os.path

Expand Down Expand Up @@ -121,7 +122,8 @@ local_env.Append(CPP_OUT = '$TARGET_ROOT/proto_files' + crx_file_path)
proto_sources = [
'$MAIN_DIR' + crx_file_path + 'crx3.proto'
]
proto_output = local_env.CompileProtoBuf(proto_sources)
cc_files = local_env.CompileProtoBuf(proto_sources)

default_protobuf_src_dir = '$GOOGLE3/third_party/protobuf/src'
protobuf_src_dir = os.getenv('OMAHA_PROTOBUF_SRC_DIR', default_protobuf_src_dir)

Expand All @@ -145,20 +147,14 @@ local_env.Append(
],
)

local_inputs = [
cc_files += [
'../third_party/chrome/files/src/components/crx_file/crx_verifier.cc',
'../third_party/chrome/files/src/components/crx_file/id_util.cc',
'../third_party/chrome/files/src/crypto/signature_verifier.cc',
'../third_party/chrome/files/src/crypto/secure_util.cc',
] + proto_output

obj_files = []
for cc_file in local_inputs:
obj_files.append(local_env.Object(cc_file))
local_env.Depends(obj_files, proto_output)
local_env.ComponentStaticLibrary('crx_file', obj_files, use_pch_default=False)
]

local_env = env.Clone() # SCons pylint: disable=undefined-variable
""" Add protobuf library files."""

protobuf_src_path = os.path.join(protobuf_src_dir, 'google/protobuf/')
local_env.FilterOut(CCFLAGS=['/W4'])
Expand Down Expand Up @@ -191,7 +187,7 @@ local_env.Append(

protobuf_src_path_dir = local_env.Dir(protobuf_src_path)
local_env.Dir('protobuf').addRepository(protobuf_src_path_dir)
cc_files = [
cc_files += [
'protobuf/compiler/importer.cc',
'protobuf/compiler/parser.cc',
'protobuf/descriptor.cc',
Expand All @@ -206,6 +202,7 @@ cc_files = [
'protobuf/io/coded_stream.cc',
'protobuf/io/printer.cc',
'protobuf/io/tokenizer.cc',
'protobuf/io/strtod.cc',
'protobuf/io/zero_copy_stream.cc',
'protobuf/io/zero_copy_stream_impl.cc',
'protobuf/io/zero_copy_stream_impl_lite.cc',
Expand All @@ -229,5 +226,47 @@ cc_files = [
'protobuf/wire_format_lite.cc',
]

""" Add zlib library files."""

local_env.FilterOut(CCFLAGS=['/WX'])
zlib_src_path = '$THIRD_PARTY/zlib/v1_2_11/'
zlib_src_path_dir = local_env.Dir(zlib_src_path)
local_env.Dir('zlib').addRepository(zlib_src_path_dir)
cc_files += ['zlib/' +
os.path.basename(x) for x in
glob.glob(zlib_src_path_dir.path + os.sep + '*.c')]

""" Add libzip library files."""

libzip_src_path = '$THIRD_PARTY/libzip/lib/'
libzip_src_path_dir = local_env.Dir(libzip_src_path)
local_env.Dir('libzip').addRepository(libzip_src_path_dir)
libzip_gladman_src_path = '$THIRD_PARTY/libzip/lib/gladman-fcrypt'

local_env.Append(
CPPDEFINES=[
'HAVE_CONFIG_H',
],
CPPPATH=[
'libzip/',
libzip_gladman_src_path,
libzip_src_path,
zlib_src_path,
],
CCFLAGS=[
'/wd4005',
'/wd4244',
],
)

cc_files += ['libzip/' + os.path.basename(x) for x in list(
set(glob.glob(libzip_src_path_dir.path + os.sep + '*.c')) -
set(glob.glob(libzip_src_path_dir.path + os.sep + '*unix*.c')) -
set(glob.glob(libzip_src_path_dir.path + os.sep + 'zip_crypto_[cgo]*.c')) -
set(glob.glob(libzip_src_path_dir.path + os.sep + 'zip_source_file.c')) -
set(glob.glob(libzip_src_path_dir.path + os.sep + 'zip_random_uwp.c')) -
set(glob.glob(libzip_src_path_dir.path + os.sep + 'zip_winzip_aes.c')) -
set(glob.glob(libzip_src_path_dir.path + os.sep + '*bzip2.c')))]

local_env.ComponentStaticLibraryMultiarch(
'libprotobuf', cc_files, COMPONENT_STATIC=True, use_pch_default=False)
'crx_file', cc_files, COMPONENT_STATIC=True, use_pch_default=False)
2 changes: 1 addition & 1 deletion omaha/base/const_addresses.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const TCHAR* const kUrlMoreInfo =

// Code Red check url.
const TCHAR* const kUrlCodeRedCheck =
_T("https://clients2.") COMPANY_DOMAIN _T("/service/check2");
_T("https://clients2.") COMPANY_DOMAIN _T("/service/check2?crx3=true");

// Usage stats url.
const TCHAR* const kUrlUsageStatsReport =
Expand Down
12 changes: 6 additions & 6 deletions omaha/base/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ const TCHAR* const kCustomClientInfoGroup = _T("ClientCustomData");
const COLORREF kTextColor = RGB(0x29, 0x29, 0x29);
const COLORREF kBkColor = RGB(0XFB, 0XFB, 0XFB);

const COLORREF kCaptionForegroundColor = RGB(0x82, 0x82, 0x82);
const COLORREF kCaptionForegroundColor = RGB(0x00, 0x00, 0x00);
const COLORREF kCaptionBkHover = RGB(0xE9, 0xE9, 0xE9);
const COLORREF kCaptionFrameColor = RGB(0xC1, 0xC1, 0xC1);

Expand All @@ -497,11 +497,11 @@ const COLORREF kProgressInnerFrameLight = RGB(0x6e, 0xc2, 0xfe);
const COLORREF kProgressInnerFrameDark = RGB(0x44, 0x90, 0xfc);
const COLORREF kProgressBarLightColor = RGB(0x4d, 0xa4, 0xfd);
const COLORREF kProgressBarDarkColor = RGB(0x40, 0x86, 0xfd);
const COLORREF kProgressEmptyFillColor = RGB(230, 230, 230);
const COLORREF kProgressEmptyFrameColor = RGB(0xdd, 0xdd, 0xdd);
const COLORREF kProgressShadowLightColor = RGB(0xed, 0xed, 0xed);
const COLORREF kProgressShadowDarkColor = RGB(0xd5, 0xd5, 0xd5);
const COLORREF kProgressLeftHighlightColor = RGB(0xed, 0xed, 0xed);
const COLORREF kProgressEmptyFillColor = RGB(0xb6, 0xb6, 0xb6);
const COLORREF kProgressEmptyFrameColor = RGB(0xad, 0xad, 0xad);
const COLORREF kProgressShadowLightColor = RGB(0xbd, 0xbd, 0xbd);
const COLORREF kProgressShadowDarkColor = RGB(0xa5, 0xa5, 0xa5);
const COLORREF kProgressLeftHighlightColor = RGB(0xbd, 0xbd, 0xbd);

// *** ***
// *** Custom HTTP request headers sent by the Omaha Client. ***
Expand Down
Loading

0 comments on commit 03e83a6

Please sign in to comment.