mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 961760: Remove a bunch of unused Chromium IPC code. r=bent
This commit is contained in:
parent
c0b5e30210
commit
0f751b3e18
@ -1,26 +0,0 @@
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_FILE_VERSION_INFO_LINUX_H_
|
||||
#define BASE_FILE_VERSION_INFO_LINUX_H_
|
||||
|
||||
#define COMPANY_NAME L"@COMPANY_FULLNAME@"
|
||||
#define FILE_DESCRIPTION L"@PRODUCT_FULLNAME@"
|
||||
#define FILE_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
|
||||
#define LEGAL_COPYRIGHT L"@COPYRIGHT@"
|
||||
#define PRODUCT_NAME L"@PRODUCT_FULLNAME@"
|
||||
#define PRODUCT_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
|
||||
#define COMPANY_SHORT_NAME L"@COMPANY_SHORTNAME@"
|
||||
#define PRODUCT_SHORT_NAME L"@PRODUCT_SHORTNAME@"
|
||||
#define LAST_CHANGE L"@LASTCHANGE@"
|
||||
#define OFFICIAL_BUILD 1
|
||||
// TODO(mmoss) Do these have values for Linux?
|
||||
#define INTERNAL_NAME L""
|
||||
#define ORIGINAL_FILENAME L""
|
||||
#define PRIVATE_BUILD L""
|
||||
#define SPECIAL_BUILD L""
|
||||
#define COMMENTS L""
|
||||
#define LEGAL_TRADEMARKS L""
|
||||
|
||||
#endif // BASE_FILE_VERSION_INFO_LINUX_H_
|
@ -73,8 +73,6 @@ UNIFIED_SOURCES += [
|
||||
'src/chrome/common/child_process_host.cc',
|
||||
'src/chrome/common/child_process_info.cc',
|
||||
'src/chrome/common/child_thread.cc',
|
||||
'src/chrome/common/chrome_counters.cc',
|
||||
'src/chrome/common/chrome_paths.cc',
|
||||
'src/chrome/common/chrome_switches.cc',
|
||||
'src/chrome/common/debug_flags.cc',
|
||||
'src/chrome/common/env_vars.cc',
|
||||
@ -96,7 +94,6 @@ if os_win:
|
||||
'src/base/debug_util_win.cc',
|
||||
'src/base/event_recorder.cc',
|
||||
'src/base/file_util_win.cc',
|
||||
'src/base/file_version_info.cc',
|
||||
'src/base/idle_timer.cc',
|
||||
'src/base/lock_impl_win.cc',
|
||||
'src/base/message_pump_win.cc',
|
||||
@ -117,8 +114,6 @@ if os_win:
|
||||
'src/base/waitable_event_watcher_win.cc',
|
||||
'src/base/waitable_event_win.cc',
|
||||
'src/base/win_util.cc',
|
||||
'src/chrome/common/chrome_constants.cc',
|
||||
'src/chrome/common/chrome_paths_win.cc',
|
||||
'src/chrome/common/ipc_channel_win.cc',
|
||||
'src/chrome/common/process_watcher_win.cc',
|
||||
'src/chrome/common/transport_dib_win.cc',
|
||||
@ -195,7 +190,6 @@ if os_macosx:
|
||||
'src/base/base_paths_mac.mm',
|
||||
'src/base/chrome_application_mac.mm',
|
||||
'src/base/file_util_mac.mm',
|
||||
'src/base/file_version_info_mac.mm',
|
||||
'src/base/mac_util.mm',
|
||||
'src/base/message_pump_mac.mm',
|
||||
'src/base/platform_thread_mac.mm',
|
||||
@ -203,7 +197,6 @@ if os_macosx:
|
||||
'src/base/scoped_nsautorelease_pool.mm',
|
||||
'src/base/sys_string_conversions_mac.mm',
|
||||
'src/base/worker_pool_mac.mm',
|
||||
'src/chrome/common/chrome_paths_mac.mm',
|
||||
'src/chrome/common/mach_ipc_mac.mm',
|
||||
]
|
||||
if not CONFIG['MOZ_NATIVE_LIBEVENT']:
|
||||
@ -215,7 +208,6 @@ if os_linux:
|
||||
SOURCES += [
|
||||
'src/base/atomicops_internals_x86_gcc.cc',
|
||||
'src/base/base_paths_linux.cc',
|
||||
'src/base/file_version_info_linux.cc',
|
||||
'src/base/idle_timer_none.cc',
|
||||
'src/base/process_util_linux.cc',
|
||||
'src/base/time_posix.cc',
|
||||
|
@ -1,185 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "base/file_version_info.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
|
||||
// This has to be last.
|
||||
#include <strsafe.h>
|
||||
|
||||
FileVersionInfo::FileVersionInfo(void* data, int language, int code_page)
|
||||
: language_(language), code_page_(code_page) {
|
||||
data_.reset((char*) data);
|
||||
fixed_file_info_ = NULL;
|
||||
UINT size;
|
||||
::VerQueryValue(data_.get(), L"\\", (LPVOID*)&fixed_file_info_, &size);
|
||||
}
|
||||
|
||||
FileVersionInfo::~FileVersionInfo() {
|
||||
DCHECK(data_.get());
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
WORD language;
|
||||
WORD code_page;
|
||||
} LanguageAndCodePage;
|
||||
|
||||
// static
|
||||
FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
|
||||
std::wstring app_path;
|
||||
if (!PathService::Get(base::FILE_MODULE, &app_path))
|
||||
return NULL;
|
||||
|
||||
return CreateFileVersionInfo(app_path);
|
||||
}
|
||||
|
||||
// static
|
||||
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
|
||||
const FilePath& file_path) {
|
||||
DWORD dummy;
|
||||
const wchar_t* path = file_path.value().c_str();
|
||||
DWORD length = ::GetFileVersionInfoSize(path, &dummy);
|
||||
if (length == 0)
|
||||
return NULL;
|
||||
|
||||
void* data = calloc(length, 1);
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
if (!::GetFileVersionInfo(path, dummy, length, data)) {
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LanguageAndCodePage* translate = NULL;
|
||||
uint32_t page_count;
|
||||
BOOL query_result = VerQueryValue(data, L"\\VarFileInfo\\Translation",
|
||||
(void**) &translate, &page_count);
|
||||
|
||||
if (query_result && translate) {
|
||||
return new FileVersionInfo(data, translate->language,
|
||||
translate->code_page);
|
||||
|
||||
} else {
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
|
||||
const std::wstring& file_path) {
|
||||
FilePath file_path_fp = FilePath::FromWStringHack(file_path);
|
||||
return CreateFileVersionInfo(file_path_fp);
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::company_name() {
|
||||
return GetStringValue(L"CompanyName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::company_short_name() {
|
||||
return GetStringValue(L"CompanyShortName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::internal_name() {
|
||||
return GetStringValue(L"InternalName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_name() {
|
||||
return GetStringValue(L"ProductName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_short_name() {
|
||||
return GetStringValue(L"ProductShortName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::comments() {
|
||||
return GetStringValue(L"Comments");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::legal_copyright() {
|
||||
return GetStringValue(L"LegalCopyright");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_version() {
|
||||
return GetStringValue(L"ProductVersion");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::file_description() {
|
||||
return GetStringValue(L"FileDescription");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::legal_trademarks() {
|
||||
return GetStringValue(L"LegalTrademarks");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::private_build() {
|
||||
return GetStringValue(L"PrivateBuild");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::file_version() {
|
||||
return GetStringValue(L"FileVersion");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::original_filename() {
|
||||
return GetStringValue(L"OriginalFilename");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::special_build() {
|
||||
return GetStringValue(L"SpecialBuild");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::last_change() {
|
||||
return GetStringValue(L"LastChange");
|
||||
}
|
||||
|
||||
bool FileVersionInfo::is_official_build() {
|
||||
return (GetStringValue(L"Official Build").compare(L"1") == 0);
|
||||
}
|
||||
|
||||
bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
|
||||
|
||||
WORD lang_codepage[8];
|
||||
int i = 0;
|
||||
// Use the language and codepage from the DLL.
|
||||
lang_codepage[i++] = language_;
|
||||
lang_codepage[i++] = code_page_;
|
||||
// Use the default language and codepage from the DLL.
|
||||
lang_codepage[i++] = ::GetUserDefaultLangID();
|
||||
lang_codepage[i++] = code_page_;
|
||||
// Use the language from the DLL and Latin codepage (most common).
|
||||
lang_codepage[i++] = language_;
|
||||
lang_codepage[i++] = 1252;
|
||||
// Use the default language and Latin codepage (most common).
|
||||
lang_codepage[i++] = ::GetUserDefaultLangID();
|
||||
lang_codepage[i++] = 1252;
|
||||
|
||||
i = 0;
|
||||
while (i < arraysize(lang_codepage)) {
|
||||
wchar_t sub_block[MAX_PATH];
|
||||
WORD language = lang_codepage[i++];
|
||||
WORD code_page = lang_codepage[i++];
|
||||
_snwprintf_s(sub_block, MAX_PATH, MAX_PATH,
|
||||
L"\\StringFileInfo\\%04x%04x\\%ls", language, code_page, name);
|
||||
LPVOID value = NULL;
|
||||
uint32_t size;
|
||||
BOOL r = ::VerQueryValue(data_.get(), sub_block, &value, &size);
|
||||
if (r && value) {
|
||||
value_str->assign(static_cast<wchar_t*>(value));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
|
||||
std::wstring str;
|
||||
if (GetValue(name, &str))
|
||||
return str;
|
||||
else
|
||||
return L"";
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_FILE_VERSION_INFO_H__
|
||||
#define BASE_FILE_VERSION_INFO_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/file_path.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
struct tagVS_FIXEDFILEINFO;
|
||||
typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
|
||||
#elif defined(OS_MACOSX)
|
||||
#ifdef __OBJC__
|
||||
@class NSBundle;
|
||||
#else
|
||||
class NSBundle;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Provides a way to access the version information for a file.
|
||||
// This is the information you access when you select a file in the Windows
|
||||
// explorer, right-click select Properties, then click the Version tab.
|
||||
|
||||
class FileVersionInfo {
|
||||
public:
|
||||
// Creates a FileVersionInfo for the specified path. Returns NULL if something
|
||||
// goes wrong (typically the file does not exit or cannot be opened). The
|
||||
// returned object should be deleted when you are done with it.
|
||||
static FileVersionInfo* CreateFileVersionInfo(const FilePath& file_path);
|
||||
// This version, taking a wstring, is deprecated and only kept around
|
||||
// until we can fix all callers.
|
||||
static FileVersionInfo* CreateFileVersionInfo(const std::wstring& file_path);
|
||||
|
||||
// Creates a FileVersionInfo for the current module. Returns NULL in case
|
||||
// of error. The returned object should be deleted when you are done with it.
|
||||
static FileVersionInfo* CreateFileVersionInfoForCurrentModule();
|
||||
|
||||
~FileVersionInfo();
|
||||
|
||||
// Accessors to the different version properties.
|
||||
// Returns an empty string if the property is not found.
|
||||
std::wstring company_name();
|
||||
std::wstring company_short_name();
|
||||
std::wstring product_name();
|
||||
std::wstring product_short_name();
|
||||
std::wstring internal_name();
|
||||
std::wstring product_version();
|
||||
std::wstring private_build();
|
||||
std::wstring special_build();
|
||||
std::wstring comments();
|
||||
std::wstring original_filename();
|
||||
std::wstring file_description();
|
||||
std::wstring file_version();
|
||||
std::wstring legal_copyright();
|
||||
std::wstring legal_trademarks();
|
||||
std::wstring last_change();
|
||||
bool is_official_build();
|
||||
|
||||
// Lets you access other properties not covered above.
|
||||
bool GetValue(const wchar_t* name, std::wstring* value);
|
||||
|
||||
// Similar to GetValue but returns a wstring (empty string if the property
|
||||
// does not exist).
|
||||
std::wstring GetStringValue(const wchar_t* name);
|
||||
|
||||
#ifdef OS_WIN
|
||||
// Get the fixed file info if it exists. Otherwise NULL
|
||||
VS_FIXEDFILEINFO* fixed_file_info() { return fixed_file_info_; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if defined(OS_WIN)
|
||||
FileVersionInfo(void* data, int language, int code_page);
|
||||
|
||||
scoped_ptr_malloc<char> data_;
|
||||
int language_;
|
||||
int code_page_;
|
||||
// This is a pointer into the data_ if it exists. Otherwise NULL.
|
||||
VS_FIXEDFILEINFO* fixed_file_info_;
|
||||
#elif defined(OS_MACOSX)
|
||||
explicit FileVersionInfo(NSBundle *bundle);
|
||||
|
||||
NSBundle *bundle_;
|
||||
#elif defined(OS_LINUX)
|
||||
FileVersionInfo();
|
||||
#endif
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(FileVersionInfo);
|
||||
};
|
||||
|
||||
#endif // BASE_FILE_VERSION_INFO_H__
|
@ -1,86 +0,0 @@
|
||||
// Copyright (c) 2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/file_version_info.h"
|
||||
#include "base/file_version_info_linux.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
// TODO(mmoss) This only provides version info for the current binary, but it's
|
||||
// also called for arbitrary files (e.g. plugins).
|
||||
// See http://code.google.com/p/chromium/issues/detail?id=8132 for a discussion
|
||||
// on what we should do with this module.
|
||||
|
||||
FileVersionInfo::FileVersionInfo() {}
|
||||
|
||||
FileVersionInfo::~FileVersionInfo() {}
|
||||
|
||||
// static
|
||||
FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
|
||||
return new FileVersionInfo();
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::company_name() {
|
||||
return COMPANY_NAME;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::company_short_name() {
|
||||
return COMPANY_SHORT_NAME;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_name() {
|
||||
return PRODUCT_NAME;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_short_name() {
|
||||
return PRODUCT_SHORT_NAME;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::internal_name() {
|
||||
return INTERNAL_NAME;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_version() {
|
||||
return PRODUCT_VERSION;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::private_build() {
|
||||
return PRIVATE_BUILD;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::special_build() {
|
||||
return SPECIAL_BUILD;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::comments() {
|
||||
return COMMENTS;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::original_filename() {
|
||||
return ORIGINAL_FILENAME;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::file_description() {
|
||||
return FILE_DESCRIPTION;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::file_version() {
|
||||
return FILE_VERSION;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::legal_copyright() {
|
||||
return LEGAL_COPYRIGHT;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::legal_trademarks() {
|
||||
return LEGAL_TRADEMARKS;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::last_change() {
|
||||
return LAST_CHANGE;
|
||||
}
|
||||
|
||||
bool FileVersionInfo::is_official_build() {
|
||||
return OFFICIAL_BUILD;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_FILE_VERSION_INFO_LINUX_H_
|
||||
#define BASE_FILE_VERSION_INFO_LINUX_H_
|
||||
|
||||
#define COMPANY_NAME L"@COMPANY_FULLNAME@"
|
||||
#define FILE_DESCRIPTION L"@PRODUCT_FULLNAME@"
|
||||
#define FILE_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
|
||||
#define LEGAL_COPYRIGHT L"@COPYRIGHT@"
|
||||
#define PRODUCT_NAME L"@PRODUCT_FULLNAME@"
|
||||
#define PRODUCT_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
|
||||
#define COMPANY_SHORT_NAME L"@COMPANY_SHORTNAME@"
|
||||
#define PRODUCT_SHORT_NAME L"@PRODUCT_SHORTNAME@"
|
||||
#define LAST_CHANGE L"@LASTCHANGE@"
|
||||
#define OFFICIAL_BUILD @OFFICIAL_BUILD@
|
||||
// TODO(mmoss) Do these have values for Linux?
|
||||
#define INTERNAL_NAME L""
|
||||
#define ORIGINAL_FILENAME L""
|
||||
#define PRIVATE_BUILD L""
|
||||
#define SPECIAL_BUILD L""
|
||||
#define COMMENTS L""
|
||||
#define LEGAL_TRADEMARKS L""
|
||||
|
||||
#endif // BASE_FILE_VERSION_INFO_LINUX_H_
|
@ -1,131 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/file_version_info.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/string_util.h"
|
||||
|
||||
FileVersionInfo::FileVersionInfo(NSBundle *bundle) : bundle_(bundle) {
|
||||
[bundle_ retain];
|
||||
}
|
||||
|
||||
FileVersionInfo::~FileVersionInfo() {
|
||||
[bundle_ release];
|
||||
}
|
||||
|
||||
// static
|
||||
FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
|
||||
// TODO(erikkay): this should really use bundleForClass, but we don't have
|
||||
// a class to hang onto yet.
|
||||
NSBundle* bundle = [NSBundle mainBundle];
|
||||
return new FileVersionInfo(bundle);
|
||||
}
|
||||
|
||||
// static
|
||||
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
|
||||
const std::wstring& file_path) {
|
||||
NSString* path = [NSString stringWithCString:
|
||||
reinterpret_cast<const char*>(file_path.c_str())
|
||||
encoding:NSUTF32StringEncoding];
|
||||
return new FileVersionInfo([NSBundle bundleWithPath:path]);
|
||||
}
|
||||
|
||||
// static
|
||||
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
|
||||
const FilePath& file_path) {
|
||||
NSString* path = [NSString stringWithUTF8String:file_path.value().c_str()];
|
||||
return new FileVersionInfo([NSBundle bundleWithPath:path]);
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::company_name() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::company_short_name() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::internal_name() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_name() {
|
||||
return GetStringValue(L"CFBundleName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_short_name() {
|
||||
return GetStringValue(L"CFBundleName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::comments() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::legal_copyright() {
|
||||
return GetStringValue(L"CFBundleGetInfoString");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::product_version() {
|
||||
return GetStringValue(L"CFBundleShortVersionString");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::file_description() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::legal_trademarks() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::private_build() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::file_version() {
|
||||
// CFBundleVersion has limitations that may not be honored by a
|
||||
// proper Chromium version number, so try KSVersion first.
|
||||
std::wstring version = GetStringValue(L"KSVersion");
|
||||
if (version == L"")
|
||||
version = GetStringValue(L"CFBundleVersion");
|
||||
return version;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::original_filename() {
|
||||
return GetStringValue(L"CFBundleName");
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::special_build() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::last_change() {
|
||||
return L"";
|
||||
}
|
||||
|
||||
bool FileVersionInfo::is_official_build() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
|
||||
if (bundle_) {
|
||||
NSString* value = [bundle_ objectForInfoDictionaryKey:
|
||||
[NSString stringWithUTF8String:WideToUTF8(name).c_str()]];
|
||||
if (value) {
|
||||
*value_str = reinterpret_cast<const wchar_t*>(
|
||||
[value cStringUsingEncoding:NSUTF32StringEncoding]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
|
||||
std::wstring str;
|
||||
if (GetValue(name, &str))
|
||||
return str;
|
||||
return L"";
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
|
||||
#include "base/file_path.h"
|
||||
|
||||
#define FPL FILE_PATH_LITERAL
|
||||
|
||||
namespace chrome {
|
||||
|
||||
// The following should not be used for UI strings; they are meant
|
||||
// for system strings only. UI changes should be made in the GRD.
|
||||
#if defined(OS_WIN)
|
||||
const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
|
||||
#elif defined(OS_LINUX)
|
||||
const wchar_t kBrowserProcessExecutableName[] = L"chrome";
|
||||
#elif defined(OS_MACOSX)
|
||||
const wchar_t kBrowserProcessExecutableName[] =
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
L"Chrome";
|
||||
#else
|
||||
L"Chromium";
|
||||
#endif // GOOGLE_CHROME_BUILD
|
||||
#endif // OS_*
|
||||
#if defined(OS_WIN)
|
||||
const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe";
|
||||
#elif defined(OS_LINUX)
|
||||
const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
|
||||
#elif defined(OS_MACOSX)
|
||||
const wchar_t kBrowserProcessExecutablePath[] =
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
L"Chrome.app/Contents/MacOS/Chrome";
|
||||
#else
|
||||
L"Chromium.app/Contents/MacOS/Chromium";
|
||||
#endif // GOOGLE_CHROME_BUILD
|
||||
#endif // OS_*
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
const wchar_t kBrowserAppName[] = L"Chrome";
|
||||
const char kStatsFilename[] = "ChromeStats2";
|
||||
#else
|
||||
const wchar_t kBrowserAppName[] = L"Chromium";
|
||||
const char kStatsFilename[] = "ChromiumStats2";
|
||||
#endif
|
||||
const wchar_t kExternalTabWindowClass[] = L"Chrome_ExternalTabContainer";
|
||||
const wchar_t kMessageWindowClass[] = L"Chrome_MessageWindow";
|
||||
const wchar_t kCrashReportLog[] = L"Reported Crashes.txt";
|
||||
const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
|
||||
const wchar_t kNotSignedInProfile[] = L"Default";
|
||||
const wchar_t kNotSignedInID[] = L"not-signed-in";
|
||||
const wchar_t kBrowserResourcesDll[] = L"chrome.dll";
|
||||
const FilePath::CharType kExtensionFileExtension[] = FPL("crx");
|
||||
|
||||
// filenames
|
||||
const FilePath::CharType kArchivedHistoryFilename[] = FPL("Archived History");
|
||||
const FilePath::CharType kCacheDirname[] = FPL("Cache");
|
||||
const FilePath::CharType kMediaCacheDirname[] = FPL("Media Cache");
|
||||
const FilePath::CharType kOffTheRecordMediaCacheDirname[] =
|
||||
FPL("Incognito Media Cache");
|
||||
const wchar_t kChromePluginDataDirname[] = L"Plugin Data";
|
||||
const FilePath::CharType kCookieFilename[] = FPL("Cookies");
|
||||
const FilePath::CharType kHistoryFilename[] = FPL("History");
|
||||
const FilePath::CharType kLocalStateFilename[] = FPL("Local State");
|
||||
const FilePath::CharType kPreferencesFilename[] = FPL("Preferences");
|
||||
const FilePath::CharType kSafeBrowsingFilename[] = FPL("Safe Browsing");
|
||||
// WARNING: SingletonSocket can't contain spaces, because otherwise
|
||||
// chrome_process_util_linux would be broken.
|
||||
const FilePath::CharType kSingletonSocketFilename[] = FPL("SingletonSocket");
|
||||
const FilePath::CharType kThumbnailsFilename[] = FPL("Thumbnails");
|
||||
const wchar_t kUserDataDirname[] = L"User Data";
|
||||
const FilePath::CharType kUserScriptsDirname[] = FPL("User Scripts");
|
||||
const FilePath::CharType kWebDataFilename[] = FPL("Web Data");
|
||||
const FilePath::CharType kBookmarksFileName[] = FPL("Bookmarks");
|
||||
const FilePath::CharType kHistoryBookmarksFileName[] =
|
||||
FPL("Bookmarks From History");
|
||||
const FilePath::CharType kCustomDictionaryFileName[] =
|
||||
FPL("Custom Dictionary.txt");
|
||||
|
||||
// This number used to be limited to 32 in the past (see b/535234).
|
||||
const unsigned int kMaxRendererProcessCount = 42;
|
||||
const int kStatsMaxThreads = 32;
|
||||
const int kStatsMaxCounters = 300;
|
||||
|
||||
// We don't enable record mode in the released product because users could
|
||||
// potentially be tricked into running a product in record mode without
|
||||
// knowing it. Enable in debug builds. Playback mode is allowed always,
|
||||
// because it is useful for testing and not hazardous by itself.
|
||||
#ifndef NDEBUG
|
||||
const bool kRecordModeEnabled = true;
|
||||
#else
|
||||
const bool kRecordModeEnabled = false;
|
||||
#endif
|
||||
|
||||
} // namespace chrome
|
@ -1,55 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// A handful of resource-like constants related to the Chrome application.
|
||||
|
||||
#ifndef CHROME_COMMON_CHROME_CONSTANTS_H_
|
||||
#define CHROME_COMMON_CHROME_CONSTANTS_H_
|
||||
|
||||
#include "base/file_path.h"
|
||||
|
||||
namespace chrome {
|
||||
|
||||
extern const wchar_t kBrowserProcessExecutableName[];
|
||||
extern const wchar_t kBrowserProcessExecutablePath[];
|
||||
extern const wchar_t kBrowserAppName[];
|
||||
extern const wchar_t kMessageWindowClass[];
|
||||
extern const wchar_t kExternalTabWindowClass[];
|
||||
extern const wchar_t kCrashReportLog[];
|
||||
extern const wchar_t kTestingInterfaceDLL[];
|
||||
extern const wchar_t kNotSignedInProfile[];
|
||||
extern const wchar_t kNotSignedInID[];
|
||||
extern const char kStatsFilename[];
|
||||
extern const wchar_t kBrowserResourcesDll[];
|
||||
extern const FilePath::CharType kExtensionFileExtension[];
|
||||
|
||||
// filenames
|
||||
extern const FilePath::CharType kArchivedHistoryFilename[];
|
||||
extern const FilePath::CharType kCacheDirname[];
|
||||
extern const FilePath::CharType kMediaCacheDirname[];
|
||||
extern const FilePath::CharType kOffTheRecordMediaCacheDirname[];
|
||||
extern const wchar_t kChromePluginDataDirname[];
|
||||
extern const FilePath::CharType kCookieFilename[];
|
||||
extern const FilePath::CharType kHistoryFilename[];
|
||||
extern const FilePath::CharType kLocalStateFilename[];
|
||||
extern const FilePath::CharType kPreferencesFilename[];
|
||||
extern const FilePath::CharType kSafeBrowsingFilename[];
|
||||
extern const FilePath::CharType kSingletonSocketFilename[];
|
||||
extern const FilePath::CharType kThumbnailsFilename[];
|
||||
extern const wchar_t kUserDataDirname[];
|
||||
extern const FilePath::CharType kUserScriptsDirname[];
|
||||
extern const FilePath::CharType kWebDataFilename[];
|
||||
extern const FilePath::CharType kBookmarksFileName[];
|
||||
extern const FilePath::CharType kHistoryBookmarksFileName[];
|
||||
extern const FilePath::CharType kCustomDictionaryFileName[];
|
||||
|
||||
extern const unsigned int kMaxRendererProcessCount;
|
||||
extern const int kStatsMaxThreads;
|
||||
extern const int kStatsMaxCounters;
|
||||
|
||||
extern const bool kRecordModeEnabled;
|
||||
|
||||
} // namespace chrome
|
||||
|
||||
#endif // CHROME_COMMON_CHROME_CONSTANTS_H_
|
@ -1,57 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/common/chrome_counters.h"
|
||||
|
||||
#include "base/stats_counters.h"
|
||||
|
||||
namespace chrome {
|
||||
|
||||
// Note: We use the construct-on-first-use pattern here, because we don't
|
||||
// want to fight with any static initializer ordering problems later.
|
||||
// The downside of this is that the objects don't ever get cleaned up.
|
||||
// But they are small and this is okay.
|
||||
|
||||
// Note: Because these are constructed on-first-use, there is a slight
|
||||
// race condition - two threads could initialize the same counter.
|
||||
// If this happened, the stats table would still work just fine;
|
||||
// we'd leak the extraneous StatsCounter object once, and that
|
||||
// would be it. But these are small objects, so this is ok.
|
||||
|
||||
StatsCounter& Counters::ipc_send_counter() {
|
||||
static StatsCounter* ctr = new StatsCounter("IPC.SendMsgCount");
|
||||
return *ctr;
|
||||
}
|
||||
|
||||
StatsCounterTimer& Counters::chrome_main() {
|
||||
static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.Init");
|
||||
return *ctr;
|
||||
}
|
||||
|
||||
StatsCounterTimer& Counters::renderer_main() {
|
||||
static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.RendererInit");
|
||||
return *ctr;
|
||||
}
|
||||
|
||||
StatsCounterTimer& Counters::spellcheck_init() {
|
||||
static StatsCounterTimer* ctr = new StatsCounterTimer("SpellCheck.Init");
|
||||
return *ctr;
|
||||
}
|
||||
|
||||
StatsRate& Counters::spellcheck_lookup() {
|
||||
static StatsRate* ctr = new StatsRate("SpellCheck.Lookup");
|
||||
return *ctr;
|
||||
}
|
||||
|
||||
StatsCounterTimer& Counters::plugin_load() {
|
||||
static StatsCounterTimer* ctr = new StatsCounterTimer("ChromePlugin.Load");
|
||||
return *ctr;
|
||||
}
|
||||
|
||||
StatsRate& Counters::plugin_intercept() {
|
||||
static StatsRate* ctr = new StatsRate("ChromePlugin.Intercept");
|
||||
return *ctr;
|
||||
}
|
||||
|
||||
} // namespace chrome
|
@ -1,42 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Counters used within the browser.
|
||||
|
||||
#ifndef CHROME_COMMON_CHROME_COUNTERS_H_
|
||||
#define CHROME_COMMON_CHROME_COUNTERS_H_
|
||||
|
||||
class StatsCounter;
|
||||
class StatsCounterTimer;
|
||||
class StatsRate;
|
||||
|
||||
namespace chrome {
|
||||
|
||||
class Counters {
|
||||
public:
|
||||
// The number of messages sent on IPC channels.
|
||||
static StatsCounter& ipc_send_counter();
|
||||
|
||||
// The amount of time spent in chrome initialization.
|
||||
static StatsCounterTimer& chrome_main();
|
||||
|
||||
// The amount of time spent in renderer initialization.
|
||||
static StatsCounterTimer& renderer_main();
|
||||
|
||||
// Time spent in spellchecker initialization.
|
||||
static StatsCounterTimer& spellcheck_init();
|
||||
|
||||
// Time/Count of spellcheck lookups.
|
||||
static StatsRate& spellcheck_lookup();
|
||||
|
||||
// Time spent loading the Chrome plugins.
|
||||
static StatsCounterTimer& plugin_load();
|
||||
|
||||
// Time/Count of plugin network interception.
|
||||
static StatsRate& plugin_intercept();
|
||||
};
|
||||
|
||||
} // namespace chrome
|
||||
|
||||
#endif // CHROME_COMMON_CHROME_COUNTERS_H_
|
@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/file_path.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/sys_info.h"
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
#include "chrome/common/chrome_paths_internal.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
|
||||
namespace chrome {
|
||||
|
||||
bool GetGearsPluginPathFromCommandLine(FilePath* path) {
|
||||
#ifndef NDEBUG
|
||||
// for debugging, support a cmd line based override
|
||||
std::wstring plugin_path = CommandLine::ForCurrentProcess()->GetSwitchValue(
|
||||
switches::kGearsPluginPathOverride);
|
||||
// TODO(tc): After GetSwitchNativeValue lands, we don't need to use
|
||||
// FromWStringHack.
|
||||
*path = FilePath::FromWStringHack(plugin_path);
|
||||
return !plugin_path.empty();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool PathProvider(int key, FilePath* result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// This cannot be done as a static initializer sadly since Visual Studio will
|
||||
// eliminate this object file if there is no direct entry point into it.
|
||||
void RegisterPathProvider() {
|
||||
PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
|
||||
}
|
||||
|
||||
} // namespace chrome
|
@ -1,53 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_COMMON_CHROME_PATHS_H__
|
||||
#define CHROME_COMMON_CHROME_PATHS_H__
|
||||
|
||||
// This file declares path keys for the chrome module. These can be used with
|
||||
// the PathService to access various special directories and files.
|
||||
|
||||
namespace chrome {
|
||||
|
||||
enum {
|
||||
PATH_START = 1000,
|
||||
|
||||
DIR_APP = PATH_START, // directory where dlls and data reside
|
||||
DIR_LOGS, // directory where logs should be written
|
||||
DIR_USER_DATA, // directory where user data can be written
|
||||
DIR_CRASH_DUMPS, // directory where crash dumps are written
|
||||
DIR_USER_DESKTOP, // directory that correspond to the desktop
|
||||
DIR_RESOURCES, // directory where application resources are stored
|
||||
DIR_INSPECTOR, // directory where web inspector is located
|
||||
DIR_THEMES, // directory where theme dll files are stored
|
||||
DIR_LOCALES, // directory where locale resources are stored
|
||||
DIR_APP_DICTIONARIES, // directory where the global dictionaries are
|
||||
DIR_USER_DOCUMENTS, // directory for a user's "My Documents"
|
||||
DIR_DEFAULT_DOWNLOADS, // directory for a user's "My Documents/Downloads"
|
||||
FILE_RESOURCE_MODULE, // full path and filename of the module that contains
|
||||
// embedded resources (version, strings, images, etc.)
|
||||
FILE_LOCAL_STATE, // path and filename to the file in which machine/
|
||||
// installation-specific state is saved
|
||||
FILE_RECORDED_SCRIPT, // full path to the script.log file that contains
|
||||
// recorded browser events for playback.
|
||||
FILE_GEARS_PLUGIN, // full path to the gears.dll plugin file.
|
||||
FILE_LIBAVCODEC, // full path to libavcodec media decoding library.
|
||||
FILE_LIBAVFORMAT, // full path to libavformat media parsing library.
|
||||
FILE_LIBAVUTIL, // full path to libavutil media utility library.
|
||||
|
||||
// Valid only in development environment; TODO(darin): move these
|
||||
DIR_TEST_DATA, // directory where unit test data resides
|
||||
DIR_TEST_TOOLS, // directory where unit test tools reside
|
||||
FILE_TEST_SERVER, // simple HTTP server for testing the network stack
|
||||
FILE_PYTHON_RUNTIME, // Python runtime, used for running the test server
|
||||
|
||||
PATH_END
|
||||
};
|
||||
|
||||
// Call once to register the provider for the path keys defined above.
|
||||
void RegisterPathProvider();
|
||||
|
||||
} // namespace chrome
|
||||
|
||||
#endif // CHROME_COMMON_CHROME_PATHS_H__
|
@ -1,28 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
|
||||
#define CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
|
||||
|
||||
class FilePath;
|
||||
|
||||
namespace chrome {
|
||||
|
||||
// Get the path to the user's data directory, regardless of whether
|
||||
// DIR_USER_DATA has been overridden by a command-line option.
|
||||
bool GetDefaultUserDataDirectory(FilePath* result);
|
||||
|
||||
// Get the path to the user's documents directory.
|
||||
bool GetUserDocumentsDirectory(FilePath* result);
|
||||
|
||||
// Get the path to the user's downloads directory.
|
||||
bool GetUserDownloadsDirectory(FilePath* result);
|
||||
|
||||
// The path to the user's desktop.
|
||||
bool GetUserDesktop(FilePath* result);
|
||||
|
||||
} // namespace chrome
|
||||
|
||||
|
||||
#endif // CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
|
@ -1,75 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "chrome/common/chrome_paths_internal.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "base/base_paths.h"
|
||||
#import "base/file_path.h"
|
||||
#import "base/logging.h"
|
||||
#import "base/path_service.h"
|
||||
|
||||
namespace chrome {
|
||||
|
||||
bool GetDefaultUserDataDirectory(FilePath* result) {
|
||||
bool success = false;
|
||||
NSArray* dirs =
|
||||
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
|
||||
NSUserDomainMask, YES);
|
||||
if ([dirs count] && result) {
|
||||
NSString* base = [dirs objectAtIndex:0];
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
base = [base stringByAppendingPathComponent:@"Google"];
|
||||
NSString* tail = @"Chrome";
|
||||
#else
|
||||
NSString* tail = @"Chromium";
|
||||
#endif
|
||||
NSString* path = [base stringByAppendingPathComponent:tail];
|
||||
*result = FilePath([path fileSystemRepresentation]);
|
||||
success = true;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool GetUserDocumentsDirectory(FilePath* result) {
|
||||
bool success = false;
|
||||
NSArray* docArray =
|
||||
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
|
||||
NSUserDomainMask,
|
||||
YES);
|
||||
if ([docArray count] && result) {
|
||||
*result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]);
|
||||
success = true;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool GetUserDownloadsDirectory(FilePath* result) {
|
||||
bool success = false;
|
||||
NSArray* docArray =
|
||||
NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory,
|
||||
NSUserDomainMask,
|
||||
YES);
|
||||
if ([docArray count] && result) {
|
||||
*result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]);
|
||||
success = true;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool GetUserDesktop(FilePath* result) {
|
||||
bool success = false;
|
||||
NSArray* docArray =
|
||||
NSSearchPathForDirectoriesInDomains(NSDesktopDirectory,
|
||||
NSUserDomainMask,
|
||||
YES);
|
||||
if ([docArray count] && result) {
|
||||
*result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]);
|
||||
success = true;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
} // namespace chrome
|
@ -1,66 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/common/chrome_paths_internal.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "base/file_path.h"
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
|
||||
namespace chrome {
|
||||
|
||||
bool GetDefaultUserDataDirectory(FilePath* result) {
|
||||
if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
|
||||
return false;
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
*result = result->Append(FILE_PATH_LITERAL("Google"));
|
||||
#endif
|
||||
*result = result->Append(chrome::kBrowserAppName);
|
||||
*result = result->Append(chrome::kUserDataDirname);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetUserDocumentsDirectory(FilePath* result) {
|
||||
wchar_t path_buf[MAX_PATH];
|
||||
if (FAILED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL,
|
||||
SHGFP_TYPE_CURRENT, path_buf)))
|
||||
return false;
|
||||
*result = FilePath(path_buf);
|
||||
return true;
|
||||
}
|
||||
|
||||
// On Vista, we can get the download path using a Win API
|
||||
// (http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx),
|
||||
// but it can be set to Desktop, which is dangerous. Instead,
|
||||
// we just use 'Downloads' under DIR_USER_DOCUMENTS. Localizing
|
||||
// 'downloads' is not a good idea because Chrome's UI language
|
||||
// can be changed.
|
||||
bool GetUserDownloadsDirectory(FilePath* result) {
|
||||
if (!GetUserDocumentsDirectory(result))
|
||||
return false;
|
||||
|
||||
*result = result->Append(L"Downloads");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetUserDesktop(FilePath* result) {
|
||||
// We need to go compute the value. It would be nice to support paths
|
||||
// with names longer than MAX_PATH, but the system functions don't seem
|
||||
// to be designed for it either, with the exception of GetTempPath
|
||||
// (but other things will surely break if the temp path is too long,
|
||||
// so we don't bother handling it.
|
||||
wchar_t system_buffer[MAX_PATH];
|
||||
system_buffer[0] = 0;
|
||||
if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL,
|
||||
SHGFP_TYPE_CURRENT, system_buffer)))
|
||||
return false;
|
||||
*result = FilePath(system_buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace chrome
|
@ -26,7 +26,6 @@
|
||||
#include "base/string_util.h"
|
||||
#include "base/singleton.h"
|
||||
#include "base/stats_counters.h"
|
||||
#include "chrome/common/chrome_counters.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/file_descriptor_set_posix.h"
|
||||
#include "chrome/common/ipc_logging.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "base/non_thread_safe.h"
|
||||
#include "base/stats_counters.h"
|
||||
#include "base/win_util.h"
|
||||
#include "chrome/common/chrome_counters.h"
|
||||
#include "chrome/common/ipc_logging.h"
|
||||
#include "chrome/common/ipc_message_utils.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
@ -127,7 +126,6 @@ bool Channel::ChannelImpl::Send(Message* message) {
|
||||
if (thread_check_.get()) {
|
||||
DCHECK(thread_check_->CalledOnValidThread());
|
||||
}
|
||||
chrome::Counters::ipc_send_counter().Increment();
|
||||
#ifdef IPC_MESSAGE_DEBUG_EXTRA
|
||||
DLOG(INFO) << "sending message @" << message << " on channel @" << this
|
||||
<< " with type " << message->type()
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include "base/string_util.h"
|
||||
#include "base/string16.h"
|
||||
#include "base/tuple.h"
|
||||
#include "base/time.h"
|
||||
|
||||
#if defined(OS_POSIX)
|
||||
#include "chrome/common/file_descriptor_set_posix.h"
|
||||
#endif
|
||||
#include "chrome/common/ipc_sync_message.h"
|
||||
#include "chrome/common/thumbnail_score.h"
|
||||
#include "chrome/common/transport_dib.h"
|
||||
|
||||
namespace IPC {
|
||||
@ -731,17 +731,6 @@ struct ParamTraitsIPC<FilePath> {
|
||||
static void Log(const param_type& p, std::wstring* l);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraitsIPC<ThumbnailScore> {
|
||||
typedef ThumbnailScore param_type;
|
||||
static void Write(Message* m, const param_type& p);
|
||||
static bool Read(const Message* m, void** iter, param_type* r);
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"(%f, %d, %d)",
|
||||
p.boring_score, p.good_clipping, p.at_top));
|
||||
}
|
||||
};
|
||||
|
||||
struct LogData {
|
||||
std::wstring channel;
|
||||
int32_t routing_id;
|
||||
@ -1045,32 +1034,6 @@ ParamTraitsIPC<FilePath>::Log(const param_type& p, std::wstring* l) {
|
||||
ParamTraits<FilePath::StringType>::Log(p.value(), l);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
ParamTraitsIPC<ThumbnailScore>::Write(Message* m, const param_type& p) {
|
||||
IPC::ParamTraits<double>::Write(m, p.boring_score);
|
||||
IPC::ParamTraits<bool>::Write(m, p.good_clipping);
|
||||
IPC::ParamTraits<bool>::Write(m, p.at_top);
|
||||
IPC::ParamTraits<base::Time>::Write(m, p.time_at_snapshot);
|
||||
}
|
||||
inline bool
|
||||
ParamTraitsIPC<ThumbnailScore>::Read(const Message* m, void** iter, param_type* r) {
|
||||
double boring_score;
|
||||
bool good_clipping, at_top;
|
||||
base::Time time_at_snapshot;
|
||||
if (!IPC::ParamTraits<double>::Read(m, iter, &boring_score) ||
|
||||
!IPC::ParamTraits<bool>::Read(m, iter, &good_clipping) ||
|
||||
!IPC::ParamTraits<bool>::Read(m, iter, &at_top) ||
|
||||
!IPC::ParamTraits<base::Time>::Read(m, iter, &time_at_snapshot))
|
||||
return false;
|
||||
|
||||
r->boring_score = boring_score;
|
||||
r->good_clipping = good_clipping;
|
||||
r->at_top = at_top;
|
||||
r->time_at_snapshot = time_at_snapshot;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Generic message subclasses
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_COMMON_THUMBNAIL_SCORE_H__
|
||||
#define CHROME_BROWSER_COMMON_THUMBNAIL_SCORE_H__
|
||||
|
||||
#include "base/time.h"
|
||||
|
||||
// A set of metadata about a Thumbnail.
|
||||
struct ThumbnailScore {
|
||||
// Initializes the ThumbnailScore to the absolute worst possible
|
||||
// values except for time, which is set to Now().
|
||||
ThumbnailScore();
|
||||
|
||||
// Builds a ThumbnailScore with the passed in values, and sets the
|
||||
// thumbnail generation time to Now().
|
||||
ThumbnailScore(double score, bool clipping, bool top);
|
||||
|
||||
// Builds a ThumbnailScore with the passed in values.
|
||||
ThumbnailScore(double score, bool clipping, bool top,
|
||||
const base::Time& time);
|
||||
~ThumbnailScore();
|
||||
|
||||
// Tests for equivalence between two ThumbnailScore objects.
|
||||
bool Equals(const ThumbnailScore& rhs) const;
|
||||
|
||||
// How "boring" a thumbnail is. The boring score is the 0,1 ranged
|
||||
// percentage of pixels that are the most common luma. Higher boring
|
||||
// scores indicate that a higher percentage of a bitmap are all the
|
||||
// same brightness (most likely the same color).
|
||||
double boring_score;
|
||||
|
||||
// Whether the thumbnail was taken with height greater then
|
||||
// width. In cases where we don't have |good_clipping|, the
|
||||
// thumbnails are either clipped from the horizontal center of the
|
||||
// window, or are otherwise weirdly stretched.
|
||||
bool good_clipping;
|
||||
|
||||
// Whether this thumbnail was taken while the renderer was
|
||||
// displaying the top of the page. Most pages are more recognizable
|
||||
// by their headers then by a set of random text half way down the
|
||||
// page; i.e. most MediaWiki sites would be indistinguishable by
|
||||
// thumbnails with |at_top| set to false.
|
||||
bool at_top;
|
||||
|
||||
// Record the time when a thumbnail was taken. This is used to make
|
||||
// sure thumbnails are kept fresh.
|
||||
base::Time time_at_snapshot;
|
||||
|
||||
// How bad a thumbnail needs to be before we completely ignore it.
|
||||
static const double kThumbnailMaximumBoringness;
|
||||
|
||||
// Time before we take a worse thumbnail (subject to
|
||||
// kThumbnailMaximumBoringness) over what's currently in the database
|
||||
// for freshness.
|
||||
static const base::TimeDelta kUpdateThumbnailTime;
|
||||
|
||||
// Penalty of how much more boring a thumbnail should be per hour.
|
||||
static const double kThumbnailDegradePerHour;
|
||||
};
|
||||
|
||||
// Checks whether we should replace one thumbnail with another.
|
||||
bool ShouldReplaceThumbnailWith(const ThumbnailScore& current,
|
||||
const ThumbnailScore& replacement);
|
||||
|
||||
#endif // CHROME_BROWSER_COMMON_THUMBNAIL_SCORE_H__
|
Loading…
Reference in New Issue
Block a user