From b3d60bfb3a74d1378728ec6a9801ff7d91815f1d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 17 Apr 2017 17:17:02 +0900 Subject: [PATCH] Fix building on Linux --- atom/browser/api/atom_api_app.cc | 4 ++-- atom/browser/native_window_views.cc | 17 +++++++++-------- atom/browser/ui/message_box_gtk.cc | 8 ++++---- atom/browser/ui/views/global_menu_bar_x11.cc | 4 +++- atom/browser/ui/views/submenu_button.cc | 6 +++--- .../native_mate_converters/blink_converter.cc | 2 +- .../chrome/browser/certificate_manager_model.cc | 4 ++-- .../chrome/browser/certificate_manager_model.h | 2 +- .../pepper/pepper_flash_font_file_host.cc | 3 ++- vendor/brightray | 2 +- 10 files changed, 28 insertions(+), 24 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 115041d0082d..168628b16a69 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -453,8 +453,8 @@ int ImportIntoCertStore( if (!cert_path.empty()) { if (base::ReadFileToString(base::FilePath(cert_path), &file_data)) { - auto module = model->cert_db()->GetPublicModule(); - rv = model->ImportFromPKCS12(module, + auto module = model->cert_db()->GetPrivateSlot(); + rv = model->ImportFromPKCS12(module.get(), file_data, password, true, diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 7e6f23947c29..ed524cbdcbc1 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -86,7 +86,7 @@ bool IsAltKey(const content::NativeWebKeyboardEvent& event) { bool IsAltModifier(const content::NativeWebKeyboardEvent& event) { typedef content::NativeWebKeyboardEvent::Modifiers Modifiers; - int modifiers = event.modifiers; + int modifiers = event.modifiers(); modifiers &= ~Modifiers::NumLockOn; modifiers &= ~Modifiers::CapsLockOn; return (modifiers == Modifiers::AltKey) || @@ -767,13 +767,14 @@ void NativeWindowViews::SetBackgroundColor(const std::string& color_name) { } void NativeWindowViews::SetHasShadow(bool has_shadow) { - wm::SetShadowType( + wm::SetShadowElevation( GetNativeWindow(), - has_shadow ? wm::SHADOW_TYPE_RECTANGULAR : wm::SHADOW_TYPE_NONE); + has_shadow ? wm::ShadowElevation::MEDIUM : wm::ShadowElevation::NONE); } bool NativeWindowViews::HasShadow() { - return wm::GetShadowType(GetNativeWindow()) != wm::SHADOW_TYPE_NONE; + return GetNativeWindow()->GetProperty(wm::kShadowElevationKey) + != wm::ShadowElevation::NONE; } void NativeWindowViews::SetIgnoreMouseEvents(bool ignore) { @@ -1234,10 +1235,10 @@ void NativeWindowViews::HandleKeyboardEvent( // Show accelerator when "Alt" is pressed. if (menu_bar_visible_ && IsAltKey(event)) menu_bar_->SetAcceleratorVisibility( - event.type == blink::WebInputEvent::RawKeyDown); + event.type() == blink::WebInputEvent::RawKeyDown); // Show the submenu when "Alt+Key" is pressed. - if (event.type == blink::WebInputEvent::RawKeyDown && !IsAltKey(event) && + if (event.type() == blink::WebInputEvent::RawKeyDown && !IsAltKey(event) && IsAltModifier(event)) { if (!menu_bar_visible_ && (menu_bar_->GetAcceleratorIndex(event.windowsKeyCode) != -1)) @@ -1250,10 +1251,10 @@ void NativeWindowViews::HandleKeyboardEvent( return; // Toggle the menu bar only when a single Alt is released. - if (event.type == blink::WebInputEvent::RawKeyDown && IsAltKey(event)) { + if (event.type() == blink::WebInputEvent::RawKeyDown && IsAltKey(event)) { // When a single Alt is pressed: menu_bar_alt_pressed_ = true; - } else if (event.type == blink::WebInputEvent::KeyUp && IsAltKey(event) && + } else if (event.type() == blink::WebInputEvent::KeyUp && IsAltKey(event) && menu_bar_alt_pressed_) { // When a single Alt is released right after a Alt is pressed: menu_bar_alt_pressed_ = false; diff --git a/atom/browser/ui/message_box_gtk.cc b/atom/browser/ui/message_box_gtk.cc index a7bbe51ecf13..ffaa0a76cd71 100644 --- a/atom/browser/ui/message_box_gtk.cc +++ b/atom/browser/ui/message_box_gtk.cc @@ -41,7 +41,7 @@ class GtkMessageBox : public NativeWindowObserver { const gfx::ImageSkia& icon) : cancel_id_(cancel_id), checkbox_checked_(false), - parent_(static_cast(parent_window)) { + parent_(static_cast(parent_window)) { // Create dialog. dialog_ = gtk_message_dialog_new( nullptr, // parent @@ -94,7 +94,7 @@ class GtkMessageBox : public NativeWindowObserver { // Parent window. if (parent_) { parent_->AddObserver(this); - parent_->SetEnabled(false); + static_cast(parent_)->SetEnabled(false); libgtkui::SetGtkTransientForAura(dialog_, parent_->GetNativeWindow()); gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); } @@ -104,7 +104,7 @@ class GtkMessageBox : public NativeWindowObserver { gtk_widget_destroy(dialog_); if (parent_) { parent_->RemoveObserver(this); - parent_->SetEnabled(true); + static_cast(parent_)->SetEnabled(true); } } @@ -179,7 +179,7 @@ class GtkMessageBox : public NativeWindowObserver { bool checkbox_checked_; - NativeWindowViews* parent_; + NativeWindow* parent_; GtkWidget* dialog_; MessageBoxCallback callback_; diff --git a/atom/browser/ui/views/global_menu_bar_x11.cc b/atom/browser/ui/views/global_menu_bar_x11.cc index 266d10b96db9..eb5a8d81d23d 100644 --- a/atom/browser/ui/views/global_menu_bar_x11.cc +++ b/atom/browser/ui/views/global_menu_bar_x11.cc @@ -4,6 +4,9 @@ #include "atom/browser/ui/views/global_menu_bar_x11.h" +// There are conflicts between Xlib.h and this header. +#include "atom/browser/native_window_views.h" // NOLINT + #include // This conflicts with mate::Converter, @@ -15,7 +18,6 @@ #include #include -#include "atom/browser/native_window_views.h" #include "atom/browser/ui/atom_menu_model.h" #include "base/logging.h" #include "base/strings/stringprintf.h" diff --git a/atom/browser/ui/views/submenu_button.cc b/atom/browser/ui/views/submenu_button.cc index 617dd3346dad..aabed323d2b7 100644 --- a/atom/browser/ui/views/submenu_button.cc +++ b/atom/browser/ui/views/submenu_button.cc @@ -36,7 +36,7 @@ SubmenuButton::SubmenuButton(const base::string16& title, if (GetUnderlinePosition(title, &accelerator_, &underline_start_, &underline_end_)) - gfx::Canvas::SizeStringInt(GetText(), GetFontList(), &text_width_, + gfx::Canvas::SizeStringInt(GetText(), gfx::FontList(), &text_width_, &text_height_, 0, 0); SetInkDropMode(InkDropMode::ON); @@ -107,8 +107,8 @@ bool SubmenuButton::GetUnderlinePosition(const base::string16& text, void SubmenuButton::GetCharacterPosition( const base::string16& text, int index, int* pos) { int height = 0; - gfx::Canvas::SizeStringInt(text.substr(0, index), GetFontList(), pos, &height, - 0, 0); + gfx::Canvas::SizeStringInt(text.substr(0, index), gfx::FontList(), pos, + &height, 0, 0); } } // namespace atom diff --git a/atom/common/native_mate_converters/blink_converter.cc b/atom/common/native_mate_converters/blink_converter.cc index 6633ef887dc2..c70ffe213919 100644 --- a/atom/common/native_mate_converters/blink_converter.cc +++ b/atom/common/native_mate_converters/blink_converter.cc @@ -280,7 +280,7 @@ bool Converter::FromV8( bool can_scroll = true; if (dict.Get("canScroll", &can_scroll) && !can_scroll) { out->hasPreciseScrollingDeltas = false; - out->modifiers &= ~blink::WebInputEvent::ControlKey; + out->setModifiers(out->modifiers() | blink::WebInputEvent::ControlKey); } #endif return true; diff --git a/chromium_src/chrome/browser/certificate_manager_model.cc b/chromium_src/chrome/browser/certificate_manager_model.cc index 2274c09e3415..5f073478cdc0 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.cc +++ b/chromium_src/chrome/browser/certificate_manager_model.cc @@ -92,12 +92,12 @@ CertificateManagerModel::CertificateManagerModel( CertificateManagerModel::~CertificateManagerModel() { } -int CertificateManagerModel::ImportFromPKCS12(net::CryptoModule* module, +int CertificateManagerModel::ImportFromPKCS12(PK11SlotInfo* slot_info, const std::string& data, const base::string16& password, bool is_extractable, net::CertificateList* imported_certs) { - return cert_db_->ImportFromPKCS12(module, data, password, + return cert_db_->ImportFromPKCS12(slot_info, data, password, is_extractable, imported_certs); } diff --git a/chromium_src/chrome/browser/certificate_manager_model.h b/chromium_src/chrome/browser/certificate_manager_model.h index 7646da5b9b4d..eb84b69f733c 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.h +++ b/chromium_src/chrome/browser/certificate_manager_model.h @@ -44,7 +44,7 @@ class CertificateManagerModel { // |data|, using the given |password|. If |is_extractable| is false, // mark the private key as unextractable from the module. // Returns a net error code on failure. - int ImportFromPKCS12(net::CryptoModule* module, + int ImportFromPKCS12(PK11SlotInfo* slot_info, const std::string& data, const base::string16& password, bool is_extractable, diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc b/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc index c10970933350..450f9f893981 100644 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc +++ b/chromium_src/chrome/renderer/pepper/pepper_flash_font_file_host.cc @@ -15,7 +15,8 @@ #include "ppapi/proxy/serialized_structs.h" #if defined(OS_LINUX) || defined(OS_OPENBSD) -#include "content/public/common/child_process_sandbox_support_linux.h" +#include "content/public/child/child_process_sandbox_support_linux.h" +#include "content/public/common/common_sandbox_support_linux.h" #elif defined(OS_WIN) #include "third_party/skia/include/ports/SkFontMgr.h" #endif diff --git a/vendor/brightray b/vendor/brightray index 5e08ec992316..3e77e9faa16f 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 5e08ec992316520c3c1643b1e3569f297556b8bb +Subproject commit 3e77e9faa16fcbda5fe740e1f2332201cf423c56