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

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

Issue 10073002: TabContents -> WebContentsImpl, part 11. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed a few Created 8 years, 8 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 | Annotate | Revision Log
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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 347 }
348 348
349 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const { 349 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
350 return render_widget_host_; 350 return render_widget_host_;
351 } 351 }
352 352
353 void RenderWidgetHostViewMac::DidBecomeSelected() { 353 void RenderWidgetHostViewMac::DidBecomeSelected() {
354 if (!is_hidden_) 354 if (!is_hidden_)
355 return; 355 return;
356 356
357 if (tab_switch_paint_time_.is_null()) 357 if (web_contents_switch_paint_time_.is_null())
358 tab_switch_paint_time_ = base::TimeTicks::Now(); 358 web_contents_switch_paint_time_ = base::TimeTicks::Now();
359 is_hidden_ = false; 359 is_hidden_ = false;
360 render_widget_host_->WasRestored(); 360 render_widget_host_->WasRestored();
361 361
362 // We're messing with the window, so do this to ensure no flashes. 362 // We're messing with the window, so do this to ensure no flashes.
363 [[cocoa_view_ window] disableScreenUpdatesUntilFlush]; 363 [[cocoa_view_ window] disableScreenUpdatesUntilFlush];
364 } 364 }
365 365
366 void RenderWidgetHostViewMac::WasHidden() { 366 void RenderWidgetHostViewMac::WasHidden() {
367 if (is_hidden_) 367 if (is_hidden_)
368 return; 368 return;
(...skipping 25 matching lines...) Expand all
394 SetBounds(rect); 394 SetBounds(rect);
395 } 395 }
396 396
397 void RenderWidgetHostViewMac::SetBounds(const gfx::Rect& rect) { 397 void RenderWidgetHostViewMac::SetBounds(const gfx::Rect& rect) {
398 // |rect.size()| is view coordinates, |rect.origin| is screen coordinates, 398 // |rect.size()| is view coordinates, |rect.origin| is screen coordinates,
399 // TODO(thakis): fix, http://crbug.com/73362 399 // TODO(thakis): fix, http://crbug.com/73362
400 if (is_hidden_) 400 if (is_hidden_)
401 return; 401 return;
402 402
403 // During the initial creation of the RenderWidgetHostView in 403 // During the initial creation of the RenderWidgetHostView in
404 // TabContents::CreateRenderViewForRenderManager, SetSize is called with an 404 // WebContentsImpl::CreateRenderViewForRenderManager, SetSize is called with
405 // empty size. In the Windows code flow, it is not ignored because subsequent 405 // an empty size. In the Windows code flow, it is not ignored because
406 // sizing calls from the OS flow through TCVW::WasSized which calls SetSize() 406 // subsequent sizing calls from the OS flow through TCVW::WasSized which calls
407 // again. On Cocoa, we rely on the Cocoa view struture and resizer flags to 407 // SetSize() again. On Cocoa, we rely on the Cocoa view struture and resizer
408 // keep things sized properly. On the other hand, if the size is not empty 408 // flags to keep things sized properly. On the other hand, if the size is not
409 // then this is a valid request for a pop-up. 409 // empty then this is a valid request for a pop-up.
410 if (rect.size().IsEmpty()) 410 if (rect.size().IsEmpty())
411 return; 411 return;
412 412
413 // Ignore the position of |rect| for non-popup rwhvs. This is because 413 // Ignore the position of |rect| for non-popup rwhvs. This is because
414 // background tabs do not have a window, but the window is required for the 414 // background tabs do not have a window, but the window is required for the
415 // coordinate conversions. Popups are always for a visible tab. 415 // coordinate conversions. Popups are always for a visible tab.
416 if (IsPopup()) { 416 if (IsPopup()) {
417 // The position of |rect| is screen coordinate system and we have to 417 // The position of |rect| is screen coordinate system and we have to
418 // consider Cocoa coordinate system is upside-down and also multi-screen. 418 // consider Cocoa coordinate system is upside-down and also multi-screen.
419 NSPoint origin_global = NSPointFromCGPoint(rect.origin().ToCGPoint()); 419 NSPoint origin_global = NSPointFromCGPoint(rect.origin().ToCGPoint());
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 1937
1938 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) { 1938 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) {
1939 base::TimeDelta whiteout_duration = base::TimeTicks::Now() - 1939 base::TimeDelta whiteout_duration = base::TimeTicks::Now() -
1940 renderWidgetHostView_->whiteout_start_time_; 1940 renderWidgetHostView_->whiteout_start_time_;
1941 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); 1941 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration);
1942 1942
1943 // Reset the start time to 0 so that we start recording again the next 1943 // Reset the start time to 0 so that we start recording again the next
1944 // time the backing store is NULL... 1944 // time the backing store is NULL...
1945 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks(); 1945 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks();
1946 } 1946 }
1947 if (!renderWidgetHostView_->tab_switch_paint_time_.is_null()) { 1947 if (!renderWidgetHostView_->web_contents_switch_paint_time_.is_null()) {
1948 base::TimeDelta tab_switch_paint_duration = base::TimeTicks::Now() - 1948 base::TimeDelta web_contents_switch_paint_duration =
1949 renderWidgetHostView_->tab_switch_paint_time_; 1949 base::TimeTicks::Now() -
1950 renderWidgetHostView_->web_contents_switch_paint_time_;
1950 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration", 1951 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration",
1951 tab_switch_paint_duration); 1952 web_contents_switch_paint_duration);
1952 // Reset tab_switch_paint_time_ to 0 so future tab selections are 1953 // Reset contents_switch_paint_time_ to 0 so future tab selections are
1953 // recorded. 1954 // recorded.
1954 renderWidgetHostView_->tab_switch_paint_time_ = base::TimeTicks(); 1955 renderWidgetHostView_->web_contents_switch_paint_time_ =
1956 base::TimeTicks();
1955 } 1957 }
1956 } else { 1958 } else {
1957 [[NSColor whiteColor] set]; 1959 [[NSColor whiteColor] set];
1958 NSRectFill(dirtyRect); 1960 NSRectFill(dirtyRect);
1959 if (renderWidgetHostView_->whiteout_start_time_.is_null()) 1961 if (renderWidgetHostView_->whiteout_start_time_.is_null())
1960 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now(); 1962 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now();
1961 } 1963 }
1962 } 1964 }
1963 1965
1964 - (BOOL)canBecomeKeyView { 1966 - (BOOL)canBecomeKeyView {
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 if (!string) return NO; 2880 if (!string) return NO;
2879 2881
2880 // If the user is currently using an IME, confirm the IME input, 2882 // If the user is currently using an IME, confirm the IME input,
2881 // and then insert the text from the service, the same as TextEdit and Safari. 2883 // and then insert the text from the service, the same as TextEdit and Safari.
2882 [self confirmComposition]; 2884 [self confirmComposition];
2883 [self insertText:string]; 2885 [self insertText:string];
2884 return YES; 2886 return YES;
2885 } 2887 }
2886 2888
2887 @end 2889 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698