win: Fix compilation errors for chrome35.

This commit is contained in:
Cheng Zhao 2014-07-11 12:19:01 +08:00
parent 497174bbe4
commit 8d4211bd3a
17 changed files with 44 additions and 60 deletions

View file

@ -58,8 +58,6 @@
'atom/browser/api/atom_api_menu_views.h', 'atom/browser/api/atom_api_menu_views.h',
'atom/browser/api/atom_api_menu_mac.h', 'atom/browser/api/atom_api_menu_mac.h',
'atom/browser/api/atom_api_menu_mac.mm', 'atom/browser/api/atom_api_menu_mac.mm',
'atom/browser/api/atom_api_menu_win.cc',
'atom/browser/api/atom_api_menu_win.h',
'atom/browser/api/atom_api_power_monitor.cc', 'atom/browser/api/atom_api_power_monitor.cc',
'atom/browser/api/atom_api_power_monitor.h', 'atom/browser/api/atom_api_power_monitor.h',
'atom/browser/api/atom_api_protocol.cc', 'atom/browser/api/atom_api_protocol.cc',
@ -105,8 +103,6 @@
'atom/browser/native_window_views.h', 'atom/browser/native_window_views.h',
'atom/browser/native_window_mac.h', 'atom/browser/native_window_mac.h',
'atom/browser/native_window_mac.mm', 'atom/browser/native_window_mac.mm',
'atom/browser/native_window_win.cc',
'atom/browser/native_window_win.h',
'atom/browser/native_window_observer.h', 'atom/browser/native_window_observer.h',
'atom/browser/net/adapter_request_job.cc', 'atom/browser/net/adapter_request_job.cc',
'atom/browser/net/adapter_request_job.h', 'atom/browser/net/adapter_request_job.h',
@ -143,10 +139,6 @@
'atom/browser/ui/views/global_menu_bar_x11.h', 'atom/browser/ui/views/global_menu_bar_x11.h',
'atom/browser/ui/views/linux_frame_view.cc', 'atom/browser/ui/views/linux_frame_view.cc',
'atom/browser/ui/views/linux_frame_view.h', 'atom/browser/ui/views/linux_frame_view.h',
'atom/browser/ui/win/menu_2.cc',
'atom/browser/ui/win/menu_2.h',
'atom/browser/ui/win/native_menu_win.cc',
'atom/browser/ui/win/native_menu_win.h',
'atom/browser/ui/win/notify_icon_host.cc', 'atom/browser/ui/win/notify_icon_host.cc',
'atom/browser/ui/win/notify_icon_host.h', 'atom/browser/ui/win/notify_icon_host.h',
'atom/browser/ui/win/notify_icon.cc', 'atom/browser/ui/win/notify_icon.cc',

View file

@ -33,8 +33,6 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
#else #else
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
#endif #endif
settings.dcheck_state =
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
logging::InitLogging(settings); logging::InitLogging(settings);
#endif // defined(OS_WIN) #endif // defined(OS_WIN)

View file

@ -251,9 +251,6 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isEnabledAt", &Menu::IsEnabledAt) .SetMethod("isEnabledAt", &Menu::IsEnabledAt)
.SetMethod("isVisibleAt", &Menu::IsVisibleAt) .SetMethod("isVisibleAt", &Menu::IsVisibleAt)
.SetMethod("_attachToWindow", &Menu::AttachToWindow) .SetMethod("_attachToWindow", &Menu::AttachToWindow)
#if defined(OS_WIN)
.SetMethod("_updateStates", &Menu::UpdateStates)
#endif
.SetMethod("_popup", &Menu::Popup); .SetMethod("_popup", &Menu::Popup);
} }

View file

@ -84,10 +84,6 @@ class Menu : public mate::Wrappable,
bool IsEnabledAt(int index) const; bool IsEnabledAt(int index) const;
bool IsVisibleAt(int index) const; bool IsVisibleAt(int index) const;
#if defined(OS_WIN)
virtual void UpdateStates() = 0;
#endif
DISALLOW_COPY_AND_ASSIGN(Menu); DISALLOW_COPY_AND_ASSIGN(Menu);
}; };

View file

