win: Fix compilation errors for chrome35.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 11 Jul 2014 04:19:01 +0000 (12:19 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 11 Jul 2014 04:19:01 +0000 (12:19 +0800)
17 files changed:
atom.gyp
atom/app/atom_main_delegate.cc
atom/browser/api/atom_api_menu.cc
atom/browser/api/atom_api_menu.h
atom/browser/api/atom_api_web_contents.cc
atom/browser/browser_win.cc
atom/browser/native_window.cc
atom/browser/native_window_views.cc
atom/browser/ui/file_dialog_win.cc
atom/browser/ui/win/notify_icon.cc
atom/common/chrome_version.h
atom/common/crash_reporter/crash_reporter_win.cc
atom/common/crash_reporter/win/crash_service.cc
atom/common/crash_reporter/win/crash_service_main.cc
atom/common/node_bindings.cc
atom/common/platform_util_win.cc
filename_rules.gypi

index defe621..b471a04 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
@@ -58,8 +58,6 @@
       'atom/browser/api/atom_api_menu_views.h',
       'atom/browser/api/atom_api_menu_mac.h',
       '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.h',
       'atom/browser/api/atom_api_protocol.cc',
       'atom/browser/native_window_views.h',
       'atom/browser/native_window_mac.h',
       '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/net/adapter_request_job.cc',
       'atom/browser/net/adapter_request_job.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.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.h',
       'atom/browser/ui/win/notify_icon.cc',
index 705ea4a..dd4b3f7 100644 (file)
@@ -33,8 +33,6 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
 #else
   settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
 #endif
-  settings.dcheck_state =
-      logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
   logging::InitLogging(settings);
 #endif  // defined(OS_WIN)
 
index 2c8c086..8d8105d 100644 (file)
@@ -251,9 +251,6 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
       .SetMethod("isEnabledAt", &Menu::IsEnabledAt)
       .SetMethod("isVisibleAt", &Menu::IsVisibleAt)
       .SetMethod("_attachToWindow", &Menu::AttachToWindow)
-#if defined(OS_WIN)
-      .SetMethod("_updateStates", &Menu::UpdateStates)
-#endif
       .SetMethod("_popup", &Menu::Popup);
 }
 
index 62060dc..d8c01e8 100644 (file)
@@ -84,10 +84,6 @@ class Menu : public mate::Wrappable,
   bool IsEnabledAt(int index) const;
   bool IsVisibleAt(int index) const;
 
-#if defined(OS_WIN)
-  virtual void UpdateStates() = 0;
-#endif
-
   DISALLOW_COPY_AND_ASSIGN(Menu);
 };
 
index 6eb7690..14fc69c 100644 (file)
@@ -193,14 +193,14 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
 void WebContents::OnRendererMessage(const base::string16& channel,
                                     const base::ListValue& 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,
                                         const base::ListValue& args,
                                         IPC::Message* message) {
   // webContents.emit(channel, new Event(sender, message), args...);
-  Emit(UTF16ToUTF8(channel), args, web_contents(), message);
+  Emit(base::UTF16ToUTF8(channel), args, web_contents(), message);
 }
 
 // static
