Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 10696158: Rename WasRestored to WasShown across all uses. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Bring to ToT to commit Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <QuartzCore/QuartzCore.h> 7 #include <QuartzCore/QuartzCore.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 initWithWindow:pepper_fullscreen_window_.get() 370 initWithWindow:pepper_fullscreen_window_.get()
371 desiredScreen:screen]); 371 desiredScreen:screen]);
372 [fullscreen_window_manager_ enterFullscreenMode]; 372 [fullscreen_window_manager_ enterFullscreenMode];
373 [pepper_fullscreen_window_ makeKeyAndOrderFront:nil]; 373 [pepper_fullscreen_window_ makeKeyAndOrderFront:nil];
374 } 374 }
375 375
376 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const { 376 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
377 return render_widget_host_; 377 return render_widget_host_;
378 } 378 }
379 379
380 void RenderWidgetHostViewMac::WasRestored() { 380 void RenderWidgetHostViewMac::WasShown() {
381 if (!is_hidden_) 381 if (!is_hidden_)
382 return; 382 return;
383 383
384 // Check if the backing scale factor changed while the tab was in the 384 // Check if the backing scale factor changed while the tab was in the
385 // background. 385 // background.
386 [cocoa_view_ updateTabBackingStoreScaleFactor]; 386 [cocoa_view_ updateTabBackingStoreScaleFactor];
387 387
388 if (web_contents_switch_paint_time_.is_null()) 388 if (web_contents_switch_paint_time_.is_null())
389 web_contents_switch_paint_time_ = base::TimeTicks::Now(); 389 web_contents_switch_paint_time_ = base::TimeTicks::Now();
390 is_hidden_ = false; 390 is_hidden_ = false;
391 render_widget_host_->WasRestored(); 391 render_widget_host_->WasShown();
392 392
393 // We're messing with the window, so do this to ensure no flashes. 393 // We're messing with the window, so do this to ensure no flashes.
394 [[cocoa_view_ window] disableScreenUpdatesUntilFlush]; 394 [[cocoa_view_ window] disableScreenUpdatesUntilFlush];
395 } 395 }
396 396
397 void RenderWidgetHostViewMac::WasHidden() { 397 void RenderWidgetHostViewMac::WasHidden() {
398 if (is_hidden_) 398 if (is_hidden_)
399 return; 399 return;
400 400
401 // Send ACKs for any pending SwapBuffers (if any) since we won't be displaying 401 // Send ACKs for any pending SwapBuffers (if any) since we won't be displaying
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 550 }
551 551
552 bool RenderWidgetHostViewMac::IsSurfaceAvailableForCopy() const { 552 bool RenderWidgetHostViewMac::IsSurfaceAvailableForCopy() const {
553 return !!render_widget_host_->GetBackingStore(false) || 553 return !!render_widget_host_->GetBackingStore(false) ||
554 (compositing_iosurface_.get() && compositing_iosurface_->HasIOSurface()); 554 (compositing_iosurface_.get() && compositing_iosurface_->HasIOSurface());
555 } 555 }
556 556
557 void RenderWidgetHostViewMac::Show() { 557 void RenderWidgetHostViewMac::Show() {
558 [cocoa_view_ setHidden:NO]; 558 [cocoa_view_ setHidden:NO];
559 559
560 WasRestored(); 560 WasShown();
561 } 561 }
562 562
563 void RenderWidgetHostViewMac::Hide() { 563 void RenderWidgetHostViewMac::Hide() {
564 [cocoa_view_ setHidden:YES]; 564 [cocoa_view_ setHidden:YES];
565 565
566 WasHidden(); 566 WasHidden();
567 } 567 }
568 568
569 bool RenderWidgetHostViewMac::IsShowing() { 569 bool RenderWidgetHostViewMac::IsShowing() {
570 return ![cocoa_view_ isHidden]; 570 return ![cocoa_view_ isHidden];
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 // http://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conce ptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//a pple_ref/doc/uid/TP40012302-CH10-SW4 2050 // http://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conce ptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//a pple_ref/doc/uid/TP40012302-CH10-SW4
2051 - (void)windowDidChangeBackingProperties:(NSNotification*)notification { 2051 - (void)windowDidChangeBackingProperties:(NSNotification*)notification {
2052 NSWindow* window = (NSWindow*)[notification object]; 2052 NSWindow* window = (NSWindow*)[notification object];
2053 2053
2054 CGFloat newBackingScaleFactor = [window backingScaleFactor]; 2054 CGFloat newBackingScaleFactor = [window backingScaleFactor];
2055 CGFloat oldBackingScaleFactor = [base::mac::ObjCCast<NSNumber>( 2055 CGFloat oldBackingScaleFactor = [base::mac::ObjCCast<NSNumber>(
2056 [[notification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey]) 2056 [[notification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey])
2057 doubleValue]; 2057 doubleValue];
2058 if (newBackingScaleFactor != oldBackingScaleFactor) { 2058 if (newBackingScaleFactor != oldBackingScaleFactor) {
2059 // Background tabs check if their scale factor changed when they become 2059 // Background tabs check if their scale factor changed when they become
2060 // active, in WasRestored(). 2060 // active, in WasShown().
2061 2061
2062 // Allocating a CGLayerRef with the current scale factor immediately from 2062 // Allocating a CGLayerRef with the current scale factor immediately from
2063 // this handler doesn't work. Schedule the backing store update on the 2063 // this handler doesn't work. Schedule the backing store update on the
2064 // next runloop cycle, then things are read for CGLayerRef allocations to 2064 // next runloop cycle, then things are read for CGLayerRef allocations to
2065 // work. 2065 // work.
2066 [self performSelector:@selector(updateTabBackingStoreScaleFactor) 2066 [self performSelector:@selector(updateTabBackingStoreScaleFactor)
2067 withObject:nil 2067 withObject:nil
2068 afterDelay:0]; 2068 afterDelay:0];
2069 } 2069 }
2070 } 2070 }
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 } 2990 }
2991 2991
2992 - (void)viewDidMoveToWindow { 2992 - (void)viewDidMoveToWindow {
2993 if (canBeKeyView_) { 2993 if (canBeKeyView_) {
2994 NSWindow* newWindow = [self window]; 2994 NSWindow* newWindow = [self window];
2995 // Pointer comparison only, since we don't know if lastWindow_ is still 2995 // Pointer comparison only, since we don't know if lastWindow_ is still
2996 // valid. 2996 // valid.
2997 if (newWindow) { 2997 if (newWindow) {
2998 // If we move into a new window, refresh the frame information. We 2998 // If we move into a new window, refresh the frame information. We
2999 // don't need to do it if it was the same window as it used to be in, 2999 // don't need to do it if it was the same window as it used to be in,
3000 // since that case is covered by WasRestored(). We only want to 3000 // since that case is covered by WasShown(). We only want to do this for
3001 // do this for real browser views, not popups. 3001 // real browser views, not popups.
3002 if (newWindow != lastWindow_) { 3002 if (newWindow != lastWindow_) {
3003 lastWindow_ = newWindow; 3003 lastWindow_ = newWindow;
3004 renderWidgetHostView_->WindowFrameChanged(); 3004 renderWidgetHostView_->WindowFrameChanged();
3005 } 3005 }
3006 renderWidgetHostView_->ForceTextureReload(); 3006 renderWidgetHostView_->ForceTextureReload();
3007 } 3007 }
3008 } 3008 }
3009 3009
3010 // If we switch windows (or are removed from the view hierarchy), cancel any 3010 // If we switch windows (or are removed from the view hierarchy), cancel any
3011 // open mouse-downs. 3011 // open mouse-downs.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 if (!string) return NO; 3212 if (!string) return NO;
3213 3213
3214 // If the user is currently using an IME, confirm the IME input, 3214 // If the user is currently using an IME, confirm the IME input,
3215 // and then insert the text from the service, the same as TextEdit and Safari. 3215 // and then insert the text from the service, the same as TextEdit and Safari.
3216 [self confirmComposition]; 3216 [self confirmComposition];
3217 [self insertText:string]; 3217 [self insertText:string];
3218 return YES; 3218 return YES;
3219 } 3219 }
3220 3220
3221 @end 3221 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698