@ -193,14 +193,14 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
void WebContents::OnRendererMessage(const base::string16& channel, void WebContents::OnRendererMessage(const base::string16& channel,
const base::ListValue& args) { const base::ListValue& args) {
// webContents.emit(channel, new Event(), args...); // webContents.emit(channel, new Event(), args...);
Emit(UTF16ToUTF8(channel), args, web_contents(), NULL); Emit(base::UTF16ToUTF8(channel), args, web_contents(), NULL);
} }
void WebContents::OnRendererMessageSync(const base::string16& channel, void WebContents::OnRendererMessageSync(const base::string16& channel,
const base::ListValue& args, const base::ListValue& args,
IPC::Message* message) { IPC::Message* message) {
// webContents.emit(channel, new Event(sender, message), args...); // webContents.emit(channel, new Event(sender, message), args...);
Emit(UTF16ToUTF8(channel), args, web_contents(), message); Emit(base::UTF16ToUTF8(channel), args, web_contents(), message);
} }
// static // static

View file

@ -44,7 +44,7 @@ std::string Browser::GetExecutableFileVersion() const {
if (PathService::Get(base::FILE_EXE, &path)) { if (PathService::Get(base::FILE_EXE, &path)) {
scoped_ptr<FileVersionInfo> version_info( scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(path)); FileVersionInfo::CreateFileVersionInfo(path));
return UTF16ToUTF8(version_info->product_version()); return base::UTF16ToUTF8(version_info->product_version());
} }
return ATOM_VERSION_STRING; return ATOM_VERSION_STRING;
@ -55,7 +55,7 @@ std::string Browser::GetExecutableFileProductName() const {
if (PathService::Get(base::FILE_EXE, &path)) { if (PathService::Get(base::FILE_EXE, &path)) {
scoped_ptr<FileVersionInfo> version_info( scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(path)); FileVersionInfo::CreateFileVersionInfo(path));
return UTF16ToUTF8(version_info->product_name()); return base::UTF16ToUTF8(version_info->product_name());
} }
return "Atom-Shell"; return "Atom-Shell";

View file

@ -507,7 +507,7 @@ void NativeWindow::Observe(int type,
if (title->first) { if (title->first) {
bool prevent_default = false; bool prevent_default = false;
std::string text = UTF16ToUTF8(title->first->GetTitle()); std::string text = base::UTF16ToUTF8(title->first->GetTitle());
FOR_EACH_OBSERVER(NativeWindowObserver, FOR_EACH_OBSERVER(NativeWindowObserver,
observers_, observers_,
OnPageTitleUpdated(&prevent_default, text)); OnPageTitleUpdated(&prevent_default, text));

View file

@ -378,12 +378,14 @@ bool NativeWindowViews::ShouldDescendIntoChildForEventHandling(
draggable_region_->contains(location.x(), location.y())) draggable_region_->contains(location.x(), location.y()))
return false; return false;
#if defined(USE_X11)
// And the events on border for dragging resizable frameless window. // And the events on border for dragging resizable frameless window.
if (!has_frame_ && CanResize()) { if (!has_frame_ && CanResize()) {
LinuxFrameView* frame = static_cast<LinuxFrameView*>( LinuxFrameView* frame = static_cast<LinuxFrameView*>(
window_->non_client_view()->frame_view()); window_->non_client_view()->frame_view());
return frame->ResizingBorderHitTest(location) == HTNOWHERE; return frame->ResizingBorderHitTest(location) == HTNOWHERE;
} }
#endif
return true; return true;
} }

View file

@ -25,8 +25,8 @@ namespace {
// Distinguish directories from regular files. // Distinguish directories from regular files.
bool IsDirectory(const base::FilePath& path) { bool IsDirectory(const base::FilePath& path) {
base::PlatformFileInfo file_info; base::File::Info file_info;
return file_util::GetFileInfo(path, &file_info) ? return base::GetFileInfo(path, &file_info) ?
file_info.is_directory : path.EndsWithSeparator(); file_info.is_directory : path.EndsWithSeparator();
} }
@ -105,7 +105,7 @@ void FormatFilterForExtensions(
// the we create a description "QQQ File (.qqq)"). // the we create a description "QQQ File (.qqq)").
include_all_files = true; include_all_files = true;
// TODO(zcbenz): should be localized. // TODO(zcbenz): should be localized.
desc = base::i18n::ToUpper(WideToUTF16(ext_name)) + L" File"; desc = base::i18n::ToUpper(base::WideToUTF16(ext_name)) + L" File";
} }
desc += L" (*." + ext_name + L")"; desc += L" (*." + ext_name + L")";
@ -157,14 +157,16 @@ class FileDialog {
filters.size())); filters.size()));
if (!title.empty()) if (!title.empty())
GetPtr()->SetTitle(UTF8ToUTF16(title).c_str()); GetPtr()->SetTitle(base::UTF8ToUTF16(title).c_str());
SetDefaultFolder(default_path); SetDefaultFolder(default_path);
} }
bool Show(atom::NativeWindow* parent_window) { bool Show(atom::NativeWindow* parent_window) {
atom::NativeWindow::DialogScope dialog_scope(parent_window); atom::NativeWindow::DialogScope dialog_scope(parent_window);
HWND window = parent_window ? parent_window->GetNativeWindow() : NULL; // HWND window = parent_window ? parent_window->GetNativeWindow() : NULL;
// FIXME
HWND window = NULL;
return dialog_->DoModal(window) == IDOK; return dialog_->DoModal(window) == IDOK;
} }

