clang/win: Fix most -Wunused-function warnings in Chromium code.
No intended behavior change. BUG=505316 TBR=armansito Review URL: https://codereview.chromium.org/1255073002 Cr-Commit-Position: refs/heads/master@{#340761}
This commit is contained in:
base/files
chrome
app
browser
installer
test
components
content
app
browser
common
renderer
device/bluetooth
gpu/config
net
ppapi/tests
printing
remoting/host/setup
sandbox/win/src
skia/ext
ui/base/test
win8/metro_driver
@ -244,15 +244,6 @@ std::wstring ReadTextFile(const FilePath& filename) {
|
||||
return std::wstring(contents);
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
uint64 FileTimeAsUint64(const FILETIME& ft) {
|
||||
ULARGE_INTEGER u;
|
||||
u.LowPart = ft.dwLowDateTime;
|
||||
u.HighPart = ft.dwHighDateTime;
|
||||
return u.QuadPart;
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(FileUtilTest, FileAndDirectorySize) {
|
||||
// Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize
|
||||
// should return 53 bytes.
|
||||
|
@ -28,10 +28,8 @@ const size_t kMinHeaderBufferSize = 0x400;
|
||||
// A handy symbolic constant.
|
||||
const size_t kOneHundredPercent = 100;
|
||||
|
||||
void StaticAssertions() {
|
||||
COMPILE_ASSERT(kMinHeaderBufferSize >= sizeof(IMAGE_DOS_HEADER),
|
||||
min_header_buffer_size_at_least_as_big_as_the_dos_header);
|
||||
}
|
||||
static_assert(kMinHeaderBufferSize >= sizeof(IMAGE_DOS_HEADER),
|
||||
"kMinHeaderBufferSize must be at least as big as the dos header");
|
||||
|
||||
// This struct provides a deallocation functor for use with scoped_ptr<T>
|
||||
// allocated with ::VirtualAlloc().
|
||||
|
@ -17,11 +17,9 @@
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/message_window.h"
|
||||
#include "base/win/metro.h"
|
||||
#include "base/win/scoped_handle.h"
|
||||
#include "base/win/win_util.h"
|
||||
#include "base/win/windows_version.h"
|
||||
#include "chrome/browser/metro_utils/metro_chrome_win.h"
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
|
||||
@ -30,70 +28,6 @@ namespace {
|
||||
|
||||
int timeout_in_milliseconds = 20 * 1000;
|
||||
|
||||
// The following is copied from net/base/escape.cc. We don't want to depend on
|
||||
// net here because this gets compiled into chrome.exe to facilitate
|
||||
// fast-rendezvous (see https://codereview.chromium.org/14617003/).
|
||||
|
||||
// TODO(koz): Move these functions out of net/base/escape.cc into base/escape.cc
|
||||
// so we can depend on it directly.
|
||||
|
||||
// BEGIN COPY from net/base/escape.cc
|
||||
|
||||
// A fast bit-vector map for ascii characters.
|
||||
//
|
||||
// Internally stores 256 bits in an array of 8 ints.
|
||||
// Does quick bit-flicking to lookup needed characters.
|
||||
struct Charmap {
|
||||
bool Contains(unsigned char c) const {
|
||||
return ((map[c >> 5] & (1 << (c & 31))) != 0);
|
||||
}
|
||||
|
||||
uint32 map[8];
|
||||
};
|
||||
|
||||
const char kHexString[] = "0123456789ABCDEF";
|
||||
inline char IntToHex(int i) {
|
||||
DCHECK_GE(i, 0) << i << " not a hex value";
|
||||
DCHECK_LE(i, 15) << i << " not a hex value";
|
||||
return kHexString[i];
|
||||
}
|
||||
|
||||
// Given text to escape and a Charmap defining which values to escape,
|
||||
// return an escaped string. If use_plus is true, spaces are converted
|
||||
// to +, otherwise, if spaces are in the charmap, they are converted to
|
||||
// %20.
|
||||
std::string Escape(const std::string& text, const Charmap& charmap,
|
||||
bool use_plus) {
|
||||
std::string escaped;
|
||||
escaped.reserve(text.length() * 3);
|
||||
for (unsigned int i = 0; i < text.length(); ++i) {
|
||||
unsigned char c = static_cast<unsigned char>(text[i]);
|
||||
if (use_plus && ' ' == c) {
|
||||
escaped.push_back('+');
|
||||
} else if (charmap.Contains(c)) {
|
||||
escaped.push_back('%');
|
||||
escaped.push_back(IntToHex(c >> 4));
|
||||
escaped.push_back(IntToHex(c & 0xf));
|
||||
} else {
|
||||
escaped.push_back(c);
|
||||
}
|
||||
}
|
||||
return escaped;
|
||||
}
|
||||
|
||||
// Everything except alphanumerics and !'()*-._~
|
||||
// See RFC 2396 for the list of reserved characters.
|
||||
static const Charmap kQueryCharmap = {{
|
||||
0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L,
|
||||
0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
|
||||
}};
|
||||
|
||||
std::string EscapeQueryParamValue(const std::string& text, bool use_plus) {
|
||||
return Escape(text, kQueryCharmap, use_plus);
|
||||
}
|
||||
|
||||
// END COPY from net/base/escape.cc
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace chrome {
|
||||
|
@ -102,6 +102,7 @@ bool IsUnstableChannel() {
|
||||
channel == chrome::VersionInfo::CHANNEL_CANARY;
|
||||
}
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
// This task identifies whether we are running an unstable version. And then it
|
||||
// unconditionally calls back the provided task.
|
||||
void CheckForUnstableChannel(const base::Closure& callback_task,
|
||||
@ -109,8 +110,7 @@ void CheckForUnstableChannel(const base::Closure& callback_task,
|
||||
*is_unstable_channel = IsUnstableChannel();
|
||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback_task);
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#else
|
||||
// Return true if the currently running Chrome is a system install.
|
||||
bool IsSystemInstall() {
|
||||
// Get the version of the currently *installed* instance of Chrome,
|
||||
@ -125,6 +125,7 @@ bool IsSystemInstall() {
|
||||
return !InstallUtil::IsPerUserInstall(exe_path);
|
||||
}
|
||||
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
// Sets |is_unstable_channel| to true if the current chrome is on the dev or
|
||||
// canary channels. Sets |is_auto_update_enabled| to true if Google Update will
|
||||
// update the current chrome. Unconditionally posts |callback_task| to the UI
|
||||
@ -142,7 +143,8 @@ void DetectUpdatability(const base::Closure& callback_task,
|
||||
*is_unstable_channel = IsUnstableChannel();
|
||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback_task);
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
#endif // defined(GOOGLE_CHROME_BUILD)
|
||||
#endif // !defined(OS_WIN)
|
||||
|
||||
// Gets the currently installed version. On Windows, if |critical_update| is not
|
||||
// NULL, also retrieves the critical update version info if available.
|
||||
|
@ -174,46 +174,6 @@ base::string16 GetRegCommandKey(BrowserDistribution* dist,
|
||||
return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name);
|
||||
}
|
||||
|
||||
// Adds work items to create (or delete if uninstalling) app commands to launch
|
||||
// the app with a switch. The following criteria should be true:
|
||||
// 1. The switch takes one parameter.
|
||||
// 2. The command send pings.
|
||||
// 3. The command is web accessible.
|
||||
// 4. The command is run as the user.
|
||||
void AddCommandWithParameterWorkItems(const InstallerState& installer_state,
|
||||
const InstallationState& machine_state,
|
||||
const Version& new_version,
|
||||
const Product& product,
|
||||
const wchar_t* command_key,
|
||||
const wchar_t* app,
|
||||
const char* command_with_parameter,
|
||||
WorkItemList* work_item_list) {
|
||||
DCHECK(command_key);
|
||||
DCHECK(app);
|
||||
DCHECK(command_with_parameter);
|
||||
DCHECK(work_item_list);
|
||||
|
||||
base::string16 full_cmd_key(
|
||||
GetRegCommandKey(product.distribution(), command_key));
|
||||
|
||||
if (installer_state.operation() == InstallerState::UNINSTALL) {
|
||||
work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(),
|
||||
full_cmd_key,
|
||||
KEY_WOW64_32KEY)
|
||||
->set_log_message("removing " + base::UTF16ToASCII(command_key) +
|
||||
" command");
|
||||
} else {
|
||||
base::CommandLine cmd_line(installer_state.target_path().Append(app));
|
||||
cmd_line.AppendSwitchASCII(command_with_parameter, "%1");
|
||||
|
||||
AppCommand cmd(cmd_line.GetCommandLineString());
|
||||
cmd.set_sends_pings(true);
|
||||
cmd.set_is_web_accessible(true);
|
||||
cmd.set_is_run_as_user(true);
|
||||
cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list);
|
||||
}
|
||||
}
|
||||
|
||||
// A callback invoked by |work_item| that adds firewall rules for Chrome. Rules
|
||||
// are left in-place on rollback unless |remove_on_rollback| is true. This is
|
||||
// the case for new installs only. Updates and overinstalls leave the rule
|
||||
|
@ -182,6 +182,7 @@ bool GetChromeChannelInternal(bool system_install,
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
// Populates |update_policy| with the UpdatePolicy enum value corresponding to a
|
||||
// DWORD read from the registry and returns true if |value| is within range.
|
||||
// If |value| is out of range, returns false without modifying |update_policy|.
|
||||
@ -200,6 +201,7 @@ bool GetUpdatePolicyFromDword(
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // defined(GOOGLE_CHROME_BUILD)
|
||||
|
||||
// Convenience routine: GoogleUpdateSettings::UpdateDidRunStateForApp()
|
||||
// specialized for Chrome Binaries.
|
||||
|
@ -124,17 +124,6 @@ bool operator<(const LangToOffset& left, const std::wstring& right) {
|
||||
return left.language < right;
|
||||
}
|
||||
|
||||
// A less-than overload to do slightly more efficient searches in the
|
||||
// sorted arrays.
|
||||
bool operator<(const std::wstring& left, const LangToOffset& right) {
|
||||
return left < right.language;
|
||||
}
|
||||
|
||||
// A not-so-efficient less-than overload for the same uses as above.
|
||||
bool operator<(const LangToOffset& left, const LangToOffset& right) {
|
||||
return std::wstring(left.language) < right.language;
|
||||
}
|
||||
|
||||
// A compare function for searching in a sorted array by offset.
|
||||
bool IsOffsetLessThan(const LangToOffset& left, const LangToOffset& right) {
|
||||
return left.offset < right.offset;
|
||||
|
@ -921,18 +921,6 @@ bool LaunchSelectDefaultProtocolHandlerDialog(const wchar_t* protocol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Launches the Windows 7 and Windows 8 application association dialog, which
|
||||
// is the only documented way to make a browser the default browser on
|
||||
// Windows 8.
|
||||
bool LaunchApplicationAssociationDialog(const base::string16& app_id) {
|
||||
base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui;
|
||||
HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI);
|
||||
if (FAILED(hr))
|
||||
return false;
|
||||
hr = aarui->LaunchAdvancedAssociationUI(app_id.c_str());
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
// Returns true if the current install's |chrome_exe| has been registered with
|
||||
// |suffix|.
|
||||
// |confirmation_level| is the level of verification desired as described in
|
||||
|
@ -21,6 +21,7 @@ using base::TimeTicks;
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_POSIX)
|
||||
// Returns the executable name of the current Chrome helper process.
|
||||
std::vector<base::FilePath::StringType> GetRunningHelperExecutableNames() {
|
||||
base::FilePath::StringType name = chrome::kHelperProcessExecutableName;
|
||||
@ -43,6 +44,7 @@ std::vector<base::FilePath::StringType> GetRunningHelperExecutableNames() {
|
||||
|
||||
return names;
|
||||
}
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -18,14 +18,12 @@ namespace browser_watcher {
|
||||
|
||||
namespace {
|
||||
|
||||
void CompileAsserts() {
|
||||
// Process ID APIs on Windows talk in DWORDs, whereas for string formatting
|
||||
// and parsing, this code uses int. In practice there are no process IDs with
|
||||
// the high bit set on Windows, so there's no danger of overflow if this is
|
||||
// done consistently.
|
||||
static_assert(sizeof(DWORD) == sizeof(int),
|
||||
"process ids are expected to be no larger than int");
|
||||
}
|
||||
// Process ID APIs on Windows talk in DWORDs, whereas for string formatting
|
||||
// and parsing, this code uses int. In practice there are no process IDs with
|
||||
// the high bit set on Windows, so there's no danger of overflow if this is
|
||||
// done consistently.
|
||||
static_assert(sizeof(DWORD) == sizeof(int),
|
||||
"process ids are expected to be no larger than int");
|
||||
|
||||
// This function does soft matching on the PID recorded in the key only.
|
||||
// Due to PID reuse, the possibility exists that the process that's now live
|
||||
|
@ -287,6 +287,7 @@ long WINAPI ServiceExceptionFilter(EXCEPTION_POINTERS* info) {
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
#if !defined(COMPONENT_BUILD)
|
||||
// Installed via base::debug::SetCrashKeyReportingFunctions.
|
||||
void SetCrashKeyValueForBaseDebug(const base::StringPiece& key,
|
||||
const base::StringPiece& value) {
|
||||
@ -300,6 +301,7 @@ void ClearCrashKeyForBaseDebug(const base::StringPiece& key) {
|
||||
DCHECK(CrashKeysWin::keeper());
|
||||
CrashKeysWin::keeper()->ClearCrashKeyValue(base::UTF8ToUTF16(key));
|
||||
}
|
||||
#endif // !defined(COMPONENT_BUILD)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -197,23 +197,6 @@ void CommonSubprocessInit(const std::string& process_type) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Only needed on Windows for creating stats tables.
|
||||
#if defined(OS_WIN)
|
||||
static base::ProcessId GetBrowserPid(const base::CommandLine& command_line) {
|
||||
base::ProcessId browser_pid = base::GetCurrentProcId();
|
||||
if (command_line.HasSwitch(switches::kProcessChannelID)) {
|
||||
std::string channel_name =
|
||||
command_line.GetSwitchValueASCII(switches::kProcessChannelID);
|
||||
|
||||
int browser_pid_int;
|
||||
base::StringToInt(channel_name, &browser_pid_int);
|
||||
browser_pid = static_cast<base::ProcessId>(browser_pid_int);
|
||||
DCHECK_NE(browser_pid_int, 0);
|
||||
}
|
||||
return browser_pid;
|
||||
}
|
||||
#endif
|
||||
|
||||
class ContentClientInitializer {
|
||||
public:
|
||||
static void Set(const std::string& process_type,
|
||||
|
@ -107,7 +107,8 @@ void NotifyPluginsOfActivation() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
|
||||
#if defined(OS_POSIX)
|
||||
#if !defined(OS_OPENBSD) && !defined(OS_ANDROID)
|
||||
void NotifyPluginDirChanged(const base::FilePath& path, bool error) {
|
||||
if (error) {
|
||||
// TODO(pastarmovj): Add some sensible error handling. Maybe silently
|
||||
@ -123,13 +124,14 @@ void NotifyPluginDirChanged(const base::FilePath& path, bool error) {
|
||||
base::Bind(&PluginService::PurgePluginListCache,
|
||||
static_cast<BrowserContext*>(NULL), false));
|
||||
}
|
||||
#endif
|
||||
#endif // !defined(OS_OPENBSD) && !defined(OS_ANDROID)
|
||||
|
||||
void ForwardCallback(base::SingleThreadTaskRunner* target_task_runner,
|
||||
const PluginService::GetPluginsCallback& callback,
|
||||
const std::vector<WebPluginInfo>& plugins) {
|
||||
target_task_runner->PostTask(FROM_HERE, base::Bind(callback, plugins));
|
||||
}
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -121,6 +121,7 @@ const wchar_t* const kTroublesomeDlls[] = {
|
||||
L"winstylerthemehelper.dll" // Tuneup utilities 2006.
|
||||
};
|
||||
|
||||
#if !defined(NACL_WIN64)
|
||||
// Adds the policy rules for the path and path\ with the semantic |access|.
|
||||
// If |children| is set to true, we need to add the wildcard rules to also
|
||||
// apply the rule to the subfiles and subfolders.
|
||||
@ -152,26 +153,7 @@ bool AddDirectory(int path, const wchar_t* sub_dir, bool children,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Adds the policy rules for the path and path\* with the semantic |access|.
|
||||
// We need to add the wildcard rules to also apply the rule to the subkeys.
|
||||
bool AddKeyAndSubkeys(std::wstring key,
|
||||
sandbox::TargetPolicy::Semantics access,
|
||||
sandbox::TargetPolicy* policy) {
|
||||
sandbox::ResultCode result;
|
||||
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_REGISTRY, access,
|
||||
key.c_str());
|
||||
if (result != sandbox::SBOX_ALL_OK)
|
||||
return false;
|
||||
|
||||
key += L"\\*";
|
||||
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_REGISTRY, access,
|
||||
key.c_str());
|
||||
if (result != sandbox::SBOX_ALL_OK)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // !defined(NACL_WIN64)
|
||||
|
||||
// Compares the loaded |module| file name matches |module_name|.
|
||||
bool IsExpandedModuleName(HMODULE module, const wchar_t* module_name) {
|
||||
|
@ -609,13 +609,13 @@ void WebPluginDelegateProxy::ResetWindowlessBitmaps() {
|
||||
front_buffer_diff_ = gfx::Rect();
|
||||
}
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
static size_t BitmapSizeForPluginRect(const gfx::Rect& plugin_rect) {
|
||||
const size_t stride =
|
||||
skia::PlatformCanvasStrideForWidth(plugin_rect.width());
|
||||
return stride * plugin_rect.height();
|
||||
}
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
bool WebPluginDelegateProxy::CreateLocalBitmap(
|
||||
std::vector<uint8>* memory,
|
||||
scoped_ptr<skia::PlatformCanvas>* canvas) {
|
||||
|
@ -41,17 +41,6 @@ void SkiaPreCacheFont(const LOGFONT& logfont) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkiaPreCacheFontCharacters(const LOGFONT& logfont,
|
||||
const wchar_t* text,
|
||||
unsigned int text_length) {
|
||||
RenderThreadImpl* render_thread_impl = RenderThreadImpl::current();
|
||||
if (render_thread_impl) {
|
||||
render_thread_impl->PreCacheFontCharacters(
|
||||
logfont,
|
||||
base::string16(text, text_length));
|
||||
}
|
||||
}
|
||||
|
||||
void WarmupDirectWrite() {
|
||||
// The objects used here are intentionally not freed as we want the Skia
|
||||
// code to use these objects after warmup.
|
||||
|
@ -522,20 +522,6 @@ HRESULT OpenBluetoothLowEnergyDevices(ScopedDeviceInfoSetHandle* handle) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Opens a Device Info Set that can be used to enumerate Bluetooth LE devices
|
||||
// exposing a service GUID.
|
||||
HRESULT OpenBluetoothLowEnergyService(const GUID& service_guid,
|
||||
ScopedDeviceInfoSetHandle* handle) {
|
||||
ScopedDeviceInfoSetHandle result(SetupDiGetClassDevs(
|
||||
&service_guid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE));
|
||||
if (!result.IsValid()) {
|
||||
return HRESULT_FROM_WIN32(::GetLastError());
|
||||
}
|
||||
|
||||
(*handle) = result.Pass();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace device {
|
||||
|
@ -51,18 +51,6 @@ enum DisplayLinkInstallationStatus {
|
||||
DISPLAY_LINK_INSTALLATION_STATUS_MAX
|
||||
};
|
||||
|
||||
float ReadXMLFloatValue(XmlReader* reader) {
|
||||
std::string score_string;
|
||||
if (!reader->ReadElementContent(&score_string))
|
||||
return 0.0;
|
||||
|
||||
double score;
|
||||
if (!base::StringToDouble(score_string, &score))
|
||||
return 0.0;
|
||||
|
||||
return static_cast<float>(score);
|
||||
}
|
||||
|
||||
// Returns the display link driver version or an invalid version if it is
|
||||
// not installed.
|
||||
Version DisplayLinkVersion() {
|
||||
|
@ -35,18 +35,6 @@ typedef crypto::ScopedCAPIHandle<
|
||||
crypto::CAPIDestroyerWithFlags<HCERTSTORE,
|
||||
CertCloseStore, 0> > ScopedHCERTSTORE;
|
||||
|
||||
void ExplodedTimeToSystemTime(const base::Time::Exploded& exploded,
|
||||
SYSTEMTIME* system_time) {
|
||||
system_time->wYear = static_cast<WORD>(exploded.year);
|
||||
system_time->wMonth = static_cast<WORD>(exploded.month);
|
||||
system_time->wDayOfWeek = static_cast<WORD>(exploded.day_of_week);
|
||||
system_time->wDay = static_cast<WORD>(exploded.day_of_month);
|
||||
system_time->wHour = static_cast<WORD>(exploded.hour);
|
||||
system_time->wMinute = static_cast<WORD>(exploded.minute);
|
||||
system_time->wSecond = static_cast<WORD>(exploded.second);
|
||||
system_time->wMilliseconds = static_cast<WORD>(exploded.millisecond);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO
|
||||
|
@ -22,6 +22,7 @@ namespace {
|
||||
// Size of the uint64 hash_key number in Hex format in a string.
|
||||
const size_t kEntryHashKeyAsHexStringSize = 2 * sizeof(uint64);
|
||||
|
||||
#if defined(OS_POSIX)
|
||||
// TODO(clamy, gavinp): this should go in base
|
||||
bool GetNanoSecsFromStat(const struct stat& st,
|
||||
time_t* out_sec,
|
||||
@ -42,6 +43,7 @@ bool GetNanoSecsFromStat(const struct stat& st,
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -494,6 +494,7 @@ void FillLargeHeadersString(std::string* str, int size) {
|
||||
str->append(row, sizeof_row);
|
||||
}
|
||||
|
||||
#if defined(NTLM_PORTABLE)
|
||||
// Alternative functions that eliminate randomness and dependency on the local
|
||||
// host name so that the generated NTLM messages are reproducible.
|
||||
void MockGenerateRandom1(uint8* output, size_t n) {
|
||||
@ -522,6 +523,7 @@ void MockGenerateRandom2(uint8* output, size_t n) {
|
||||
std::string MockGetHostName() {
|
||||
return "WTC-WIN7";
|
||||
}
|
||||
#endif // defined(NTLM_PORTABLE)
|
||||
|
||||
template<typename ParentPool>
|
||||
class CaptureGroupNameSocketPool : public ParentPool {
|
||||
@ -641,6 +643,7 @@ bool CheckDigestServerAuth(const AuthChallengeInfo* auth_challenge) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(NTLM_PORTABLE)
|
||||
bool CheckNTLMServerAuth(const AuthChallengeInfo* auth_challenge) {
|
||||
if (!auth_challenge)
|
||||
return false;
|
||||
@ -650,6 +653,7 @@ bool CheckNTLMServerAuth(const AuthChallengeInfo* auth_challenge) {
|
||||
EXPECT_EQ("ntlm", auth_challenge->scheme);
|
||||
return true;
|
||||
}
|
||||
#endif // defined(NTLM_PORTABLE)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -127,6 +127,7 @@ int32_t ReadToArrayEntireFile(PP_Instance instance,
|
||||
return PP_OK;
|
||||
}
|
||||
|
||||
#if !defined(PPAPI_OS_WIN)
|
||||
bool ReadEntireFileFromFileHandle(int fd, std::string* data) {
|
||||
if (lseek(fd, 0, SEEK_SET) < 0)
|
||||
return false;
|
||||
@ -141,6 +142,7 @@ bool ReadEntireFileFromFileHandle(int fd, std::string* data) {
|
||||
} while (ret > 0);
|
||||
return ret == 0;
|
||||
}
|
||||
#endif // !defined(PPAPI_OS_WIN)
|
||||
|
||||
int32_t WriteEntireBuffer(PP_Instance instance,
|
||||
pp::FileIO* file_io,
|
||||
|
@ -25,10 +25,6 @@ void SimpleModifyWorldTransform(HDC context,
|
||||
DCHECK_NE(res, 0);
|
||||
}
|
||||
|
||||
void DrawRect(HDC context, gfx::Rect rect) {
|
||||
Rectangle(context, rect.x(), rect.y(), rect.right(), rect.bottom());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace printing {
|
||||
|
@ -265,17 +265,6 @@ void InvokeCompletionCallback(
|
||||
done.Run(async_result);
|
||||
}
|
||||
|
||||
bool SetConfig(const std::string& config) {
|
||||
// Determine the config directory path and create it if necessary.
|
||||
base::FilePath config_dir = remoting::GetConfigDir();
|
||||
if (!base::CreateDirectory(config_dir)) {
|
||||
PLOG(ERROR) << "Failed to create the config directory.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return WriteConfig(config);
|
||||
}
|
||||
|
||||
bool StartDaemon() {
|
||||
DWORD access = SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS |
|
||||
SERVICE_START | SERVICE_STOP;
|
||||
|
@ -14,16 +14,13 @@
|
||||
#include "sandbox/win/src/internal_types.h"
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Increases |value| until there is no need for padding given an int64
|
||||
// alignment. Returns the increased value.
|
||||
uint32 Align(uint32 value) {
|
||||
inline uint32 Align(uint32 value) {
|
||||
uint32 alignment = sizeof(int64);
|
||||
return ((value + alignment - 1) / alignment) * alignment;
|
||||
}
|
||||
|
||||
}
|
||||
// This header is part of CrossCall: the sandbox inter-process communication.
|
||||
// This header defines the basic types used both in the client IPC and in the
|
||||
// server IPC code. CrossCallParams and ActualCallParams model the input
|
||||
|
@ -39,6 +39,7 @@ bool CheckWin8DepPolicy() {
|
||||
return policy.Enable && policy.Permanent;
|
||||
}
|
||||
|
||||
#if defined(NDEBUG)
|
||||
bool CheckWin8AslrPolicy() {
|
||||
PROCESS_MITIGATION_ASLR_POLICY policy = {};
|
||||
if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessASLRPolicy,
|
||||
@ -47,6 +48,7 @@ bool CheckWin8AslrPolicy() {
|
||||
}
|
||||
return policy.EnableForceRelocateImages && policy.DisallowStrippedImages;
|
||||
}
|
||||
#endif // defined(NDEBUG)
|
||||
|
||||
bool CheckWin8StrictHandlePolicy() {
|
||||
PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY policy = {};
|
||||
|
@ -306,14 +306,6 @@ scoped_ptr<base::Value> AsValue(const SkRegion& region) {
|
||||
return val.Pass();
|
||||
}
|
||||
|
||||
WARN_UNUSED_RESULT
|
||||
scoped_ptr<base::Value> AsValue(const SkPicture& picture) {
|
||||
scoped_ptr<base::DictionaryValue> val(new base::DictionaryValue());
|
||||
val->Set("cull-rect", AsValue(picture.cullRect()));
|
||||
|
||||
return val.Pass();
|
||||
}
|
||||
|
||||
WARN_UNUSED_RESULT
|
||||
scoped_ptr<base::Value> AsValue(const SkBitmap& bitmap) {
|
||||
scoped_ptr<base::DictionaryValue> val(new base::DictionaryValue());
|
||||
|
@ -63,7 +63,7 @@ bool VerifyRect(const PlatformCanvas& canvas,
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
#if !defined(USE_AURA) && !defined(OS_MACOSX)
|
||||
// Return true if canvas has something that passes for a rounded-corner
|
||||
// rectangle. Basically, we're just checking to make sure that the pixels in the
|
||||
// middle are of rect_color and pixels in the corners are of canvas_color.
|
||||
@ -100,10 +100,12 @@ bool VerifyBlackRect(const PlatformCanvas& canvas, int x, int y, int w, int h) {
|
||||
return VerifyRect(canvas, SK_ColorWHITE, SK_ColorBLACK, x, y, w, h);
|
||||
}
|
||||
|
||||
#if !defined(USE_AURA) // http://crbug.com/154358
|
||||
// Check that every pixel in the canvas is a single color.
|
||||
bool VerifyCanvasColor(const PlatformCanvas& canvas, uint32_t canvas_color) {
|
||||
return VerifyRect(canvas, canvas_color, 0, 0, 0, 0, 0);
|
||||
}
|
||||
#endif // !defined(USE_AURA)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
|
||||
@ -208,7 +210,6 @@ TEST(PlatformCanvas, SkLayer) {
|
||||
}
|
||||
|
||||
#if !defined(USE_AURA) // http://crbug.com/154358
|
||||
|
||||
// Test native clipping.
|
||||
TEST(PlatformCanvas, ClipRegion) {
|
||||
// Initialize a white canvas
|
||||
@ -233,7 +234,6 @@ TEST(PlatformCanvas, ClipRegion) {
|
||||
}
|
||||
EXPECT_TRUE(VerifyCanvasColor(*canvas, SK_ColorWHITE));
|
||||
}
|
||||
|
||||
#endif // !defined(USE_AURA)
|
||||
|
||||
// Test the layers get filled properly by native rendering.
|
||||
|
@ -148,19 +148,6 @@ bool FillKeyboardInput(ui::KeyboardCode key, INPUT* input, bool key_up) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Send a key event (up/down)
|
||||
bool SendKeyEvent(ui::KeyboardCode key, bool up) {
|
||||
INPUT input = { 0 };
|
||||
|
||||
if (!FillKeyboardInput(key, &input, up))
|
||||
return false;
|
||||
|
||||
if (!::SendInput(1, &input, sizeof(INPUT)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace ui_controls {
|
||||
|
@ -21,20 +21,6 @@ void CheckIfFailed(HRESULT hr) {
|
||||
DVLOG(0) << "Direct3D call failed, hr = " << hr;
|
||||
}
|
||||
|
||||
// TODO(ananta)
|
||||
// This function does not return the correct value as the IDisplayProperties
|
||||
// interface does not work correctly in Windows 8 in metro mode. Needs
|
||||
// more investigation.
|
||||
float GetLogicalDpi() {
|
||||
mswr::ComPtr<wingfx::Display::IDisplayPropertiesStatics> display_properties;
|
||||
CheckIfFailed(winrt_utils::CreateActivationFactory(
|
||||
RuntimeClass_Windows_Graphics_Display_DisplayProperties,
|
||||
display_properties.GetAddressOf()));
|
||||
float dpi = 0.0;
|
||||
CheckIfFailed(display_properties->get_LogicalDpi(&dpi));
|
||||
return dpi;
|
||||
}
|
||||
|
||||
float ConvertDipsToPixels(float dips) {
|
||||
return floor(dips * gfx::GetDPIScale() + 0.5f);
|
||||
}
|
||||
|
Reference in New Issue
Block a user