OLD | NEW |
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 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 namespace content { | 402 namespace content { |
403 | 403 |
404 //////////////////////////////////////////////////////////////////////////////// | 404 //////////////////////////////////////////////////////////////////////////////// |
405 // BrowserCompositorMacClient, public: | 405 // BrowserCompositorMacClient, public: |
406 | 406 |
407 NSView* RenderWidgetHostViewMac::BrowserCompositorMacGetNSView() const { | 407 NSView* RenderWidgetHostViewMac::BrowserCompositorMacGetNSView() const { |
408 return cocoa_view_; | 408 return cocoa_view_; |
409 } | 409 } |
410 | 410 |
411 bool RenderWidgetHostViewMac::BrowserCompositorMacIsVisible() const { | |
412 return !render_widget_host_->is_hidden(); | |
413 } | |
414 | |
415 SkColor RenderWidgetHostViewMac::BrowserCompositorMacGetGutterColor( | 411 SkColor RenderWidgetHostViewMac::BrowserCompositorMacGetGutterColor( |
416 SkColor color) const { | 412 SkColor color) const { |
417 // When making an element on the page fullscreen the element's background | 413 // When making an element on the page fullscreen the element's background |
418 // may not match the page's, so use black as the gutter color to avoid | 414 // may not match the page's, so use black as the gutter color to avoid |
419 // flashes of brighter colors during the transition. | 415 // flashes of brighter colors during the transition. |
420 if (render_widget_host_->delegate() && | 416 if (render_widget_host_->delegate() && |
421 render_widget_host_->delegate()->IsFullscreenForCurrentTab()) { | 417 render_widget_host_->delegate()->IsFullscreenForCurrentTab()) { |
422 return SK_ColorBLACK; | 418 return SK_ColorBLACK; |
423 } | 419 } |
424 return color; | 420 return color; |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 | 1294 |
1299 void RenderWidgetHostViewMac::OnSwapCompositorFrame(uint32_t output_surface_id, | 1295 void RenderWidgetHostViewMac::OnSwapCompositorFrame(uint32_t output_surface_id, |
1300 cc::CompositorFrame frame) { | 1296 cc::CompositorFrame frame) { |
1301 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1297 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
1302 | 1298 |
1303 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1299 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
1304 | 1300 |
1305 page_at_minimum_scale_ = | 1301 page_at_minimum_scale_ = |
1306 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; | 1302 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; |
1307 if (frame.delegated_frame_data) { | 1303 if (frame.delegated_frame_data) { |
1308 // TODO(ccameron): This would not be needed if BrowserCompostiorMac were to | |
1309 // correctly subscribe to the show and hide notifications for | |
1310 // RenderWidgetHostImpl. We do not correctly subscribe to these | |
1311 // notifications because we want to set the hide property property only | |
1312 // after all notifications (the thumbnailer in particular) have all | |
1313 // completed. | |
1314 browser_compositor_->SetRenderWidgetHostIsHidden( | |
1315 render_widget_host_->is_hidden()); | |
1316 browser_compositor_->SwapCompositorFrame(output_surface_id, | 1304 browser_compositor_->SwapCompositorFrame(output_surface_id, |
1317 std::move(frame)); | 1305 std::move(frame)); |
1318 SendVSyncParametersToRenderer(); | 1306 SendVSyncParametersToRenderer(); |
1319 } else { | 1307 } else { |
1320 DLOG(ERROR) << "Received unexpected frame type."; | 1308 DLOG(ERROR) << "Received unexpected frame type."; |
1321 bad_message::ReceivedBadMessage(render_widget_host_->GetProcess(), | 1309 bad_message::ReceivedBadMessage(render_widget_host_->GetProcess(), |
1322 bad_message::RWHVM_UNEXPECTED_FRAME_TYPE); | 1310 bad_message::RWHVM_UNEXPECTED_FRAME_TYPE); |
1323 } | 1311 } |
1324 } | 1312 } |
1325 | 1313 |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3245 | 3233 |
3246 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3234 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3247 // regions that are not draggable. (See ControlRegionView in | 3235 // regions that are not draggable. (See ControlRegionView in |
3248 // native_app_window_cocoa.mm). This requires the render host view to be | 3236 // native_app_window_cocoa.mm). This requires the render host view to be |
3249 // draggable by default. | 3237 // draggable by default. |
3250 - (BOOL)mouseDownCanMoveWindow { | 3238 - (BOOL)mouseDownCanMoveWindow { |
3251 return YES; | 3239 return YES; |
3252 } | 3240 } |
3253 | 3241 |
3254 @end | 3242 @end |
OLD | NEW |