View file

@ -107,7 +107,7 @@ void NotifyIcon::SetToolTip(const std::string& tool_tip) {
NOTIFYICONDATA icon_data; NOTIFYICONDATA icon_data;
InitIconData(&icon_data); InitIconData(&icon_data);
icon_data.uFlags = NIF_TIP; icon_data.uFlags = NIF_TIP;
wcscpy_s(icon_data.szTip, UTF8ToUTF16(tool_tip).c_str()); wcscpy_s(icon_data.szTip, base::UTF8ToUTF16(tool_tip).c_str());
BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data);
if (!result) if (!result)
LOG(WARNING) << "Unable to set tooltip for status tray icon"; LOG(WARNING) << "Unable to set tooltip for status tray icon";

View file

@ -1,14 +1,14 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved. // Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be // Use of this source code is governed by the MIT license that can be
// found in the LICENSE file. // found in the LICENSE file.
// This file is generated by script/bootstrap.py, you should never modify it // This file is generated by script/bootstrap.py, you should never modify it
// by hand. // by hand.
#ifndef ATOM_COMMON_CHROME_VERSION_H_ #ifndef ATOM_COMMON_CHROME_VERSION_H_
#define ATOM_COMMON_CHROME_VERSION_H_ #define ATOM_COMMON_CHROME_VERSION_H_
#define CHROME_VERSION_STRING "35.0.1916.153" #define CHROME_VERSION_STRING "35.0.1916.153"
#define CHROME_VERSION "v" CHROME_VERSION_STRING #define CHROME_VERSION "v" CHROME_VERSION_STRING
#endif // ATOM_COMMON_CHROME_VERSION_H_ #endif // ATOM_COMMON_CHROME_VERSION_H_

View file

@ -40,14 +40,13 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
skip_system_crash_handler_ = skip_system_crash_handler; skip_system_crash_handler_ = skip_system_crash_handler;
base::FilePath temp_dir; base::FilePath temp_dir;
if (!file_util::GetTempDir(&temp_dir)) { if (!base::GetTempDir(&temp_dir)) {
LOG(ERROR) << "Cannot get temp directory"; LOG(ERROR) << "Cannot get temp directory";
return; return;
} }
base::string16 pipe_name = ReplaceStringPlaceholders(kPipeNameFormat, base::string16 pipe_name = ReplaceStringPlaceholders(
UTF8ToUTF16(product_name), kPipeNameFormat, base::UTF8ToUTF16(product_name), NULL);
NULL);
// Wait until the crash service is started. // Wait until the crash service is started.
HANDLE waiting_event = HANDLE waiting_event =
@ -104,13 +103,13 @@ google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo(
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"prod", L"Atom-Shell")); L"prod", L"Atom-Shell"));
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"ver", UTF8ToWide(version).c_str())); L"ver", base::UTF8ToWide(version).c_str()));
for (StringMap::const_iterator iter = upload_parameters_.begin(); for (StringMap::const_iterator iter = upload_parameters_.begin();
iter != upload_parameters_.end(); ++iter) { iter != upload_parameters_.end(); ++iter) {
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
UTF8ToWide(iter->first).c_str(), base::UTF8ToWide(iter->first).c_str(),
UTF8ToWide(iter->second).c_str())); base::UTF8ToWide(iter->second).c_str()));
} }
custom_info_.entries = &custom_info_entries_.front(); custom_info_.entries = &custom_info_entries_.front();

View file

