refactor: chromium-style warnings in linux code (#12949)
This commit is contained in:
parent
2a161e1725
commit
da0fd10423
21 changed files with 41 additions and 36 deletions
|
@ -1592,12 +1592,12 @@ void WebContents::Focus() {
|
||||||
|
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
bool WebContents::IsFocused() const {
|
bool WebContents::IsFocused() const {
|
||||||
auto view = web_contents()->GetRenderWidgetHostView();
|
auto* view = web_contents()->GetRenderWidgetHostView();
|
||||||
if (!view)
|
if (!view)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (GetType() != BACKGROUND_PAGE) {
|
if (GetType() != BACKGROUND_PAGE) {
|
||||||
auto window = web_contents()->GetNativeView()->GetToplevelWindow();
|
auto* window = web_contents()->GetNativeView()->GetToplevelWindow();
|
||||||
if (window && !window->IsVisible())
|
if (window && !window->IsVisible())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ bool SetDefaultWebClient(const std::string& protocol) {
|
||||||
|
|
||||||
void Browser::Focus() {
|
void Browser::Focus() {
|
||||||
// Focus on the first visible window.
|
// Focus on the first visible window.
|
||||||
for (const auto& window : WindowList::GetWindows()) {
|
for (auto* const window : WindowList::GetWindows()) {
|
||||||
if (window->IsVisible()) {
|
if (window->IsVisible()) {
|
||||||
window->Focus(true);
|
window->Focus(true);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace atom {
|
||||||
|
|
||||||
PowerObserverLinux::PowerObserverLinux()
|
PowerObserverLinux::PowerObserverLinux()
|
||||||
: lock_owner_name_(get_executable_basename()), weak_ptr_factory_(this) {
|
: lock_owner_name_(get_executable_basename()), weak_ptr_factory_(this) {
|
||||||
auto dbus_thread_manager = bluez::DBusThreadManagerLinux::Get();
|
auto* dbus_thread_manager = bluez::DBusThreadManagerLinux::Get();
|
||||||
if (dbus_thread_manager) {
|
if (dbus_thread_manager) {
|
||||||
bus_ = dbus_thread_manager->GetSystemBus();
|
bus_ = dbus_thread_manager->GetSystemBus();
|
||||||
if (bus_) {
|
if (bus_) {
|
||||||
|
@ -49,6 +49,8 @@ PowerObserverLinux::PowerObserverLinux()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PowerObserverLinux::~PowerObserverLinux() = default;
|
||||||
|
|
||||||
void PowerObserverLinux::OnLoginServiceAvailable(bool service_available) {
|
void PowerObserverLinux::OnLoginServiceAvailable(bool service_available) {
|
||||||
if (!service_available) {
|
if (!service_available) {
|
||||||
LOG(WARNING) << kLogindServiceName << " not available";
|
LOG(WARNING) << kLogindServiceName << " not available";
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace atom {
|
||||||
class PowerObserverLinux : public base::PowerObserver {
|
class PowerObserverLinux : public base::PowerObserver {
|
||||||
public:
|
public:
|
||||||
PowerObserverLinux();
|
PowerObserverLinux();
|
||||||
|
~PowerObserverLinux() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void BlockSleep();
|
void BlockSleep();
|
||||||
|
|
|
@ -17,6 +17,10 @@ NativeBrowserViewViews::NativeBrowserViewViews(
|
||||||
|
|
||||||
NativeBrowserViewViews::~NativeBrowserViewViews() {}
|
NativeBrowserViewViews::~NativeBrowserViewViews() {}
|
||||||
|
|
||||||
|
void NativeBrowserViewViews::SetAutoResizeFlags(uint8_t flags) {
|
||||||
|
auto_resize_flags_ = flags;
|
||||||
|
}
|
||||||
|
|
||||||
void NativeBrowserViewViews::SetBounds(const gfx::Rect& bounds) {
|
void NativeBrowserViewViews::SetBounds(const gfx::Rect& bounds) {
|
||||||
auto* view = GetInspectableWebContentsView()->GetView();
|
auto* view = GetInspectableWebContentsView()->GetView();
|
||||||
view->SetBoundsRect(bounds);
|
view->SetBoundsRect(bounds);
|
||||||
|
|
|
@ -16,9 +16,7 @@ class NativeBrowserViewViews : public NativeBrowserView {
|
||||||
~NativeBrowserViewViews() override;
|
~NativeBrowserViewViews() override;
|
||||||
|
|
||||||
uint8_t GetAutoResizeFlags() { return auto_resize_flags_; }
|
uint8_t GetAutoResizeFlags() { return auto_resize_flags_; }
|
||||||
void SetAutoResizeFlags(uint8_t flags) override {
|
void SetAutoResizeFlags(uint8_t flags) override;
|
||||||
auto_resize_flags_ = flags;
|
|
||||||
}
|
|
||||||
void SetBounds(const gfx::Rect& bounds) override;
|
void SetBounds(const gfx::Rect& bounds) override;
|
||||||
void SetBackgroundColor(SkColor color) override;
|
void SetBackgroundColor(SkColor color) override;
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class NativeWindowClientView : public views::ClientView {
|
||||||
views::View* root_view,
|
views::View* root_view,
|
||||||
NativeWindowViews* window)
|
NativeWindowViews* window)
|
||||||
: views::ClientView(widget, root_view), window_(window) {}
|
: views::ClientView(widget, root_view), window_(window) {}
|
||||||
virtual ~NativeWindowClientView() {}
|
~NativeWindowClientView() override = default;
|
||||||
|
|
||||||
bool CanClose() override {
|
bool CanClose() override {
|
||||||
window_->NotifyWindowCloseButtonClicked();
|
window_->NotifyWindowCloseButtonClicked();
|
||||||
|
|
|
@ -783,6 +783,10 @@ void OffScreenRenderWidgetHostView::CompositorResizeLockEnded() {
|
||||||
ReleaseResize();
|
ReleaseResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OffScreenRenderWidgetHostView::IsAutoResizeEnabled() const {
|
||||||
|
return render_widget_host_->auto_resize_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !defined(OS_MACOSX)
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
bool OffScreenRenderWidgetHostView::TransformPointToLocalCoordSpace(
|
bool OffScreenRenderWidgetHostView::TransformPointToLocalCoordSpace(
|
||||||
|
@ -913,10 +917,6 @@ bool OffScreenRenderWidgetHostView::InstallTransparency() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OffScreenRenderWidgetHostView::IsAutoResizeEnabled() const {
|
|
||||||
return render_widget_host_->auto_resize_enabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::SetNeedsBeginFrames(
|
void OffScreenRenderWidgetHostView::SetNeedsBeginFrames(
|
||||||
bool needs_begin_frames) {
|
bool needs_begin_frames) {
|
||||||
SetupFrameRate(true);
|
SetupFrameRate(true);
|
||||||
|
|
|
@ -184,6 +184,7 @@ class OffScreenRenderWidgetHostView
|
||||||
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
|
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
|
||||||
ui::CompositorLockClient* client) override;
|
ui::CompositorLockClient* client) override;
|
||||||
void CompositorResizeLockEnded() override;
|
void CompositorResizeLockEnded() override;
|
||||||
|
bool IsAutoResizeEnabled() const override;
|
||||||
#endif // !defined(OS_MACOSX)
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
bool TransformPointToLocalCoordSpace(const gfx::Point& point,
|
bool TransformPointToLocalCoordSpace(const gfx::Point& point,
|
||||||
|
@ -199,7 +200,6 @@ class OffScreenRenderWidgetHostView
|
||||||
ui::Compositor* compositor) override;
|
ui::Compositor* compositor) override;
|
||||||
|
|
||||||
bool InstallTransparency();
|
bool InstallTransparency();
|
||||||
bool IsAutoResizeEnabled() const;
|
|
||||||
|
|
||||||
// NativeWindowObserver:
|
// NativeWindowObserver:
|
||||||
void OnWindowResize() override;
|
void OnWindowResize() override;
|
||||||
|
|
|
@ -43,7 +43,7 @@ gfx::NativeView OffScreenWebContentsView::GetNativeView() const {
|
||||||
if (!web_contents_)
|
if (!web_contents_)
|
||||||
return gfx::NativeView();
|
return gfx::NativeView();
|
||||||
|
|
||||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||||
if (!relay)
|
if (!relay)
|
||||||
return gfx::NativeView();
|
return gfx::NativeView();
|
||||||
return relay->window->GetNativeView();
|
return relay->window->GetNativeView();
|
||||||
|
@ -53,7 +53,7 @@ gfx::NativeView OffScreenWebContentsView::GetContentNativeView() const {
|
||||||
if (!web_contents_)
|
if (!web_contents_)
|
||||||
return gfx::NativeView();
|
return gfx::NativeView();
|
||||||
|
|
||||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||||
if (!relay)
|
if (!relay)
|
||||||
return gfx::NativeView();
|
return gfx::NativeView();
|
||||||
return relay->window->GetNativeView();
|
return relay->window->GetNativeView();
|
||||||
|
@ -63,7 +63,7 @@ gfx::NativeWindow OffScreenWebContentsView::GetTopLevelNativeWindow() const {
|
||||||
if (!web_contents_)
|
if (!web_contents_)
|
||||||
return gfx::NativeWindow();
|
return gfx::NativeWindow();
|
||||||
|
|
||||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||||
if (!relay)
|
if (!relay)
|
||||||
return gfx::NativeWindow();
|
return gfx::NativeWindow();
|
||||||
return relay->window->GetNativeWindow();
|
return relay->window->GetNativeWindow();
|
||||||
|
|
|
@ -86,7 +86,7 @@ class GtkMessageBox : public NativeWindowObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~GtkMessageBox() {
|
~GtkMessageBox() override {
|
||||||
gtk_widget_destroy(dialog_);
|
gtk_widget_destroy(dialog_);
|
||||||
if (parent_) {
|
if (parent_) {
|
||||||
parent_->RemoveObserver(this);
|
parent_->RemoveObserver(this);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace atom {
|
||||||
class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
|
class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
|
||||||
public:
|
public:
|
||||||
TrayIconGtk();
|
TrayIconGtk();
|
||||||
virtual ~TrayIconGtk();
|
~TrayIconGtk() override;
|
||||||
|
|
||||||
// TrayIcon:
|
// TrayIcon:
|
||||||
void SetImage(const gfx::Image& image) override;
|
void SetImage(const gfx::Image& image) override;
|
||||||
|
|
|
@ -38,7 +38,7 @@ AutofillPopupView::AutofillPopupView(AutofillPopup* popup,
|
||||||
|
|
||||||
AutofillPopupView::~AutofillPopupView() {
|
AutofillPopupView::~AutofillPopupView() {
|
||||||
if (popup_) {
|
if (popup_) {
|
||||||
auto host = popup_->frame_host_->GetRenderViewHost()->GetWidget();
|
auto* host = popup_->frame_host_->GetRenderViewHost()->GetWidget();
|
||||||
host->RemoveKeyPressEventCallback(keypress_callback_);
|
host->RemoveKeyPressEventCallback(keypress_callback_);
|
||||||
popup_->view_ = nullptr;
|
popup_->view_ = nullptr;
|
||||||
popup_ = nullptr;
|
popup_ = nullptr;
|
||||||
|
@ -100,7 +100,7 @@ void AutofillPopupView::Show() {
|
||||||
|
|
||||||
keypress_callback_ = base::Bind(&AutofillPopupView::HandleKeyPressEvent,
|
keypress_callback_ = base::Bind(&AutofillPopupView::HandleKeyPressEvent,
|
||||||
base::Unretained(this));
|
base::Unretained(this));
|
||||||
auto host = popup_->frame_host_->GetRenderViewHost()->GetWidget();
|
auto* host = popup_->frame_host_->GetRenderViewHost()->GetWidget();
|
||||||
host->AddKeyPressEventCallback(keypress_callback_);
|
host->AddKeyPressEventCallback(keypress_callback_);
|
||||||
|
|
||||||
NotifyAccessibilityEvent(ui::AX_EVENT_MENU_START, true);
|
NotifyAccessibilityEvent(ui::AX_EVENT_MENU_START, true);
|
||||||
|
@ -108,7 +108,7 @@ void AutofillPopupView::Show() {
|
||||||
|
|
||||||
void AutofillPopupView::Hide() {
|
void AutofillPopupView::Hide() {
|
||||||
if (popup_) {
|
if (popup_) {
|
||||||
auto host = popup_->frame_host_->GetRenderViewHost()->GetWidget();
|
auto* host = popup_->frame_host_->GetRenderViewHost()->GetWidget();
|
||||||
host->RemoveKeyPressEventCallback(keypress_callback_);
|
host->RemoveKeyPressEventCallback(keypress_callback_);
|
||||||
popup_ = nullptr;
|
popup_ = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ void AutofillPopupView::CreateChildViews() {
|
||||||
RemoveAllChildViews(true);
|
RemoveAllChildViews(true);
|
||||||
|
|
||||||
for (int i = 0; i < popup_->GetLineCount(); ++i) {
|
for (int i = 0; i < popup_->GetLineCount(); ++i) {
|
||||||
auto child_view = new AutofillPopupChildView(popup_->GetValueAt(i));
|
auto* child_view = new AutofillPopupChildView(popup_->GetValueAt(i));
|
||||||
child_view->set_drag_controller(this);
|
child_view->set_drag_controller(this);
|
||||||
AddChildView(child_view);
|
AddChildView(child_view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);
|
||||||
const char MenuBar::kViewClassName[] = "ElectronMenuBar";
|
const char MenuBar::kViewClassName[] = "ElectronMenuBar";
|
||||||
|
|
||||||
MenuBar::MenuBar(views::View* window)
|
MenuBar::MenuBar(views::View* window)
|
||||||
: background_color_(kDefaultColor), menu_model_(NULL), window_(window) {
|
: background_color_(kDefaultColor), window_(window), menu_model_(NULL) {
|
||||||
RefreshColorCache();
|
RefreshColorCache();
|
||||||
UpdateViewColors();
|
UpdateViewColors();
|
||||||
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal));
|
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal));
|
||||||
|
@ -60,7 +60,7 @@ bool MenuBar::HasAccelerator(base::char16 key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::ActivateAccelerator(base::char16 key) {
|
void MenuBar::ActivateAccelerator(base::char16 key) {
|
||||||
auto child = FindAccelChild(key);
|
auto* child = FindAccelChild(key);
|
||||||
if (child)
|
if (child)
|
||||||
static_cast<SubmenuButton*>(child)->Activate(nullptr);
|
static_cast<SubmenuButton*>(child)->Activate(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ void MenuBar::OnDidChangeFocus(View* focused_before, View* focused_now) {
|
||||||
void MenuBar::RebuildChildren() {
|
void MenuBar::RebuildChildren() {
|
||||||
RemoveAllChildViews(true);
|
RemoveAllChildViews(true);
|
||||||
for (int i = 0, n = GetItemCount(); i < n; ++i) {
|
for (int i = 0, n = GetItemCount(); i < n; ++i) {
|
||||||
auto button =
|
auto* button =
|
||||||
new SubmenuButton(menu_model_->GetLabelAt(i), this, background_color_);
|
new SubmenuButton(menu_model_->GetLabelAt(i), this, background_color_);
|
||||||
button->set_tag(i);
|
button->set_tag(i);
|
||||||
AddChildView(button);
|
AddChildView(button);
|
||||||
|
@ -168,7 +168,7 @@ void MenuBar::UpdateViewColors() {
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
const auto& textColor = has_focus_ ? enabled_color_ : disabled_color_;
|
const auto& textColor = has_focus_ ? enabled_color_ : disabled_color_;
|
||||||
for (auto* child : GetChildrenInZOrder()) {
|
for (auto* child : GetChildrenInZOrder()) {
|
||||||
auto button = static_cast<SubmenuButton*>(child);
|
auto* button = static_cast<SubmenuButton*>(child);
|
||||||
button->SetTextColor(views::Button::STATE_NORMAL, textColor);
|
button->SetTextColor(views::Button::STATE_NORMAL, textColor);
|
||||||
button->SetTextColor(views::Button::STATE_DISABLED, disabled_color_);
|
button->SetTextColor(views::Button::STATE_DISABLED, disabled_color_);
|
||||||
button->SetTextColor(views::Button::STATE_PRESSED, enabled_color_);
|
button->SetTextColor(views::Button::STATE_PRESSED, enabled_color_);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class MenuBar : public views::View,
|
||||||
static const char kViewClassName[];
|
static const char kViewClassName[];
|
||||||
|
|
||||||
explicit MenuBar(views::View* window);
|
explicit MenuBar(views::View* window);
|
||||||
virtual ~MenuBar();
|
~MenuBar() override;
|
||||||
|
|
||||||
// Replaces current menu with a new one.
|
// Replaces current menu with a new one.
|
||||||
void SetMenu(AtomMenuModel* menu_model);
|
void SetMenu(AtomMenuModel* menu_model);
|
||||||
|
|
|
@ -21,7 +21,7 @@ class MenuBar;
|
||||||
class MenuDelegate : public views::MenuDelegate {
|
class MenuDelegate : public views::MenuDelegate {
|
||||||
public:
|
public:
|
||||||
explicit MenuDelegate(MenuBar* menu_bar);
|
explicit MenuDelegate(MenuBar* menu_bar);
|
||||||
virtual ~MenuDelegate();
|
~MenuDelegate() override;
|
||||||
|
|
||||||
void RunMenu(AtomMenuModel* model, views::MenuButton* button);
|
void RunMenu(AtomMenuModel* model, views::MenuButton* button);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class SubmenuButton : public views::MenuButton {
|
||||||
SubmenuButton(const base::string16& title,
|
SubmenuButton(const base::string16& title,
|
||||||
views::MenuButtonListener* menu_button_listener,
|
views::MenuButtonListener* menu_button_listener,
|
||||||
const SkColor& background_color);
|
const SkColor& background_color);
|
||||||
virtual ~SubmenuButton();
|
~SubmenuButton() override;
|
||||||
|
|
||||||
void SetAcceleratorVisibility(bool visible);
|
void SetAcceleratorVisibility(bool visible);
|
||||||
void SetUnderlineColor(SkColor color);
|
void SetUnderlineColor(SkColor color);
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace atom {
|
||||||
class WindowStateWatcher : public ui::PlatformEventObserver {
|
class WindowStateWatcher : public ui::PlatformEventObserver {
|
||||||
public:
|
public:
|
||||||
explicit WindowStateWatcher(NativeWindowViews* window);
|
explicit WindowStateWatcher(NativeWindowViews* window);
|
||||||
virtual ~WindowStateWatcher();
|
~WindowStateWatcher() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// ui::PlatformEventObserver:
|
// ui::PlatformEventObserver:
|
||||||
|
|
|
@ -43,7 +43,7 @@ class CrashReporterLinux : public CrashReporter {
|
||||||
friend struct base::DefaultSingletonTraits<CrashReporterLinux>;
|
friend struct base::DefaultSingletonTraits<CrashReporterLinux>;
|
||||||
|
|
||||||
CrashReporterLinux();
|
CrashReporterLinux();
|
||||||
virtual ~CrashReporterLinux();
|
~CrashReporterLinux() override;
|
||||||
|
|
||||||
void EnableCrashDumping(const base::FilePath& crashes_dir);
|
void EnableCrashDumping(const base::FilePath& crashes_dir);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace atom {
|
||||||
class NodeBindingsLinux : public NodeBindings {
|
class NodeBindingsLinux : public NodeBindings {
|
||||||
public:
|
public:
|
||||||
explicit NodeBindingsLinux(BrowserEnvironment browser_env);
|
explicit NodeBindingsLinux(BrowserEnvironment browser_env);
|
||||||
virtual ~NodeBindingsLinux();
|
~NodeBindingsLinux() override;
|
||||||
|
|
||||||
void RunMessageLoop() override;
|
void RunMessageLoop() override;
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,12 @@ class ColorChooserAura : public content::ColorChooser,
|
||||||
ColorChooserAura(content::WebContents* web_contents, SkColor initial_color);
|
ColorChooserAura(content::WebContents* web_contents, SkColor initial_color);
|
||||||
|
|
||||||
// content::ColorChooser overrides:
|
// content::ColorChooser overrides:
|
||||||
virtual void End() override;
|
void End() override;
|
||||||
virtual void SetSelectedColor(SkColor color) override;
|
void SetSelectedColor(SkColor color) override;
|
||||||
|
|
||||||
// views::ColorChooserListener overrides:
|
// views::ColorChooserListener overrides:
|
||||||
virtual void OnColorChosen(SkColor color) override;
|
void OnColorChosen(SkColor color) override;
|
||||||
virtual void OnColorChooserDialogClosed() override;
|
void OnColorChooserDialogClosed() override;
|
||||||
|
|
||||||
void DidEndColorChooser();
|
void DidEndColorChooser();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue