Browse Source

various fixes for macos

gellert 8 years ago
parent
commit
039908a244

+ 5 - 5
atom/browser/native_window_mac.h

@@ -89,9 +89,9 @@ class NativeWindowMac : public NativeWindow,
   void SetContentProtection(bool enable) override;
   void SetBrowserView(NativeBrowserView* browser_view) override;
   void SetParentWindow(NativeWindow* parent) override;
-  gfx::NativeView GetNativeView() override;
-  gfx::NativeWindow GetNativeWindow() override;
-  gfx::AcceleratedWidget GetAcceleratedWidget() override;
+  gfx::NativeView GetNativeView() const override;
+  gfx::NativeWindow GetNativeWindow() const override;
+  gfx::AcceleratedWidget GetAcceleratedWidget() const override;
   void SetProgressBar(double progress, const ProgressState state) override;
   void SetOverlayIcon(const gfx::Image& overlay,
                       const std::string& description) override;
@@ -140,8 +140,8 @@ class NativeWindowMac : public NativeWindow,
 
  private:
   // NativeWindow:
-  gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds);
-  gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds);
+  gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const;
+  gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const;
   void UpdateDraggableRegions(
       const std::vector<DraggableRegion>& regions) override;
 

+ 5 - 5
atom/browser/native_window_mac.mm

@@ -1314,15 +1314,15 @@ void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
     [parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove];
 }
 
-gfx::NativeView NativeWindowMac::GetNativeView() {
+gfx::NativeView NativeWindowMac::GetNativeView() const {
   return inspectable_web_contents()->GetView()->GetNativeView();
 }
 
-gfx::NativeWindow NativeWindowMac::GetNativeWindow() {
+gfx::NativeWindow NativeWindowMac::GetNativeWindow() const {
   return window_;
 }
 
-gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() {
+gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() const {
   return inspectable_web_contents()->GetView()->GetNativeView();
 }
 
@@ -1498,7 +1498,7 @@ std::vector<gfx::Rect> NativeWindowMac::CalculateNonDraggableRegions(
 }
 
 gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds(
-    const gfx::Rect& bounds) {
+    const gfx::Rect& bounds) const {
   if (has_frame()) {
     gfx::Rect window_bounds(
         [window_ frameRectForContentRect:bounds.ToCGRect()]);
@@ -1511,7 +1511,7 @@ gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds(
 }
 
 gfx::Rect NativeWindowMac::WindowBoundsToContentBounds(
-    const gfx::Rect& bounds) {
+    const gfx::Rect& bounds) const {
   if (has_frame()) {
     gfx::Rect content_bounds(
         [window_ contentRectForFrameRect:bounds.ToCGRect()]);

+ 2 - 2
atom/browser/osr/osr_render_widget_host_view.cc

@@ -1041,14 +1041,14 @@ void OffScreenRenderWidgetHostView::OnPaint(
         pos.x(), pos.y(), pos.width(), pos.height()));
     }
 
-    for (int i = 0; i < damages.size(); i++) {
+    for (size_t i = 0; i < damages.size(); i++) {
       CopyBitmapTo(bitmap, *(bitmaps[i]), damages[i]);
     }
 
     damage.Intersect(GetViewBounds());
     callback_.Run(damage, bitmap);
 
-    for (int i = 0; i < damages.size(); i++) {
+    for (size_t i = 0; i < damages.size(); i++) {
       CopyBitmapTo(bitmap, originals[i], damages[i]);
     }
   }

+ 2 - 2
atom/browser/ui/autofill_popup.cc

@@ -205,7 +205,7 @@ int AutofillPopup::GetDesiredPopupHeight() {
 int AutofillPopup::GetDesiredPopupWidth() {
   int popup_width = element_bounds_.width();
 
-  for (int i = 0; i < values_.size(); ++i) {
+  for (size_t i = 0; i < values_.size(); ++i) {
     int row_size = kEndPadding + 2 * kPopupBorderThickness +
       gfx::GetStringWidth(GetValueAt(i), GetValueFontListForRow(i)) +
       gfx::GetStringWidth(GetLabelAt(i), GetLabelFontListForRow(i));
@@ -256,7 +256,7 @@ base::string16 AutofillPopup::GetLabelAt(int i) {
 int AutofillPopup::LineFromY(int y) const {
   int current_height = kPopupBorderThickness;
 
-  for (int i = 0; i < values_.size(); ++i) {
+  for (size_t i = 0; i < values_.size(); ++i) {
     current_height += kRowHeight;
 
     if (y <= current_height)