index cf4b9ea..8f2fe80 100644 (file)
@@ -44,7 +44,7 @@ std::string Browser::GetExecutableFileVersion() const {
   if (PathService::Get(base::FILE_EXE, &path)) {
     scoped_ptr<FileVersionInfo> version_info(
         FileVersionInfo::CreateFileVersionInfo(path));
-    return UTF16ToUTF8(version_info->product_version());
+    return base::UTF16ToUTF8(version_info->product_version());
   }
 
   return ATOM_VERSION_STRING;
@@ -55,7 +55,7 @@ std::string Browser::GetExecutableFileProductName() const {
   if (PathService::Get(base::FILE_EXE, &path)) {
     scoped_ptr<FileVersionInfo> version_info(
         FileVersionInfo::CreateFileVersionInfo(path));
-    return UTF16ToUTF8(version_info->product_name());
+    return base::UTF16ToUTF8(version_info->product_name());
   }
 
   return "Atom-Shell";
index c853cf6..3b95926 100644 (file)
@@ -507,7 +507,7 @@ void NativeWindow::Observe(int type,
 
     if (title->first) {
       bool prevent_default = false;
-      std::string text = UTF16ToUTF8(title->first->GetTitle());
+      std::string text = base::UTF16ToUTF8(title->first->GetTitle());
       FOR_EACH_OBSERVER(NativeWindowObserver,
                         observers_,
                         OnPageTitleUpdated(&prevent_default, text));
index 1ad84ba..64c96ba 100644 (file)
@@ -378,12 +378,14 @@ bool NativeWindowViews::ShouldDescendIntoChildForEventHandling(
       draggable_region_->contains(location.x(), location.y()))
     return false;
 
+#if defined(USE_X11)
   // And the events on border for dragging resizable frameless window.
   if (!has_frame_ && CanResize()) {
     LinuxFrameView* frame = static_cast<LinuxFrameView*>(
         window_->non_client_view()->frame_view());
     return frame->ResizingBorderHitTest(location) == HTNOWHERE;
   }
+#endif
 
   return true;
 }
index fa1c765..e0754ee 100644 (file)
@@ -25,8 +25,8 @@ namespace {
 
 // Distinguish directories from regular files.
 bool IsDirectory(const base::FilePath& path) {
-  base::PlatformFileInfo file_info;
-  return file_util::GetFileInfo(path, &file_info) ?
+  base::File::Info file_info;
+  return base::GetFileInfo(path, &file_info) ?
       file_info.is_directory : path.EndsWithSeparator();
 }
 
@@ -105,7 +105,7 @@ void FormatFilterForExtensions(
         // the we create a description "QQQ File (.qqq)").
         include_all_files = true;
         // 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")";
 
@@ -157,14 +157,16 @@ class FileDialog {
         filters.size()));
 
     if (!title.empty())
-      GetPtr()->SetTitle(UTF8ToUTF16(title).c_str());
+      GetPtr()->SetTitle(base::UTF8ToUTF16(title).c_str());
 
     SetDefaultFolder(default_path);
   }
 
   bool Show(atom::NativeWindow* 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;
   }
 
index fddee1c..105f223 100644 (file)
@@ -107,7 +107,7 @@ void NotifyIcon::SetToolTip(const std::string& tool_tip) {
   NOTIFYICONDATA icon_data;
   InitIconData(&icon_data);
   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);
   if (!result)
     LOG(WARNING) << "Unable to set tooltip for status tray icon";
index f6b1b8f..f227c32 100644 (file)
@@ -1,14 +1,14 @@
-// Copyright (c) 2014 GitHub, Inc. All rights reserved.
-// Use of this source code is governed by the MIT license that can be
-// found in the LICENSE file.
-
-// This file is generated by script/bootstrap.py, you should never modify it
-// by hand.
-
-#ifndef ATOM_COMMON_CHROME_VERSION_H_
-#define ATOM_COMMON_CHROME_VERSION_H_
-
-#define CHROME_VERSION_STRING "35.0.1916.153"
-#define CHROME_VERSION "v" CHROME_VERSION_STRING
-
-#endif  // ATOM_COMMON_CHROME_VERSION_H_
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.\r
+// Use of this source code is governed by the MIT license that can be\r
+// found in the LICENSE file.\r
+\r
+// This file is generated by script/bootstrap.py, you should never modify it\r
+// by hand.\r
+\r
+#ifndef ATOM_COMMON_CHROME_VERSION_H_\r
+#define ATOM_COMMON_CHROME_VERSION_H_\r
+\r
+#define CHROME_VERSION_STRING "35.0.1916.153"\r
+#define CHROME_VERSION "v" CHROME_VERSION_STRING\r
+\r
+#endif  // ATOM_COMMON_CHROME_VERSION_H_\r
index 6e73249..6a581cc 100644 (file)
@@ -40,14 +40,13 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
   skip_system_crash_handler_ = skip_system_crash_handler;
 
   base::FilePath temp_dir;
-  if (!file_util::GetTempDir(&temp_dir)) {
+  if (!base::GetTempDir(&temp_dir)) {
     LOG(ERROR) << "Cannot get temp directory";
     return;
   }
 
-  base::string16 pipe_name = ReplaceStringPlaceholders(kPipeNameFormat,
-                                                 UTF8ToUTF16(product_name),
-                                                 NULL);
+  base::string16 pipe_name = ReplaceStringPlaceholders(
+      kPipeNameFormat, base::UTF8ToUTF16(product_name), NULL);
 
   // Wait until the crash service is started.
   HANDLE waiting_event =
@@ -104,13 +103,13 @@ google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo(
   custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
       L"prod", L"Atom-Shell"));
   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();
        iter != upload_parameters_.end(); ++iter) {
     custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
-        UTF8ToWide(iter->first).c_str(),
-        UTF8ToWide(iter->second).c_str()));
+        base::UTF8ToWide(iter->first).c_str(),
+        base::UTF8ToWide(iter->second).c_str()));
   }
 
   custom_info_.entries = &custom_info_entries_.front();
index 4ee0770..5cb6f98 100644 (file)
@@ -347,7 +347,7 @@ void CrashService::OnClientDumpRequest(void* context,
   CrashMap::const_iterator it = map.find(L"breakpad-dump-location");
   if (it != map.end()) {
     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(
         dump_location.BaseName());
     base::Move(dump_location, alternate_dump_location);
index 77b8848..314fc4d 100644 (file)
@@ -23,11 +23,11 @@ const wchar_t kStandardLogFile[] = L"operation_log.txt";
 bool GetCrashServiceDirectory(const std::wstring& application_name,
                               base::FilePath* dir) {
   base::FilePath temp_dir;
-  if (!file_util::GetTempDir(&temp_dir))
+  if (!base::GetTempDir(&temp_dir))
     return false;
   temp_dir = temp_dir.Append(application_name + L" Crashes");
   if (!base::PathExists(temp_dir)) {
-    if (!file_util::CreateDirectory(temp_dir))
+    if (!base::CreateDirectory(temp_dir))
       return false;
   }
   *dir = temp_dir;
index 5703810..2d5d836 100644 (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
 // 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) \
   extern "C" void _register_ ## name(void); \
   void (*fp_register_ ## name)(void) = _register_ ## name
-#endif
 // Node's builtin modules.
 REFERENCE_MODULE(cares_wrap);
 REFERENCE_MODULE(fs_event_wrap);
@@ -103,11 +98,11 @@ scoped_ptr<const char*[]> StringVectorToArgArray(
 
 #if defined(OS_WIN)
 std::vector<std::string> String16VectorToStringVector(
-    const std::vector<string16>& vector) {
+    const std::vector<base::string16>& vector) {
   std::vector<std::string> utf8_vector;
   utf8_vector.reserve(vector.size());
   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;
 }
 #endif
index 52e87ac..23576be 100644 (file)
@@ -29,7 +29,7 @@ namespace {
 // is empty. This function tells if it is.
 bool ValidateShellCommandForScheme(const std::string& scheme) {
   base::win::RegKey key;
-  std::wstring registry_path = ASCIIToWide(scheme) +
+  std::wstring registry_path = base::ASCIIToWide(scheme) +
                                L"\\shell\\open\\command";
   key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ);
   if (!key.Valid())
index 48bccd8..9f69382 100644 (file)
@@ -34,6 +34,9 @@
         ['exclude', '_linux(_unittest)?\\.(h|cc)$'],
         ['exclude', '(^|/)linux_[^/]*\\.(h|cc)$'],
         ['exclude', '(^|/)linux/'],
+        ['exclude', '_x11(_unittest)?\\.(h|cc)$'],
+        ['exclude', '(^|/)x11_[^/]*\\.(h|cc)$'],
+        ['exclude', '(^|/)x11/'],
       ],
     }],
     ['OS!="android"', {