mac: Prepare for -Wunused-functions.
Mostly involves deleting hundreds of lines of unused code. BUG=315884 R=akalin@chromium.org, brettw@chromium.org, fischman@chromium.org, jamesr@chromium.org, sky@chromium.org, thestig@chromium.org TBR=piman, youngki Review URL: https://codereview.chromium.org/63153003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233646 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
base/time
cc
chrome/browser
devtools
extensions
google_apis
managed_mode
metrics
password_manager
policy
renderer_host
pepper
search_engines
signin
storage_monitor
task_manager
themes
ui
app_list
cocoa
webui
usb
components/autofill/core/browser
content
browser
download
renderer_host
child
common
renderer
device/bluetooth
gpu/command_buffer
media
net
cert
cookies
disk_cache
simple
spdy
tools/gn
ui
webkit/common/cursors
@ -28,6 +28,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
// Define a system-specific SysTime that wraps either to a time_t or
|
||||
// a time64_t depending on the host system, and associated convertion.
|
||||
// See crbug.com/162007
|
||||
@ -66,7 +67,6 @@ void SysTimeToTimeStruct(SysTime t, struct tm* timestruct, bool is_local) {
|
||||
}
|
||||
#endif // OS_ANDROID
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
// Helper function to get results from clock_gettime() as TimeTicks object.
|
||||
// Minimum requirement is MONOTONIC_CLOCK to be supported on the system.
|
||||
// FreeBSD 6 has CLOCK_MONOTONIC but defines _POSIX_MONOTONIC_CLOCK to -1.
|
||||
|
@ -788,16 +788,6 @@ inline float PositiveRatio(float float1, float float2) {
|
||||
return float1 > float2 ? float1 / float2 : float2 / float1;
|
||||
}
|
||||
|
||||
inline bool IsCloserToThan(
|
||||
PictureLayerTiling* layer1,
|
||||
PictureLayerTiling* layer2,
|
||||
float contents_scale) {
|
||||
// Absolute value for ratios.
|
||||
float ratio1 = PositiveRatio(layer1->contents_scale(), contents_scale);
|
||||
float ratio2 = PositiveRatio(layer2->contents_scale(), contents_scale);
|
||||
return ratio1 < ratio2;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
|
||||
|
@ -18,14 +18,6 @@ struct Range {
|
||||
float end_;
|
||||
};
|
||||
|
||||
inline bool Intersects(const Range& a, const Range& b) {
|
||||
return a.start_ < b.end_ && b.start_ < a.end_;
|
||||
}
|
||||
|
||||
inline Range Intersect(const Range& a, const Range& b) {
|
||||
return Range(std::max(a.start_, b.start_), std::min(a.end_, b.end_));
|
||||
}
|
||||
|
||||
bool Range::IsEmpty() {
|
||||
return start_ >= end_;
|
||||
}
|
||||
|
@ -76,30 +76,12 @@ void BnFree(uint32* a) {
|
||||
delete[] a;
|
||||
}
|
||||
|
||||
void BnPrint(const std::string& title, uint32_t* a) {
|
||||
int i = kBigIntSize - 1;
|
||||
fprintf(stderr, "%s: ", title.c_str());
|
||||
while (!a[i]) --i;
|
||||
for (; i >= 0; --i)
|
||||
fprintf(stderr, "%08x", a[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
uint32* BnCopy(uint32* a) {
|
||||
uint32* result = new uint32[kBigIntSize];
|
||||
memcpy(result, a, kBigIntSize * sizeof(uint32));
|
||||
return result;
|
||||
}
|
||||
|
||||
void BnAdd(uint32* a, uint32* b) {
|
||||
uint64 carry_over = 0;
|
||||
for (size_t i = 0; i < kBigIntSize; ++i) {
|
||||
carry_over += static_cast<uint64>(a[i]) + b[i];
|
||||
a[i] = carry_over & kuint32max;
|
||||
carry_over >>= 32;
|
||||
}
|
||||
}
|
||||
|
||||
uint32* BnMul(uint32* a, uint32 b) {
|
||||
uint32* result = BnNew();
|
||||
uint64 carry_over = 0;
|
||||
|
@ -125,18 +125,6 @@ GURL ToDataURL(const base::FilePath& path, developer_private::ItemType type) {
|
||||
return GetImageURLFromData(contents);
|
||||
}
|
||||
|
||||
std::vector<base::FilePath> ListFolder(const base::FilePath path) {
|
||||
base::FileEnumerator files(path, false,
|
||||
base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES);
|
||||
std::vector<base::FilePath> paths;
|
||||
|
||||
for (base::FilePath current_path = files.Next(); !current_path.empty();
|
||||
current_path = files.Next()) {
|
||||
paths.push_back(current_path);
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
bool ValidateFolderName(const base::FilePath::StringType& name) {
|
||||
base::FilePath::StringType name_sanitized(name);
|
||||
file_util::ReplaceIllegalCharactersInPath(&name_sanitized, '_');
|
||||
|
@ -30,20 +30,6 @@ using extensions::Extension;
|
||||
using extensions::ExtensionIdList;
|
||||
using extensions::ExtensionList;
|
||||
|
||||
namespace {
|
||||
|
||||
// Returns true if an |extension| is in an |extension_list|.
|
||||
bool IsInExtensionList(const Extension* extension,
|
||||
const extensions::ExtensionList& extension_list) {
|
||||
for (size_t i = 0; i < extension_list.size(); i++) {
|
||||
if (extension_list[i].get() == extension)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool ExtensionToolbarModel::Observer::BrowserActionShowPopup(
|
||||
const extensions::Extension* extension) {
|
||||
return false;
|
||||
|
@ -33,12 +33,6 @@ GURL AddResumableUploadParam(const GURL& url) {
|
||||
return net::AppendOrReplaceQueryParameter(url, "uploadType", "resumable");
|
||||
}
|
||||
|
||||
GURL AddMaxResultParam(const GURL& url, int max_results) {
|
||||
DCHECK_GT(max_results, 0);
|
||||
return net::AppendOrReplaceQueryParameter(
|
||||
url, "maxResults", base::IntToString(max_results));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
DriveApiUrlGenerator::DriveApiUrlGenerator(const GURL& base_url,
|
||||
|
@ -59,8 +59,6 @@ using base::DictionaryValue;
|
||||
using base::Value;
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
|
||||
const char kManagedModeFinchActive[] = "Active";
|
||||
const char kManagedModeFinchName[] = "ManagedModeLaunch";
|
||||
const char kManagedUserAccessRequestKeyPrefix[] =
|
||||
@ -72,19 +70,6 @@ const char kSwitchFromManagedProfileKeyPrefix[] =
|
||||
"X-ManagedUser-Events-SwitchProfile";
|
||||
const char kEventTimestamp[] = "timestamp";
|
||||
|
||||
std::string CanonicalizeHostname(const std::string& hostname) {
|
||||
std::string canonicalized;
|
||||
url_canon::StdStringCanonOutput output(&canonicalized);
|
||||
url_parse::Component in_comp(0, hostname.length());
|
||||
url_parse::Component out_comp;
|
||||
|
||||
url_canon::CanonicalizeHost(hostname.c_str(), in_comp, &output, &out_comp);
|
||||
output.Complete();
|
||||
return canonicalized;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ManagedUserService::URLFilterContext::URLFilterContext()
|
||||
: ui_url_filter_(new ManagedModeURLFilter),
|
||||
io_url_filter_(new ManagedModeURLFilter) {}
|
||||
|
@ -39,9 +39,11 @@ namespace {
|
||||
MSVC_DISABLE_OPTIMIZE()
|
||||
MSVC_PUSH_DISABLE_WARNING(4748)
|
||||
|
||||
#ifndef NDEBUG
|
||||
int* NullPointer() {
|
||||
return reinterpret_cast<int*>(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
void NullPointerCrash(int line_number) {
|
||||
#ifndef NDEBUG
|
||||
|
@ -108,11 +108,6 @@ std::string GetPlatformString() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Converts |date_time| in Study date format to base::Time.
|
||||
base::Time ConvertStudyDateToBaseTime(int64 date_time) {
|
||||
return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(date_time);
|
||||
}
|
||||
|
||||
// Gets the restrict parameter from |local_state| or from Chrome OS settings in
|
||||
// the case of that platform.
|
||||
std::string GetRestrictParameterPref(PrefService* local_state) {
|
||||
|
@ -11,74 +11,6 @@
|
||||
#include "net/base/escape.h"
|
||||
#include "sync/api/sync_error_factory.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Converts the |PasswordSpecifics| obtained from sync to an
|
||||
// object of type |PasswordForm|.
|
||||
void ExtractPasswordFromSpecifics(
|
||||
const sync_pb::PasswordSpecificsData& password,
|
||||
autofill::PasswordForm* new_password) {
|
||||
new_password->scheme =
|
||||
static_cast<autofill::PasswordForm::Scheme>(password.scheme());
|
||||
new_password->signon_realm = password.signon_realm();
|
||||
new_password->origin = GURL(password.origin());
|
||||
new_password->action = GURL(password.action());
|
||||
new_password->username_element =
|
||||
UTF8ToUTF16(password.username_element());
|
||||
new_password->password_element =
|
||||
UTF8ToUTF16(password.password_element());
|
||||
new_password->username_value =
|
||||
UTF8ToUTF16(password.username_value());
|
||||
new_password->password_value =
|
||||
UTF8ToUTF16(password.password_value());
|
||||
new_password->ssl_valid = password.ssl_valid();
|
||||
new_password->preferred = password.preferred();
|
||||
new_password->date_created =
|
||||
base::Time::FromInternalValue(password.date_created());
|
||||
new_password->blacklisted_by_user =
|
||||
password.blacklisted();
|
||||
}
|
||||
|
||||
// Merges the sync password (obtained from the password specifics) and
|
||||
// local password and stores the output in the |new_password_form| pointer.
|
||||
bool MergeLocalAndSyncPasswords(
|
||||
const sync_pb::PasswordSpecificsData& password_specifics,
|
||||
const autofill::PasswordForm& password_form,
|
||||
autofill::PasswordForm* new_password_form) {
|
||||
if (password_specifics.scheme() == password_form.scheme &&
|
||||
password_form.signon_realm == password_specifics.signon_realm() &&
|
||||
password_form.origin.spec() == password_specifics.origin() &&
|
||||
password_form.action.spec() == password_specifics.action() &&
|
||||
UTF16ToUTF8(password_form.username_element) ==
|
||||
password_specifics.username_element() &&
|
||||
UTF16ToUTF8(password_form.password_element) ==
|
||||
password_specifics.password_element() &&
|
||||
UTF16ToUTF8(password_form.username_value) ==
|
||||
password_specifics.username_value() &&
|
||||
UTF16ToUTF8(password_form.password_value) ==
|
||||
password_specifics.password_value() &&
|
||||
password_specifics.ssl_valid() == password_form.ssl_valid &&
|
||||
password_specifics.preferred() == password_form.preferred &&
|
||||
password_specifics.date_created() ==
|
||||
password_form.date_created.ToInternalValue() &&
|
||||
password_specifics.blacklisted() ==
|
||||
password_form.blacklisted_by_user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the passwords differ, take the one that was created more recently.
|
||||
if (base::Time::FromInternalValue(password_specifics.date_created()) <=
|
||||
password_form.date_created) {
|
||||
*new_password_form = password_form;
|
||||
} else {
|
||||
ExtractPasswordFromSpecifics(password_specifics, new_password_form);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
PasswordSyncableService::PasswordSyncableService(
|
||||
scoped_refptr<PasswordStore> password_store)
|
||||
: password_store_(password_store) {
|
||||
|
@ -108,6 +108,7 @@ EnterpriseInstallAttributes* g_testing_install_attributes = NULL;
|
||||
// Used in BrowserPolicyConnector::SetPolicyProviderForTesting.
|
||||
ConfigurationPolicyProvider* g_testing_provider = NULL;
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
// Helper that returns a new SequencedTaskRunner backed by the blocking pool.
|
||||
// Each SequencedTaskRunner returned is independent from the others.
|
||||
scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() {
|
||||
@ -116,6 +117,7 @@ scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() {
|
||||
return pool->GetSequencedTaskRunnerWithShutdownBehavior(
|
||||
pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
|
||||
}
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
|
||||
#if defined(OS_MACOSX) && !defined(OS_IOS)
|
||||
base::FilePath GetManagedPolicyPath() {
|
||||
|
@ -81,10 +81,12 @@ ppapi::host::ReplyMessageContext GetPermissionOnUIThread(
|
||||
return reply;
|
||||
}
|
||||
|
||||
#if defined(USE_ASH) && defined(OS_CHROMEOS)
|
||||
void OnTerminateRemotingEventOnUIThread(const base::Closure& stop_callback) {
|
||||
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
|
||||
stop_callback);
|
||||
}
|
||||
#endif // defined(USE_ASH) && defined(OS_CHROMEOS)
|
||||
|
||||
ppapi::host::ReplyMessageContext StartRemotingOnUIThread(
|
||||
const base::Closure& stop_callback,
|
||||
|
@ -232,33 +232,6 @@ void LogDuplicatesHistogram(
|
||||
UMA_HISTOGRAM_COUNTS_100("Search.SearchEngineDuplicateCounts", num_dupes);
|
||||
}
|
||||
|
||||
typedef std::vector<TemplateURLService::ExtensionKeyword> ExtensionKeywords;
|
||||
|
||||
#if !defined(OS_ANDROID)
|
||||
// Extract all installed Omnibox Extensions.
|
||||
ExtensionKeywords GetExtensionKeywords(Profile* profile) {
|
||||
DCHECK(profile);
|
||||
ExtensionService* extension_service = profile->GetExtensionService();
|
||||
DCHECK(extension_service);
|
||||
const ExtensionSet* extensions = extension_service->extensions();
|
||||
ExtensionKeywords extension_keywords;
|
||||
for (ExtensionSet::const_iterator it = extensions->begin();
|
||||
it != extensions->end(); ++it) {
|
||||
const std::string& keyword = extensions::OmniboxInfo::GetKeyword(*it);
|
||||
if (!keyword.empty()) {
|
||||
extension_keywords.push_back(TemplateURLService::ExtensionKeyword(
|
||||
(*it)->id(), (*it)->name(), keyword));
|
||||
}
|
||||
}
|
||||
return extension_keywords;
|
||||
}
|
||||
#else
|
||||
// Extensions are not supported.
|
||||
ExtensionKeywords GetExtensionKeywords(Profile* profile) {
|
||||
return ExtensionKeywords();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
|
@ -117,17 +117,6 @@ void AddSectionEntry(ListValue* section_list,
|
||||
}
|
||||
|
||||
|
||||
void AddSectionEntry(ListValue* section_list,
|
||||
const std::string& field_name,
|
||||
uint32 field_val) {
|
||||
std::stringstream ss;
|
||||
ss << field_val;
|
||||
scoped_ptr<DictionaryValue> entry(new DictionaryValue());
|
||||
entry->SetString("label", field_name);
|
||||
entry->SetString("value", ss.str());
|
||||
section_list->Append(entry.release());
|
||||
}
|
||||
|
||||
// Returns a string describing the chrome version environment. Version format:
|
||||
// <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel">
|
||||
// If version information is unavailable, returns "invalid."
|
||||
|
@ -37,14 +37,6 @@ enum DeviceInfoHistogramBuckets {
|
||||
const char kRootPath[] = "/";
|
||||
#endif
|
||||
|
||||
void ValidatePathOnFileThread(
|
||||
const base::FilePath& path,
|
||||
const base::Callback<void(bool)>& callback) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(callback, base::PathExists(path)));
|
||||
}
|
||||
|
||||
typedef std::vector<StorageInfo> StorageInfoList;
|
||||
|
||||
base::FilePath::StringType FindRemovableStorageLocationById(
|
||||
|
@ -154,23 +154,6 @@ void GetWinUSERHandles(base::ProcessHandle process,
|
||||
}
|
||||
#endif
|
||||
|
||||
// Counts the number of extension background pages associated with this profile.
|
||||
int CountExtensionBackgroundPagesForProfile(Profile* profile) {
|
||||
int count = 0;
|
||||
ExtensionProcessManager* manager =
|
||||
extensions::ExtensionSystem::Get(profile)->process_manager();
|
||||
if (!manager)
|
||||
return count;
|
||||
|
||||
const ExtensionProcessManager::ExtensionHostSet& background_hosts =
|
||||
manager->background_hosts();
|
||||
for (ExtensionProcessManager::const_iterator iter = background_hosts.begin();
|
||||
iter != background_hosts.end(); ++iter) {
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class TaskManagerModelGpuDataManagerObserver
|
||||
|
@ -60,10 +60,6 @@ const char* kDefaultThemeGalleryID = "hkacjpbfdknhflllbcmjibkdeoafencn";
|
||||
// ExtensionService::GarbageCollectExtensions() does something similar.
|
||||
const int kRemoveUnusedThemesStartupDelay = 30;
|
||||
|
||||
SkColor TintForUnderline(SkColor input) {
|
||||
return SkColorSetA(input, SkColorGetA(input) / 3);
|
||||
}
|
||||
|
||||
SkColor IncreaseLightness(SkColor color, double percent) {
|
||||
color_utils::HSL result;
|
||||
color_utils::SkColorToHSL(color, &result);
|
||||
|
@ -151,13 +151,6 @@ void CreateAppListShim(const base::FilePath& profile_path) {
|
||||
kShortcutVersion);
|
||||
}
|
||||
|
||||
void CreateShortcutsInDefaultLocation(
|
||||
const ShellIntegration::ShortcutInfo& shortcut_info) {
|
||||
web_app::CreateShortcuts(shortcut_info,
|
||||
ShellIntegration::ShortcutLocations(),
|
||||
web_app::SHORTCUT_CREATION_BY_USER);
|
||||
}
|
||||
|
||||
NSRunningApplication* ActiveApplicationNotChrome() {
|
||||
NSArray* applications = [[NSWorkspace sharedWorkspace] runningApplications];
|
||||
for (NSRunningApplication* application in applications) {
|
||||
|
@ -34,14 +34,6 @@ const CGFloat kWindowMinWidth = 500;
|
||||
const CGFloat kButtonGap = 6;
|
||||
const CGFloat kDialogAlertBarBorderWidth = 1;
|
||||
|
||||
// Shift the origin of |view|'s frame by the given amount in the
|
||||
// positive y direction (up).
|
||||
void ShiftOriginY(NSView* view, CGFloat amount) {
|
||||
NSPoint origin = [view frame].origin;
|
||||
origin.y += amount;
|
||||
[view setFrameOrigin:origin];
|
||||
}
|
||||
|
||||
// Determine the frame required to fit the content of a string. Uses the
|
||||
// provided height and width as preferred dimensions, where a value of
|
||||
// 0.0 indicates no preference.
|
||||
@ -128,24 +120,6 @@ NSTextField* AddTextField(
|
||||
return textField;
|
||||
}
|
||||
|
||||
// Create a new link button and add it to the specified parent.
|
||||
NSButton* AddLinkButton(
|
||||
NSView* parent,
|
||||
const string16& message,
|
||||
id target,
|
||||
SEL selector) {
|
||||
NSButton* button =
|
||||
[HyperlinkButtonCell buttonWithString:SysUTF16ToNSString(message)];
|
||||
[button setTarget:target];
|
||||
[button setAction:selector];
|
||||
HyperlinkButtonCell* cell = [button cell];
|
||||
cell.textColor =
|
||||
gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
|
||||
cell.shouldUnderline = NO;
|
||||
[parent addSubview:button];
|
||||
return button;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@interface ProfileSigninConfirmationViewController ()
|
||||
|
@ -217,20 +217,6 @@ void normalizeMonths(base::Time::Exploded* exploded) {
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the URL of a query result value.
|
||||
bool GetResultTimeAndUrl(Value* result, base::Time* time, string16* url) {
|
||||
DictionaryValue* result_dict;
|
||||
double timestamp;
|
||||
|
||||
if (result->GetAsDictionary(&result_dict) &&
|
||||
result_dict->GetDouble("time", ×tamp) &&
|
||||
result_dict->GetString("url", url)) {
|
||||
*time = base::Time::FromJsTime(timestamp);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns true if |entry| represents a local visit that had no corresponding
|
||||
// visit on the server.
|
||||
bool IsLocalOnlyResult(const BrowsingHistoryHandler::HistoryEntry& entry) {
|
||||
|
@ -62,20 +62,6 @@ bool GetProfilePathFromArgs(const ListValue* args,
|
||||
return base::GetValueAsFilePath(*file_path_value, profile_file_path);
|
||||
}
|
||||
|
||||
void OnNewDefaultProfileCreated(
|
||||
chrome::HostDesktopType desktop_type,
|
||||
Profile* profile,
|
||||
Profile::CreateStatus status) {
|
||||
if (status == Profile::CREATE_STATUS_INITIALIZED) {
|
||||
profiles::FindOrCreateNewWindowForProfile(
|
||||
profile,
|
||||
chrome::startup::IS_PROCESS_STARTUP,
|
||||
chrome::startup::IS_FIRST_RUN,
|
||||
desktop_type,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ManageProfileHandler::ManageProfileHandler()
|
||||
|
@ -22,12 +22,14 @@ using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
void OnRequestUsbAccessReplied(
|
||||
const base::Callback<void(bool success)>& callback,
|
||||
bool success) {
|
||||
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
||||
base::Bind(callback, success));
|
||||
}
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -166,16 +166,6 @@ void DeterminePossibleFieldTypesForUpload(
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true if server returned known field types to one or more fields in
|
||||
// this form.
|
||||
bool HasServerSpecifiedFieldTypes(const FormStructure& form_structure) {
|
||||
for (size_t i = 0; i < form_structure.field_count(); ++i) {
|
||||
if (form_structure.field(i)->server_type() != NO_SERVER_DATA)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
AutofillManager::AutofillManager(
|
||||
|
@ -157,13 +157,6 @@ class MapValueIteratorAdapter {
|
||||
// Allow copy and assign.
|
||||
};
|
||||
|
||||
void EnsureNoPendingDownloadJobsOnFile(bool* result) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
||||
*result = (DownloadFile::GetNumberOfDownloadFiles() == 0);
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE, base::MessageLoop::QuitClosure());
|
||||
}
|
||||
|
||||
class DownloadItemFactoryImpl : public DownloadItemFactory {
|
||||
public:
|
||||
DownloadItemFactoryImpl() {}
|
||||
|
@ -29,6 +29,7 @@ namespace content {
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_WIN) || defined(USE_AURA)
|
||||
bool ShouldSendPinchGesture() {
|
||||
static bool pinch_allowed =
|
||||
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePinch);
|
||||
@ -42,6 +43,7 @@ blink::WebGestureEvent CreateFlingCancelEvent(double time_stamp) {
|
||||
gesture_event.sourceDevice = blink::WebGestureEvent::Touchscreen;
|
||||
return gesture_event;
|
||||
}
|
||||
#endif // defined(OS_WIN) || defined(USE_AURA)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -131,15 +131,6 @@ static NSString* const NSBackingPropertyOldScaleFactorKey =
|
||||
|
||||
#endif // 10.7
|
||||
|
||||
static inline int ToWebKitModifiers(NSUInteger flags) {
|
||||
int modifiers = 0;
|
||||
if (flags & NSControlKeyMask) modifiers |= WebInputEvent::ControlKey;
|
||||
if (flags & NSShiftKeyMask) modifiers |= WebInputEvent::ShiftKey;
|
||||
if (flags & NSAlternateKeyMask) modifiers |= WebInputEvent::AltKey;
|
||||
if (flags & NSCommandKeyMask) modifiers |= WebInputEvent::MetaKey;
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
// This method will return YES for OS X versions 10.7.3 and later, and NO
|
||||
// otherwise.
|
||||
// Used to prevent a crash when building with the 10.7 SDK and accessing the
|
||||
|
@ -39,9 +39,6 @@ namespace {
|
||||
IndexedDBDispatcher* const kHasBeenDeleted =
|
||||
reinterpret_cast<IndexedDBDispatcher*>(0x1);
|
||||
|
||||
int32 CurrentWorkerId() {
|
||||
return WorkerTaskRunner::Instance()->CurrentWorkerId();
|
||||
}
|
||||
} // unnamed namespace
|
||||
|
||||
const size_t kMaxIDBValueSizeInBytes = 64 * 1024 * 1024;
|
||||
|
@ -19,56 +19,6 @@
|
||||
|
||||
namespace content {
|
||||
|
||||
namespace {
|
||||
|
||||
// Returns an autoreleased NSEvent constructed from the given np_event,
|
||||
// targeting the given window.
|
||||
NSEvent* NSEventForNPCocoaEvent(NPCocoaEvent* np_event, NSWindow* window) {
|
||||
bool mouse_down = 1;
|
||||
switch (np_event->type) {
|
||||
case NPCocoaEventMouseDown:
|
||||
mouse_down = 1;
|
||||
break;
|
||||
case NPCocoaEventMouseUp:
|
||||
mouse_down = 0;
|
||||
break;
|
||||
default:
|
||||
// If plugins start bringing up context menus for things other than
|
||||
// clicks, this will need more plumbing; for now just log it and proceed
|
||||
// as if it were a mouse down.
|
||||
NOTREACHED();
|
||||
}
|
||||
NSEventType event_type = NSLeftMouseDown;
|
||||
switch (np_event->data.mouse.buttonNumber) {
|
||||
case 0:
|
||||
event_type = mouse_down ? NSLeftMouseDown : NSLeftMouseUp;
|
||||
break;
|
||||
case 1:
|
||||
event_type = mouse_down ? NSRightMouseDown : NSRightMouseUp;
|
||||
break;
|
||||
default:
|
||||
event_type = mouse_down ? NSOtherMouseDown : NSOtherMouseUp;
|
||||
break;
|
||||
}
|
||||
|
||||
NSInteger click_count = np_event->data.mouse.clickCount;
|
||||
NSInteger modifiers = np_event->data.mouse.modifierFlags;
|
||||
// NPCocoaEvent doesn't have a timestamp, so just use the current time.
|
||||
NSEvent* event =
|
||||
[NSEvent mouseEventWithType:event_type
|
||||
location:NSZeroPoint
|
||||
modifierFlags:modifiers
|
||||
timestamp:[[NSApp currentEvent] timestamp]
|
||||
windowNumber:[window windowNumber]
|
||||
context:[NSGraphicsContext currentContext]
|
||||
eventNumber:0
|
||||
clickCount:click_count
|
||||
pressure:1.0];
|
||||
return event;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
NPError PluginInstance::PopUpContextMenu(NPMenu* menu) {
|
||||
if (!currently_handled_event_)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
@ -158,21 +158,6 @@ void HistogramCountNotBlockedResponse(const std::string& bucket_prefix,
|
||||
IncrementHistogramCount(bucket_prefix + ".NotBlocked.MaybeJS");
|
||||
}
|
||||
|
||||
void HistogramCountPolicyDecision(
|
||||
const std::string& bucket_prefix,
|
||||
bool sniffed_as_document,
|
||||
bool sniffed_as_js,
|
||||
const SiteIsolationPolicy::ResponseMetaData& resp_data) {
|
||||
if (sniffed_as_document) {
|
||||
HistogramCountBlockedResponse(bucket_prefix, resp_data, false);
|
||||
} else {
|
||||
if (resp_data.no_sniff)
|
||||
HistogramCountBlockedResponse(bucket_prefix, resp_data, true);
|
||||
else
|
||||
HistogramCountNotBlockedResponse(bucket_prefix, sniffed_as_js);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
SiteIsolationPolicy::ResponseMetaData::ResponseMetaData() {}
|
||||
|
@ -50,12 +50,6 @@ typedef std::multimap<GpuChannelHost*, WebGraphicsContext3DCommandBufferImpl*>
|
||||
static base::LazyInstance<ContextMap> g_all_shared_contexts =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
size_t ClampUint64ToSizeT(uint64 value) {
|
||||
value = std::min(value,
|
||||
static_cast<uint64>(std::numeric_limits<size_t>::max()));
|
||||
return static_cast<size_t>(value);
|
||||
}
|
||||
|
||||
uint32_t GenFlushID() {
|
||||
static base::subtle::Atomic32 flush_id = 0;
|
||||
|
||||
|
@ -666,14 +666,6 @@ bool WebPluginDelegateProxy::CreateSharedBitmap(
|
||||
return !!canvas->get();
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// Flips |rect| vertically within an enclosing rect with height |height|.
|
||||
// Intended for converting rects between flipped and non-flipped contexts.
|
||||
static void FlipRectVerticallyWithHeight(gfx::Rect* rect, int height) {
|
||||
rect->set_y(height - rect->bottom());
|
||||
}
|
||||
#endif
|
||||
|
||||
void WebPluginDelegateProxy::Paint(SkCanvas* canvas,
|
||||
const gfx::Rect& damaged_rect) {
|
||||
// Limit the damaged rectangle to whatever is contained inside the plugin
|
||||
|
@ -42,6 +42,7 @@ typedef std::vector<BluetoothAdapterFactory::AdapterCallback>
|
||||
base::LazyInstance<AdapterCallbackList> adapter_callbacks =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
void RunAdapterCallbacks() {
|
||||
CHECK(default_adapter.Get().get());
|
||||
scoped_refptr<BluetoothAdapter> adapter(default_adapter.Get().get());
|
||||
@ -53,6 +54,7 @@ void RunAdapterCallbacks() {
|
||||
}
|
||||
adapter_callbacks.Get().clear();
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -91,11 +91,6 @@ base::LazyInstance<base::Lock> g_all_shared_contexts_lock =
|
||||
base::LazyInstance<std::set<GLInProcessContextImpl*> > g_all_shared_contexts =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
size_t SharedContextCount() {
|
||||
base::AutoLock lock(g_all_shared_contexts_lock.Get());
|
||||
return g_all_shared_contexts.Get().size();
|
||||
}
|
||||
|
||||
GLInProcessContextImpl::GLInProcessContextImpl()
|
||||
: share_group_id_(0), context_lost_(false) {}
|
||||
|
||||
|
@ -68,21 +68,6 @@ int ShaderTypeToIndex(GLenum shader_type) {
|
||||
}
|
||||
}
|
||||
|
||||
ShaderTranslator* ShaderIndexToTranslator(
|
||||
int index,
|
||||
ShaderTranslator* vertex_translator,
|
||||
ShaderTranslator* fragment_translator) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return vertex_translator;
|
||||
case 1:
|
||||
return fragment_translator;
|
||||
default:
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Given a name like "foo.bar[123].moo[456]" sets new_name to "foo.bar[123].moo"
|
||||
// and sets element_index to 456. returns false if element expression was not a
|
||||
// whole decimal number. For example: "foo[1b2]"
|
||||
|
@ -16,19 +16,6 @@
|
||||
|
||||
namespace media {
|
||||
|
||||
static std::ostream& operator<<(std::ostream& os,
|
||||
const AudioStreamBasicDescription& format) {
|
||||
os << "sample rate : " << format.mSampleRate << std::endl
|
||||
<< "format ID : " << format.mFormatID << std::endl
|
||||
<< "format flags : " << format.mFormatFlags << std::endl
|
||||
<< "bytes per packet : " << format.mBytesPerPacket << std::endl
|
||||
<< "frames per packet : " << format.mFramesPerPacket << std::endl
|
||||
<< "bytes per frame : " << format.mBytesPerFrame << std::endl
|
||||
<< "channels per frame: " << format.mChannelsPerFrame << std::endl
|
||||
<< "bits per channel : " << format.mBitsPerChannel;
|
||||
return os;
|
||||
}
|
||||
|
||||
static void ZeroBufferList(AudioBufferList* buffer_list) {
|
||||
for (size_t i = 0; i < buffer_list->mNumberBuffers; ++i) {
|
||||
memset(buffer_list->mBuffers[i].mData,
|
||||
|
@ -32,15 +32,6 @@ static uint16 ReadLE16(const uint8* data, size_t data_size, int read_offset) {
|
||||
return base::ByteSwapToLE16(value);
|
||||
}
|
||||
|
||||
// Returns true if the decode result was end of stream.
|
||||
static inline bool IsEndOfStream(int decoded_size,
|
||||
const scoped_refptr<DecoderBuffer>& input) {
|
||||
// Two conditions to meet to declare end of stream for this decoder:
|
||||
// 1. Opus didn't output anything.
|
||||
// 2. An end of stream buffer is received.
|
||||
return decoded_size == 0 && input->end_of_stream();
|
||||
}
|
||||
|
||||
static int TimeDeltaToAudioFrames(base::TimeDelta time_delta,
|
||||
int frame_rate) {
|
||||
return std::ceil(time_delta.InSecondsF() * frame_rate);
|
||||
|
@ -169,22 +169,6 @@ bool ConvertSignatureAlgorithm(
|
||||
return true;
|
||||
}
|
||||
|
||||
// Checks and converts a log entry type.
|
||||
// |in| the numeric representation of the log type.
|
||||
// If the log type is 0 (X.509 cert) or 1 (PreCertificate), fills in |out| and
|
||||
// returns true. Otherwise, returns false.
|
||||
bool ConvertLogEntryType(int in, LogEntry::Type* out) {
|
||||
switch (in) {
|
||||
case LogEntry::LOG_ENTRY_TYPE_X509:
|
||||
case LogEntry::LOG_ENTRY_TYPE_PRECERT:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
*out = static_cast<LogEntry::Type>(in);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Writes a TLS-encoded variable length unsigned integer to |output|.
|
||||
// |length| indicates the size (in bytes) of the integer.
|
||||
// |value| the value itself to be written.
|
||||
|
@ -206,60 +206,6 @@ struct CSSMOIDString {
|
||||
|
||||
typedef std::vector<CSSMOIDString> CSSMOIDStringVector;
|
||||
|
||||
bool CERTNameToCSSMOIDVector(CERTName* name, CSSMOIDStringVector* out_values) {
|
||||
struct OIDCSSMMap {
|
||||
SECOidTag sec_OID_;
|
||||
const CSSM_OID* cssm_OID_;
|
||||
};
|
||||
|
||||
const OIDCSSMMap kOIDs[] = {
|
||||
{ SEC_OID_AVA_COMMON_NAME, &CSSMOID_CommonName },
|
||||
{ SEC_OID_AVA_COUNTRY_NAME, &CSSMOID_CountryName },
|
||||
{ SEC_OID_AVA_LOCALITY, &CSSMOID_LocalityName },
|
||||
{ SEC_OID_AVA_STATE_OR_PROVINCE, &CSSMOID_StateProvinceName },
|
||||
{ SEC_OID_AVA_STREET_ADDRESS, &CSSMOID_StreetAddress },
|
||||
{ SEC_OID_AVA_ORGANIZATION_NAME, &CSSMOID_OrganizationName },
|
||||
{ SEC_OID_AVA_ORGANIZATIONAL_UNIT_NAME, &CSSMOID_OrganizationalUnitName },
|
||||
{ SEC_OID_AVA_DN_QUALIFIER, &CSSMOID_DNQualifier },
|
||||
{ SEC_OID_RFC1274_UID, &CSSMOID_UniqueIdentifier },
|
||||
{ SEC_OID_PKCS9_EMAIL_ADDRESS, &CSSMOID_EmailAddress },
|
||||
};
|
||||
|
||||
CERTRDN** rdns = name->rdns;
|
||||
for (size_t rdn = 0; rdns[rdn]; ++rdn) {
|
||||
CERTAVA** avas = rdns[rdn]->avas;
|
||||
for (size_t pair = 0; avas[pair] != 0; ++pair) {
|
||||
SECOidTag tag = CERT_GetAVATag(avas[pair]);
|
||||
if (tag == SEC_OID_UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
CSSMOIDString oidString;
|
||||
bool found_oid = false;
|
||||
for (size_t oid = 0; oid < ARRAYSIZE_UNSAFE(kOIDs); ++oid) {
|
||||
if (kOIDs[oid].sec_OID_ == tag) {
|
||||
SECItem* decode_item = CERT_DecodeAVAValue(&avas[pair]->value);
|
||||
if (!decode_item)
|
||||
return false;
|
||||
|
||||
// TODO(wtc): Pass decode_item to CERT_RFC1485_EscapeAndQuote.
|
||||
std::string value(reinterpret_cast<char*>(decode_item->data),
|
||||
decode_item->len);
|
||||
oidString.oid_ = kOIDs[oid].cssm_OID_;
|
||||
oidString.string_ = value;
|
||||
out_values->push_back(oidString);
|
||||
SECITEM_FreeItem(decode_item, PR_TRUE);
|
||||
found_oid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found_oid) {
|
||||
DLOG(ERROR) << "Unrecognized OID: " << tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class ScopedCertName {
|
||||
public:
|
||||
explicit ScopedCertName(CERTName* name) : name_(name) { }
|
||||
|
@ -201,16 +201,6 @@ struct CookieSignature {
|
||||
std::string path;
|
||||
};
|
||||
|
||||
// Determine the cookie domain to use for setting the specified cookie.
|
||||
bool GetCookieDomain(const GURL& url,
|
||||
const ParsedCookie& pc,
|
||||
std::string* result) {
|
||||
std::string domain_string;
|
||||
if (pc.HasDomain())
|
||||
domain_string = pc.Domain();
|
||||
return cookie_util::GetCookieDomainWithString(url, domain_string, result);
|
||||
}
|
||||
|
||||
// For a CookieItVector iterator range [|it_begin|, |it_end|),
|
||||
// sorts the first |num_sort| + 1 elements by LastAccessDate().
|
||||
// The + 1 element exists so for any interval of length <= |num_sort| starting
|
||||
|
@ -123,16 +123,6 @@ void MaybeHistogramFdLimit(net::CacheType cache_type) {
|
||||
g_fd_limit_histogram_has_been_populated = true;
|
||||
}
|
||||
|
||||
// Must run on IO Thread.
|
||||
void DeleteBackendImpl(disk_cache::Backend** backend,
|
||||
const net::CompletionCallback& callback,
|
||||
int result) {
|
||||
DCHECK(*backend);
|
||||
delete *backend;
|
||||
*backend = NULL;
|
||||
callback.Run(result);
|
||||
}
|
||||
|
||||
// Detects if the files in the cache directory match the current disk cache
|
||||
// backend type and version. If the directory contains no cache, occupies it
|
||||
// with the fresh structure.
|
||||
@ -195,23 +185,6 @@ void RunOperationAndCallback(
|
||||
operation_callback.Run(operation_result);
|
||||
}
|
||||
|
||||
// A short bindable thunk that Dooms an entry if it successfully opens.
|
||||
void DoomOpenedEntry(scoped_ptr<Entry*> in_entry,
|
||||
const net::CompletionCallback& doom_callback,
|
||||
int open_result) {
|
||||
DCHECK_NE(open_result, net::ERR_IO_PENDING);
|
||||
if (open_result == net::OK) {
|
||||
DCHECK(in_entry);
|
||||
SimpleEntryImpl* simple_entry = static_cast<SimpleEntryImpl*>(*in_entry);
|
||||
const int doom_result = simple_entry->DoomEntry(doom_callback);
|
||||
simple_entry->Close();
|
||||
if (doom_result != net::ERR_IO_PENDING)
|
||||
doom_callback.Run(doom_result);
|
||||
} else {
|
||||
doom_callback.Run(open_result);
|
||||
}
|
||||
}
|
||||
|
||||
void RecordIndexLoad(net::CacheType cache_type,
|
||||
base::TimeTicks constructed_since,
|
||||
int result) {
|
||||
|
@ -110,15 +110,6 @@ base::Value* NetLogSpdySynReplyOrHeadersReceivedCallback(
|
||||
return dict;
|
||||
}
|
||||
|
||||
base::Value* NetLogSpdyCredentialCallback(size_t slot,
|
||||
const std::string* origin,
|
||||
NetLog::LogLevel /* log_level */) {
|
||||
base::DictionaryValue* dict = new base::DictionaryValue();
|
||||
dict->SetInteger("slot", slot);
|
||||
dict->SetString("origin", *origin);
|
||||
return dict;
|
||||
}
|
||||
|
||||
base::Value* NetLogSpdySessionCloseCallback(int net_error,
|
||||
const std::string* description,
|
||||
NetLog::LogLevel /* log_level */) {
|
||||
|
@ -19,34 +19,6 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// Returns the "first bit" of some script output for writing to error messages.
|
||||
std::string GetExampleOfBadInput(const std::string& input) {
|
||||
std::string result(input);
|
||||
|
||||
// Maybe the result starts with a blank line or something, which we don't
|
||||
// want.
|
||||
TrimWhitespaceASCII(result, TRIM_ALL, &result);
|
||||
|
||||
// Now take the first line, or the first set of chars, whichever is shorter.
|
||||
bool trimmed = false;
|
||||
size_t newline_offset = result.find('\n');
|
||||
if (newline_offset != std::string::npos) {
|
||||
trimmed = true;
|
||||
result.resize(newline_offset);
|
||||
}
|
||||
TrimWhitespaceASCII(result, TRIM_ALL, &result);
|
||||
|
||||
const size_t kMaxSize = 50;
|
||||
if (result.size() > kMaxSize) {
|
||||
trimmed = true;
|
||||
result.resize(kMaxSize);
|
||||
}
|
||||
|
||||
if (trimmed)
|
||||
result.append("...");
|
||||
return result;
|
||||
}
|
||||
|
||||
// When parsing the result as a value, we may get various types of errors.
|
||||
// This creates an error message for this case with an optional nested error
|
||||
// message to reference. If there is no nested err, pass Err().
|
||||
|
@ -18,17 +18,6 @@
|
||||
// else := 'else' (if | statement)*
|
||||
// assignment := ident {'=' | '+=' | '-='} expr
|
||||
|
||||
namespace {
|
||||
|
||||
// Returns true if the two tokens are on the same line. We assume they're in
|
||||
// the same file.
|
||||
bool IsSameLine(const Token& a, const Token& b) {
|
||||
DCHECK(a.location().file() == b.location().file());
|
||||
return a.location().line_number() == b.location().line_number();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
enum Precedence {
|
||||
PRECEDENCE_ASSIGNMENT = 1,
|
||||
PRECEDENCE_OR = 2,
|
||||
|
@ -99,6 +99,7 @@ base::FilePath FindDotFile(const base::FilePath& current_dir) {
|
||||
return FindDotFile(up_one_dir);
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Searches the list of strings, and returns the FilePat corresponding to the
|
||||
// one ending in the given substring, or the empty path if none match.
|
||||
base::FilePath GetPathEndingIn(
|
||||
@ -111,13 +112,12 @@ base::FilePath GetPathEndingIn(
|
||||
return base::FilePath();
|
||||
}
|
||||
|
||||
// Fins the depot tools directory in the path environment variable and returns
|
||||
// Finds the depot tools directory in the path environment variable and returns
|
||||
// its value. Returns an empty file path if not found.
|
||||
//
|
||||
// We detect the depot_tools path by looking for a directory with depot_tools
|
||||
// at the end (optionally followed by a separator).
|
||||
base::FilePath ExtractDepotToolsFromPath() {
|
||||
#if defined(OS_WIN)
|
||||
static const wchar_t kPathVarName[] = L"Path";
|
||||
DWORD env_buf_size = GetEnvironmentVariable(kPathVarName, NULL, 0);
|
||||
if (env_buf_size == 0)
|
||||
@ -132,17 +132,6 @@ base::FilePath ExtractDepotToolsFromPath() {
|
||||
base::SplitString(path, ';', &components);
|
||||
|
||||
base::string16 ending_in1 = L"depot_tools\\";
|
||||
#else
|
||||
static const char kPathVarName[] = "PATH";
|
||||
const char* path = getenv(kPathVarName);
|
||||
if (!path)
|
||||
return base::FilePath();
|
||||
|
||||
std::vector<std::string> components;
|
||||
base::SplitString(path, ':', &components);
|
||||
|
||||
std::string ending_in1 = "depot_tools/";
|
||||
#endif
|
||||
base::FilePath::StringType ending_in2 = FILE_PATH_LITERAL("depot_tools");
|
||||
|
||||
base::FilePath found = GetPathEndingIn(components, ending_in1);
|
||||
@ -150,6 +139,7 @@ base::FilePath ExtractDepotToolsFromPath() {
|
||||
return found;
|
||||
return GetPathEndingIn(components, ending_in2);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -44,17 +44,6 @@ base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) {
|
||||
#endif
|
||||
}
|
||||
|
||||
gfx::Point CalibratePoint(const gfx::Point& point,
|
||||
const gfx::Size& from,
|
||||
const gfx::Size& to) {
|
||||
float calibrated_x =
|
||||
static_cast<float>(point.x()) * to.width() / from.width();
|
||||
float calibrated_y =
|
||||
static_cast<float>(point.y()) * to.height() / from.height();
|
||||
return gfx::Point(static_cast<int>(floorf(calibrated_x + 0.5f)),
|
||||
static_cast<int>(floorf(calibrated_y + 0.5f)));
|
||||
}
|
||||
|
||||
std::string EventTypeName(ui::EventType type) {
|
||||
#define RETURN_IF_TYPE(t) if (type == ui::t) return #t
|
||||
#define CASE_TYPE(t) case ui::t: return #t
|
||||
|
@ -20,6 +20,7 @@ namespace gfx {
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// If necessary, wraps |text| with RTL/LTR directionality characters based on
|
||||
// |flags| and |text| content.
|
||||
// Returns true if the text will be rendered right-to-left.
|
||||
@ -52,6 +53,7 @@ bool AdjustStringDirection(int flags, base::string16* text) {
|
||||
// locales it will be handled by the if statement above).
|
||||
return false;
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
// Checks each pixel immediately adjacent to the given pixel in the bitmap. If
|
||||
// any of them are not the halo color, returns true. This defines the halo of
|
||||
|
@ -22,10 +22,6 @@ bool IsMultipleOfNinetyDegrees(double degrees) {
|
||||
return remainder < EPSILON || 90.0 - remainder < EPSILON;
|
||||
}
|
||||
|
||||
bool IsApproximatelyZero(double value) {
|
||||
return fabs(value) < EPSILON;
|
||||
}
|
||||
|
||||
// Returns false if |degrees| is not a multiple of ninety degrees or if
|
||||
// |rotation| is NULL. It does not affect |rotation| in this case. Otherwise
|
||||
// *rotation is set to be the appropriate sanitized rotation matrix. That is,
|
||||
|
@ -138,39 +138,6 @@ NSCursor* GetCoreCursorWithFallback(CrCoreCursorType type,
|
||||
return LoadCursor(resource_id, hotspot_x, hotspot_y);
|
||||
}
|
||||
|
||||
// TODO(avi): When Skia becomes default, fold this function into the remaining
|
||||
// caller, InitFromCursor().
|
||||
CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data,
|
||||
const gfx::Size& custom_size) {
|
||||
// If the data is missing, leave the backing transparent.
|
||||
void* data = NULL;
|
||||
if (!custom_data.empty()) {
|
||||
// This is safe since we're not going to draw into the context we're
|
||||
// creating.
|
||||
data = const_cast<char*>(&custom_data[0]);
|
||||
}
|
||||
|
||||
// If the size is empty, use a 1x1 transparent image.
|
||||
gfx::Size size = custom_size;
|
||||
if (size.IsEmpty()) {
|
||||
size.SetSize(1, 1);
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
base::ScopedCFTypeRef<CGColorSpaceRef> cg_color(
|
||||
CGColorSpaceCreateDeviceRGB());
|
||||
// The settings here match SetCustomData() below; keep in sync.
|
||||
base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate(
|
||||
data,
|
||||
size.width(),
|
||||
size.height(),
|
||||
8,
|
||||
size.width() * 4,
|
||||
cg_color.get(),
|
||||
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big));
|
||||
return CGBitmapContextCreateImage(context.get());
|
||||
}
|
||||
|
||||
NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
|
||||
const gfx::Size& custom_size,
|
||||
float custom_scale,
|
||||
|
Reference in New Issue
Block a user