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 26 matching lines...) Expand all Loading... |
37 #include "content/public/browser/render_widget_host.h" | 37 #include "content/public/browser/render_widget_host.h" |
38 #include "content/public/browser/render_widget_host_view.h" | 38 #include "content/public/browser/render_widget_host_view.h" |
39 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
40 #include "content/public/browser/web_contents_observer.h" | 40 #include "content/public/browser/web_contents_observer.h" |
41 #include "content/public/browser/web_contents_view_delegate.h" | 41 #include "content/public/browser/web_contents_view_delegate.h" |
42 #include "content/public/browser/web_drag_dest_delegate.h" | 42 #include "content/public/browser/web_drag_dest_delegate.h" |
43 #include "content/public/common/content_client.h" | 43 #include "content/public/common/content_client.h" |
44 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
45 #include "content/public/common/drop_data.h" | 45 #include "content/public/common/drop_data.h" |
46 #include "net/base/filename_util.h" | 46 #include "net/base/filename_util.h" |
47 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | |
48 #include "third_party/WebKit/public/web/WebInputEvent.h" | 47 #include "third_party/WebKit/public/web/WebInputEvent.h" |
49 #include "ui/aura/client/aura_constants.h" | 48 #include "ui/aura/client/aura_constants.h" |
50 #include "ui/aura/client/screen_position_client.h" | 49 #include "ui/aura/client/screen_position_client.h" |
51 #include "ui/aura/client/window_tree_client.h" | 50 #include "ui/aura/client/window_tree_client.h" |
52 #include "ui/aura/env.h" | 51 #include "ui/aura/env.h" |
53 #include "ui/aura/window.h" | 52 #include "ui/aura/window.h" |
54 #include "ui/aura/window_observer.h" | 53 #include "ui/aura/window_observer.h" |
55 #include "ui/aura/window_tree_host.h" | 54 #include "ui/aura/window_tree_host.h" |
56 #include "ui/aura/window_tree_host_observer.h" | 55 #include "ui/aura/window_tree_host_observer.h" |
57 #include "ui/base/clipboard/clipboard.h" | 56 #include "ui/base/clipboard/clipboard.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 return rwhv ? rwhv->GetNativeView() : NULL; | 634 return rwhv ? rwhv->GetNativeView() : NULL; |
636 } | 635 } |
637 | 636 |
638 gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const { | 637 gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const { |
639 gfx::NativeWindow window = window_->GetToplevelWindow(); | 638 gfx::NativeWindow window = window_->GetToplevelWindow(); |
640 return window ? window : delegate_->GetNativeWindow(); | 639 return window ? window : delegate_->GetNativeWindow(); |
641 } | 640 } |
642 | 641 |
643 namespace { | 642 namespace { |
644 | 643 |
645 void GetScreenInfoForWindow(blink::WebScreenInfo* results, | 644 void GetScreenInfoForWindow(ScreenInfo* results, |
646 aura::Window* window) { | 645 aura::Window* window) { |
647 display::Screen* screen = display::Screen::GetScreen(); | 646 display::Screen* screen = display::Screen::GetScreen(); |
648 const display::Display display = window | 647 const display::Display display = window |
649 ? screen->GetDisplayNearestWindow(window) | 648 ? screen->GetDisplayNearestWindow(window) |
650 : screen->GetPrimaryDisplay(); | 649 : screen->GetPrimaryDisplay(); |
651 results->rect = display.bounds(); | 650 results->rect = display.bounds(); |
652 results->availableRect = display.work_area(); | 651 results->available_rect = display.work_area(); |
653 // TODO(derat|oshima): Don't hardcode this. Get this from display object. | 652 // TODO(derat|oshima): Don't hardcode this. Get this from display object. |
654 results->depth = 24; | 653 results->depth = 24; |
655 results->depthPerComponent = 8; | 654 results->depth_per_component = 8; |
656 results->deviceScaleFactor = display.device_scale_factor(); | 655 results->device_scale_factor = display.device_scale_factor(); |
657 | 656 |
658 // The Display rotation and the WebScreenInfo orientation are not the same | 657 // The Display rotation and the ScreenInfo orientation are not the same |
659 // angle. The former is the physical display rotation while the later is the | 658 // angle. The former is the physical display rotation while the later is the |
660 // rotation required by the content to be shown properly on the screen, in | 659 // rotation required by the content to be shown properly on the screen, in |
661 // other words, relative to the physical display. | 660 // other words, relative to the physical display. |
662 results->orientationAngle = display.RotationAsDegree(); | 661 results->orientation_angle = display.RotationAsDegree(); |
663 if (results->orientationAngle == 90) | 662 if (results->orientation_angle == 90) |
664 results->orientationAngle = 270; | 663 results->orientation_angle = 270; |
665 else if (results->orientationAngle == 270) | 664 else if (results->orientation_angle == 270) |
666 results->orientationAngle = 90; | 665 results->orientation_angle = 90; |
667 | 666 |
668 results->orientationType = | 667 results->orientation_type = |
669 RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display); | 668 RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display); |
670 } | 669 } |
671 | 670 |
672 } // namespace | 671 } // namespace |
673 | 672 |
674 // Static. | 673 // Static. |
675 void WebContentsView::GetDefaultScreenInfo(blink::WebScreenInfo* results) { | 674 void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) { |
676 GetScreenInfoForWindow(results, NULL); | 675 GetScreenInfoForWindow(results, NULL); |
677 } | 676 } |
678 | 677 |
679 void WebContentsViewAura::GetScreenInfo( | 678 void WebContentsViewAura::GetScreenInfo(ScreenInfo* screen_info) const { |
680 blink::WebScreenInfo* web_screen_info) const { | 679 GetScreenInfoForWindow(screen_info, window_.get()); |
681 GetScreenInfoForWindow(web_screen_info, window_.get()); | |
682 } | 680 } |
683 | 681 |
684 void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const { | 682 void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const { |
685 *out = window_->GetBoundsInScreen(); | 683 *out = window_->GetBoundsInScreen(); |
686 } | 684 } |
687 | 685 |
688 void WebContentsViewAura::SizeContents(const gfx::Size& size) { | 686 void WebContentsViewAura::SizeContents(const gfx::Size& size) { |
689 gfx::Rect bounds = window_->bounds(); | 687 gfx::Rect bounds = window_->bounds(); |
690 if (bounds.size() != size) { | 688 if (bounds.size() != size) { |
691 bounds.set_size(size); | 689 bounds.set_size(size); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 bool allow_multiple_selection) { | 1212 bool allow_multiple_selection) { |
1215 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1213 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
1216 } | 1214 } |
1217 | 1215 |
1218 void WebContentsViewAura::HidePopupMenu() { | 1216 void WebContentsViewAura::HidePopupMenu() { |
1219 NOTIMPLEMENTED(); | 1217 NOTIMPLEMENTED(); |
1220 } | 1218 } |
1221 #endif | 1219 #endif |
1222 | 1220 |
1223 } // namespace content | 1221 } // namespace content |
OLD | NEW |