| 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/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "content/public/browser/render_widget_host.h" | 38 #include "content/public/browser/render_widget_host.h" |
| 39 #include "content/public/browser/render_widget_host_view.h" | 39 #include "content/public/browser/render_widget_host_view.h" |
| 40 #include "content/public/browser/web_contents_delegate.h" | 40 #include "content/public/browser/web_contents_delegate.h" |
| 41 #include "content/public/browser/web_contents_observer.h" | 41 #include "content/public/browser/web_contents_observer.h" |
| 42 #include "content/public/browser/web_contents_view_delegate.h" | 42 #include "content/public/browser/web_contents_view_delegate.h" |
| 43 #include "content/public/browser/web_drag_dest_delegate.h" | 43 #include "content/public/browser/web_drag_dest_delegate.h" |
| 44 #include "content/public/common/content_client.h" | 44 #include "content/public/common/content_client.h" |
| 45 #include "content/public/common/content_switches.h" | 45 #include "content/public/common/content_switches.h" |
| 46 #include "content/public/common/drop_data.h" | 46 #include "content/public/common/drop_data.h" |
| 47 #include "net/base/filename_util.h" | 47 #include "net/base/filename_util.h" |
| 48 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 48 #include "third_party/WebKit/public/web/WebInputEvent.h" | 49 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 49 #include "ui/aura/client/aura_constants.h" | 50 #include "ui/aura/client/aura_constants.h" |
| 50 #include "ui/aura/client/screen_position_client.h" | 51 #include "ui/aura/client/screen_position_client.h" |
| 51 #include "ui/aura/client/window_tree_client.h" | 52 #include "ui/aura/client/window_tree_client.h" |
| 52 #include "ui/aura/env.h" | 53 #include "ui/aura/env.h" |
| 53 #include "ui/aura/window.h" | 54 #include "ui/aura/window.h" |
| 54 #include "ui/aura/window_observer.h" | 55 #include "ui/aura/window_observer.h" |
| 55 #include "ui/aura/window_tree_host.h" | 56 #include "ui/aura/window_tree_host.h" |
| 56 #include "ui/aura/window_tree_host_observer.h" | 57 #include "ui/aura/window_tree_host_observer.h" |
| 57 #include "ui/base/clipboard/clipboard.h" | 58 #include "ui/base/clipboard/clipboard.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 gfx::NativeView WebContentsViewAura::GetContentNativeView() const { | 619 gfx::NativeView WebContentsViewAura::GetContentNativeView() const { |
| 619 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 620 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 620 return rwhv ? rwhv->GetNativeView() : NULL; | 621 return rwhv ? rwhv->GetNativeView() : NULL; |
| 621 } | 622 } |
| 622 | 623 |
| 623 gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const { | 624 gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const { |
| 624 gfx::NativeWindow window = window_->GetToplevelWindow(); | 625 gfx::NativeWindow window = window_->GetToplevelWindow(); |
| 625 return window ? window : delegate_->GetNativeWindow(); | 626 return window ? window : delegate_->GetNativeWindow(); |
| 626 } | 627 } |
| 627 | 628 |
| 629 namespace { |
| 630 |
| 631 void GetScreenInfoForWindow(blink::WebScreenInfo* results, |
| 632 aura::Window* window) { |
| 633 display::Screen* screen = display::Screen::GetScreen(); |
| 634 const display::Display display = window |
| 635 ? screen->GetDisplayNearestWindow(window) |
| 636 : screen->GetPrimaryDisplay(); |
| 637 results->rect = display.bounds(); |
| 638 results->availableRect = display.work_area(); |
| 639 // TODO(derat|oshima): Don't hardcode this. Get this from display object. |
| 640 results->depth = 24; |
| 641 results->depthPerComponent = 8; |
| 642 results->deviceScaleFactor = display.device_scale_factor(); |
| 643 |
| 644 // The Display rotation and the WebScreenInfo orientation are not the same |
| 645 // angle. The former is the physical display rotation while the later is the |
| 646 // rotation required by the content to be shown properly on the screen, in |
| 647 // other words, relative to the physical display. |
| 648 results->orientationAngle = display.RotationAsDegree(); |
| 649 if (results->orientationAngle == 90) |
| 650 results->orientationAngle = 270; |
| 651 else if (results->orientationAngle == 270) |
| 652 results->orientationAngle = 90; |
| 653 |
| 654 results->orientationType = |
| 655 RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display); |
| 656 } |
| 657 |
| 658 } // namespace |
| 659 |
| 660 // Static. |
| 661 void WebContentsView::GetDefaultScreenInfo(blink::WebScreenInfo* results) { |
| 662 GetScreenInfoForWindow(results, NULL); |
| 663 } |
| 664 |
| 665 void WebContentsViewAura::GetScreenInfo( |
| 666 blink::WebScreenInfo* web_screen_info) const { |
| 667 GetScreenInfoForWindow(web_screen_info, window_.get()); |
| 668 } |
| 669 |
| 628 void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const { | 670 void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const { |
| 629 *out = window_->GetBoundsInScreen(); | 671 *out = window_->GetBoundsInScreen(); |
| 630 } | 672 } |
| 631 | 673 |
| 632 void WebContentsViewAura::SizeContents(const gfx::Size& size) { | 674 void WebContentsViewAura::SizeContents(const gfx::Size& size) { |
| 633 gfx::Rect bounds = window_->bounds(); | 675 gfx::Rect bounds = window_->bounds(); |
| 634 if (bounds.size() != size) { | 676 if (bounds.size() != size) { |
| 635 bounds.set_size(size); | 677 bounds.set_size(size); |
| 636 window_->SetBounds(bounds); | 678 window_->SetBounds(bounds); |
| 637 } else { | 679 } else { |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 bool allow_multiple_selection) { | 1200 bool allow_multiple_selection) { |
| 1159 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1201 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
| 1160 } | 1202 } |
| 1161 | 1203 |
| 1162 void WebContentsViewAura::HidePopupMenu() { | 1204 void WebContentsViewAura::HidePopupMenu() { |
| 1163 NOTIMPLEMENTED(); | 1205 NOTIMPLEMENTED(); |
| 1164 } | 1206 } |
| 1165 #endif | 1207 #endif |
| 1166 | 1208 |
| 1167 } // namespace content | 1209 } // namespace content |
| OLD | NEW |