chrome/browser/ui/views/extensions/native_app_window_views.cc
// Private method. TODO(stevenjb): Move this below InitializePanelWindow()
// to match declaration order.
Private method. TODO(stevenjb): Move this below InitializePanelWindow()
to match declaration order.
Private method . TODO ( stevenjb ) : Move this below InitializePanelWindow () to match declaration order .
void NativeAppWindowViews::OnViewWasResized() {
#if defined(OS_WIN) && !defined(USE_AURA)
  DCHECK(window_);
  DCHECK(web_view_);
  gfx::Size sz = web_view_->size();
  int height = sz.height(), width = sz.width();
  int radius = 1;
  gfx::Path path;
  if (window_->IsMaximized() || window_->IsFullscreen()) {
    path.addRect(0, 0, width, height);
  } else {
    if (frameless_) {
      path.moveTo(0, radius);
      path.lineTo(radius, 0);
      path.lineTo(width - radius, 0);
      path.lineTo(width, radius);
    } else {
      path.moveTo(0, 0);
      path.lineTo(width, 0);
    }
    path.lineTo(width, height - radius - 1);
    path.lineTo(width - radius - 1, height);
    path.lineTo(radius + 1, height);
    path.lineTo(0, height - radius - 1);
    path.close();
  }
  SetWindowRgn(web_contents()->GetNativeView(), path.CreateNativeRegion(), 1);
  SkRegion* rgn = new SkRegion;
  if (!window_->IsFullscreen()) {
    if (draggable_region())
      rgn->op(*draggable_region(), SkRegion::kUnion_Op);
    if (!window_->IsMaximized()) {
      if (frameless_)
        rgn->op(0, 0, width, kResizeInsideBoundsSize, SkRegion::kUnion_Op);
      rgn->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op);
      rgn->op(width - kResizeInsideBoundsSize, 0, width, height,
          SkRegion::kUnion_Op);
      rgn->op(0, height - kResizeInsideBoundsSize, width, height,
          SkRegion::kUnion_Op);
    }
  }
  if (web_contents()->GetRenderViewHost()->GetView())
    web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn);
#endif
}
void NativeAppWindowViews :: OnViewWasResized ( ) { #if defined ( OS_WIN ) && ! defined ( USE_AURA ) DCHECK ( window_ ) ; DCHECK ( web_view_ ) ; gfx :: Size sz = web_view_ -> size ( ) ; int height = sz . height ( ) , width = sz . width ( ) ; int radius = 1 ; gfx :: Path path ; if ( window_ -> IsMaximized ( ) || window_ -> IsFullscreen ( ) ) { path . addRect ( 0 , 0 , width , height ) ; } else { if ( frameless_ ) { path . moveTo ( 0 , radius ) ; path . lineTo ( radius , 0 ) ; path . lineTo ( width - radius , 0 ) ; path . lineTo ( width , radius ) ; } else { path . moveTo ( 0 , 0 ) ; path . lineTo ( width , 0 ) ; } path . lineTo ( width , height - radius - 1 ) ; path . lineTo ( width - radius - 1 , height ) ; path . lineTo ( radius + 1 , height ) ; path . lineTo ( 0 , height - radius - 1 ) ; path . close ( ) ; } SetWindowRgn ( web_contents ( ) -> GetNativeView ( ) , path . CreateNativeRegion ( ) , 1 ) ; SkRegion * rgn = new SkRegion ; if ( ! window_ -> IsFullscreen ( ) ) { if ( draggable_region ( ) ) rgn -> op ( * draggable_region ( ) , SkRegion :: kUnion_Op ) ; if ( ! window_ -> IsMaximized ( ) ) { if ( frameless_ ) rgn -> op ( 0 , 0 , width , kResizeInsideBoundsSize , SkRegion :: kUnion_Op ) ; rgn -> op ( 0 , 0 , kResizeInsideBoundsSize , height , SkRegion :: kUnion_Op ) ; rgn -> op ( width - kResizeInsideBoundsSize , 0 , width , height , SkRegion :: kUnion_Op ) ; rgn -> op ( 0 , height - kResizeInsideBoundsSize , width , height , SkRegion :: kUnion_Op ) ; } } if ( web_contents ( ) -> GetRenderViewHost ( ) -> GetView ( ) ) web_contents ( ) -> GetRenderViewHost ( ) -> GetView ( ) -> SetClickthroughRegion ( rgn ) ; #endif }
Private method.
Private method .
// TODO(jeremya): this doesn't seem like a terribly elegant way to keep the // window shape in sync. // Set the window shape of the RWHV. // Don't round the corners when the window is maximized or fullscreen. // Don't round the top corners in chrome-style frame mode.