OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #include "core/inspector/InspectorInstrumentation.h" | 31 #include "core/inspector/InspectorInstrumentation.h" |
32 #include "core/layout/HitTestResult.h" | 32 #include "core/layout/HitTestResult.h" |
33 #include "core/page/ChromeClient.h" | 33 #include "core/page/ChromeClient.h" |
34 #include "core/page/FrameTree.h" | 34 #include "core/page/FrameTree.h" |
35 #include "core/page/Page.h" | 35 #include "core/page/Page.h" |
36 #include "core/page/PopupOpeningObserver.h" | 36 #include "core/page/PopupOpeningObserver.h" |
37 #include "core/page/ScopedPageLoadDeferrer.h" | 37 #include "core/page/ScopedPageLoadDeferrer.h" |
38 #include "core/page/WindowFeatures.h" | 38 #include "core/page/WindowFeatures.h" |
39 #include "platform/FileChooser.h" | 39 #include "platform/FileChooser.h" |
40 #include "platform/Logging.h" | 40 #include "platform/Logging.h" |
41 #include "platform/PlatformScreen.h" | |
41 #include "platform/geometry/IntRect.h" | 42 #include "platform/geometry/IntRect.h" |
42 #include "platform/network/NetworkHints.h" | 43 #include "platform/network/NetworkHints.h" |
43 #include "public/platform/WebScreenInfo.h" | 44 #include "public/platform/WebScreenInfo.h" |
44 #include "wtf/PassRefPtr.h" | 45 #include "wtf/PassRefPtr.h" |
45 #include "wtf/Vector.h" | 46 #include "wtf/Vector.h" |
47 #include <algorithm> | |
48 | |
49 using namespace std; | |
dcheng
2015/04/29 21:37:46
This is generally discourage in Chrome, and we pro
Nate Chapin
2015/05/01 20:30:52
Done.
| |
46 | 50 |
47 namespace blink { | 51 namespace blink { |
48 | 52 |
49 using namespace HTMLNames; | 53 using namespace HTMLNames; |
50 | 54 |
51 Chrome::Chrome(Page* page, ChromeClient* client) | 55 Chrome::Chrome(Page* page, ChromeClient* client) |
52 : m_page(page) | 56 : m_page(page) |
53 , m_client(client) | 57 , m_client(client) |
54 { | 58 { |
55 ASSERT(m_client); | 59 ASSERT(m_client); |
(...skipping 21 matching lines...) Expand all Loading... | |
77 blink::WebScreenInfo Chrome::screenInfo() const | 81 blink::WebScreenInfo Chrome::screenInfo() const |
78 { | 82 { |
79 return m_client->screenInfo(); | 83 return m_client->screenInfo(); |
80 } | 84 } |
81 | 85 |
82 void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const | 86 void Chrome::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const |
83 { | 87 { |
84 m_client->contentsSizeChanged(frame, size); | 88 m_client->contentsSizeChanged(frame, size); |
85 } | 89 } |
86 | 90 |
87 void Chrome::setWindowRect(const IntRect& rect) const | 91 void Chrome::setWindowRect(Widget* widget, const IntRect& pendingRect) const |
88 { | 92 { |
89 m_client->setWindowRect(rect); | 93 IntRect screen = screenAvailableRect(widget); |
94 IntRect window = pendingRect; | |
95 | |
96 IntSize minimumSize = m_client->minimumWindowSize(); | |
97 // Let size 0 pass through, since that indicates default size, not minimum s ize. | |
98 if (window.width()) | |
99 window.setWidth(min(max(minimumSize.width(), window.width()), screen.wid th())); | |
100 if (window.height()) | |
101 window.setHeight(min(max(minimumSize.height(), window.height()), screen. height())); | |
102 | |
103 // Constrain the window position within the valid screen area. | |
104 window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())) ); | |
105 window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height()) )); | |
106 | |
107 | |
108 m_client->setWindowRect(window); | |
90 } | 109 } |
91 | 110 |
92 IntRect Chrome::windowRect() const | 111 IntRect Chrome::windowRect() const |
93 { | 112 { |
94 return m_client->windowRect(); | 113 return m_client->windowRect(); |
95 } | 114 } |
96 | 115 |
97 IntRect Chrome::pageRect() const | 116 IntRect Chrome::pageRect() const |
98 { | 117 { |
99 return m_client->pageRect(); | 118 return m_client->pageRect(); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 { | 407 { |
389 m_client->registerViewportLayers(); | 408 m_client->registerViewportLayers(); |
390 } | 409 } |
391 | 410 |
392 void Chrome::willBeDestroyed() | 411 void Chrome::willBeDestroyed() |
393 { | 412 { |
394 m_client->chromeDestroyed(); | 413 m_client->chromeDestroyed(); |
395 } | 414 } |
396 | 415 |
397 } // namespace blink | 416 } // namespace blink |
OLD | NEW |