OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "chrome/browser/browser_trial.h" | 9 #include "chrome/browser/browser_trial.h" |
10 #include "chrome/browser/renderer_host/backing_store.h" | 10 #include "chrome/browser/renderer_host/backing_store.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 [[cocoa_view_ window] mouseLocationOutsideOfEventStream]; | 290 [[cocoa_view_ window] mouseLocationOutsideOfEventStream]; |
291 [tooltip_ showToolTipAtPoint:event_point | 291 [tooltip_ showToolTipAtPoint:event_point |
292 withString:tooltip_nsstring | 292 withString:tooltip_nsstring |
293 overWindow:[cocoa_view_ window]]; | 293 overWindow:[cocoa_view_ window]]; |
294 } | 294 } |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 BackingStore* RenderWidgetHostViewMac::AllocBackingStore( | 298 BackingStore* RenderWidgetHostViewMac::AllocBackingStore( |
299 const gfx::Size& size) { | 299 const gfx::Size& size) { |
300 return new BackingStore(size); | 300 return new BackingStore(render_widget_host_, size); |
301 } | 301 } |
302 | 302 |
303 // Display a popup menu for WebKit using Cocoa widgets. | 303 // Display a popup menu for WebKit using Cocoa widgets. |
304 void RenderWidgetHostViewMac::ShowPopupWithItems( | 304 void RenderWidgetHostViewMac::ShowPopupWithItems( |
305 gfx::Rect bounds, | 305 gfx::Rect bounds, |
306 int item_height, | 306 int item_height, |
307 int selected_item, | 307 int selected_item, |
308 const std::vector<WebMenuItem>& items) { | 308 const std::vector<WebMenuItem>& items) { |
309 NSRect view_rect = [cocoa_view_ bounds]; | 309 NSRect view_rect = [cocoa_view_ bounds]; |
310 NSRect parent_rect = [parent_view_ bounds]; | 310 NSRect parent_rect = [parent_view_ bounds]; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 renderWidgetHostView_->render_widget_host_->WasResized(); | 408 renderWidgetHostView_->render_widget_host_->WasResized(); |
409 } | 409 } |
410 | 410 |
411 - (void)drawRect:(NSRect)dirtyRect { | 411 - (void)drawRect:(NSRect)dirtyRect { |
412 DCHECK(renderWidgetHostView_->render_widget_host_->process()->channel()); | 412 DCHECK(renderWidgetHostView_->render_widget_host_->process()->channel()); |
413 DCHECK(!renderWidgetHostView_->about_to_validate_and_paint_); | 413 DCHECK(!renderWidgetHostView_->about_to_validate_and_paint_); |
414 | 414 |
415 renderWidgetHostView_->invalid_rect_ = dirtyRect; | 415 renderWidgetHostView_->invalid_rect_ = dirtyRect; |
416 renderWidgetHostView_->about_to_validate_and_paint_ = true; | 416 renderWidgetHostView_->about_to_validate_and_paint_ = true; |
417 BackingStore* backing_store = | 417 BackingStore* backing_store = |
418 renderWidgetHostView_->render_widget_host_->GetBackingStore(); | 418 renderWidgetHostView_->render_widget_host_->GetBackingStore(true); |
419 skia::PlatformCanvas* canvas = backing_store->canvas(); | 419 skia::PlatformCanvas* canvas = backing_store->canvas(); |
420 renderWidgetHostView_->about_to_validate_and_paint_ = false; | 420 renderWidgetHostView_->about_to_validate_and_paint_ = false; |
421 dirtyRect = renderWidgetHostView_->invalid_rect_; | 421 dirtyRect = renderWidgetHostView_->invalid_rect_; |
422 | 422 |
423 if (backing_store) { | 423 if (backing_store) { |
424 gfx::Rect damaged_rect([self NSRectToRect:dirtyRect]); | 424 gfx::Rect damaged_rect([self NSRectToRect:dirtyRect]); |
425 | 425 |
426 gfx::Rect bitmap_rect(0, 0, | 426 gfx::Rect bitmap_rect(0, 0, |
427 backing_store->size().width(), | 427 backing_store->size().width(), |
428 backing_store->size().height()); | 428 backing_store->size().height()); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 if (closeOnDeactivate_) | 504 if (closeOnDeactivate_) |
505 renderWidgetHostView_->KillSelf(); | 505 renderWidgetHostView_->KillSelf(); |
506 | 506 |
507 renderWidgetHostView_->render_widget_host_->Blur(); | 507 renderWidgetHostView_->render_widget_host_->Blur(); |
508 | 508 |
509 return YES; | 509 return YES; |
510 } | 510 } |
511 | 511 |
512 @end | 512 @end |
OLD | NEW |