@ -347,7 +347,7 @@ void CrashService::OnClientDumpRequest(void* context,
CrashMap::const_iterator it = map.find(L"breakpad-dump-location"); CrashMap::const_iterator it = map.find(L"breakpad-dump-location");
if (it != map.end()) { if (it != map.end()) {
base::FilePath alternate_dump_location = base::FilePath(it->second); base::FilePath alternate_dump_location = base::FilePath(it->second);
file_util::CreateDirectoryW(alternate_dump_location); base::CreateDirectoryW(alternate_dump_location);
alternate_dump_location = alternate_dump_location.Append( alternate_dump_location = alternate_dump_location.Append(
dump_location.BaseName()); dump_location.BaseName());
base::Move(dump_location, alternate_dump_location); base::Move(dump_location, alternate_dump_location);

View file

@ -23,11 +23,11 @@ const wchar_t kStandardLogFile[] = L"operation_log.txt";
bool GetCrashServiceDirectory(const std::wstring& application_name, bool GetCrashServiceDirectory(const std::wstring& application_name,
base::FilePath* dir) { base::FilePath* dir) {
base::FilePath temp_dir; base::FilePath temp_dir;
if (!file_util::GetTempDir(&temp_dir)) if (!base::GetTempDir(&temp_dir))
return false; return false;
temp_dir = temp_dir.Append(application_name + L" Crashes"); temp_dir = temp_dir.Append(application_name + L" Crashes");
if (!base::PathExists(temp_dir)) { if (!base::PathExists(temp_dir)) {
if (!file_util::CreateDirectory(temp_dir)) if (!base::CreateDirectory(temp_dir))
return false; return false;
} }
*dir = temp_dir; *dir = temp_dir;

View file

@ -33,14 +33,9 @@ void SetupProcessObject(Environment*, int, const char* const*, int,
// Force all builtin modules to be referenced so they can actually run their // Force all builtin modules to be referenced so they can actually run their
// DSO constructors, see http://git.io/DRIqCg. // DSO constructors, see http://git.io/DRIqCg.
#if defined(OS_WIN)
#define REFERENCE_MODULE(name) \
__pragma(comment(linker, "/export:_register_" #name))
#else
#define REFERENCE_MODULE(name) \ #define REFERENCE_MODULE(name) \
extern "C" void _register_ ## name(void); \ extern "C" void _register_ ## name(void); \
void (*fp_register_ ## name)(void) = _register_ ## name void (*fp_register_ ## name)(void) = _register_ ## name
#endif
// Node's builtin modules. // Node's builtin modules.
REFERENCE_MODULE(cares_wrap); REFERENCE_MODULE(cares_wrap);
REFERENCE_MODULE(fs_event_wrap); REFERENCE_MODULE(fs_event_wrap);
@ -103,11 +98,11 @@ scoped_ptr<const char*[]> StringVectorToArgArray(
#if defined(OS_WIN) #if defined(OS_WIN)
std::vector<std::string> String16VectorToStringVector( std::vector<std::string> String16VectorToStringVector(
const std::vector<string16>& vector) { const std::vector<base::string16>& vector) {
std::vector<std::string> utf8_vector; std::vector<std::string> utf8_vector;
utf8_vector.reserve(vector.size()); utf8_vector.reserve(vector.size());
for (size_t i = 0; i < vector.size(); ++i) for (size_t i = 0; i < vector.size(); ++i)
utf8_vector.push_back(UTF16ToUTF8(vector[i])); utf8_vector.push_back(base::UTF16ToUTF8(vector[i]));
return utf8_vector; return utf8_vector;
} }
#endif #endif

View file

@ -29,7 +29,7 @@ namespace {
// is empty. This function tells if it is. // is empty. This function tells if it is.
bool ValidateShellCommandForScheme(const std::string& scheme) { bool ValidateShellCommandForScheme(const std::string& scheme) {
base::win::RegKey key; base::win::RegKey key;
std::wstring registry_path = ASCIIToWide(scheme) + std::wstring registry_path = base::ASCIIToWide(scheme) +
L"\\shell\\open\\command"; L"\\shell\\open\\command";
key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ); key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ);
if (!key.Valid()) if (!key.Valid())

View file

@ -34,6 +34,9 @@
['exclude', '_linux(_unittest)?\\.(h|cc)$'], ['exclude', '_linux(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)linux_[^/]*\\.(h|cc)$'], ['exclude', '(^|/)linux_[^/]*\\.(h|cc)$'],
['exclude', '(^|/)linux/'], ['exclude', '(^|/)linux/'],
['exclude', '_x11(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)x11_[^/]*\\.(h|cc)$'],
['exclude', '(^|/)x11/'],
], ],
}], }],
['OS!="android"', { ['OS!="android"', {