Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 void* ChromeClientImpl::webView() const | 178 void* ChromeClientImpl::webView() const |
| 179 { | 179 { |
| 180 return static_cast<void*>(m_webView); | 180 return static_cast<void*>(m_webView); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ChromeClientImpl::chromeDestroyed() | 183 void ChromeClientImpl::chromeDestroyed() |
| 184 { | 184 { |
| 185 // Our lifetime is bound to the WebViewImpl. | 185 // Our lifetime is bound to the WebViewImpl. |
| 186 } | 186 } |
| 187 | 187 |
| 188 void ChromeClientImpl::setWindowRect(const IntRect& r) | 188 void ChromeClientImpl::setWindowRect(const IntRect& r, LocalFrame* frame) |
| 189 { | 189 { |
| 190 if (m_webView->client()) | 190 CHECK(frame == m_webView->mainFrameImpl()->frame()); |
|
bokan
2016/07/26 23:17:05
Wouldn't it be easier if ChromeClient implementati
dcheng
2016/07/29 08:31:11
Why CHECK()? In general, it's better to avoid CHEC
| |
| 191 m_webView->client()->setWindowRect(r); | 191 WebWidgetClient* client = WebLocalFrameImpl::fromFrame(frame)->frameWidget() ->client(); |
| 192 | |
| 193 if (client) | |
| 194 client->setWindowRect(r); | |
| 192 } | 195 } |
| 193 | 196 |
| 194 IntRect ChromeClientImpl::windowRect() | 197 IntRect ChromeClientImpl::rootWindowRect() |
| 195 { | 198 { |
| 196 WebRect rect; | 199 WebRect rect; |
| 197 if (m_webView->client()) { | 200 if (m_webView->client()) { |
| 198 rect = m_webView->client()->rootWindowRect(); | 201 rect = m_webView->client()->rootWindowRect(); |
| 199 } else { | 202 } else { |
| 200 // These numbers will be fairly wrong. The window's x/y coordinates will | 203 // These numbers will be fairly wrong. The window's x/y coordinates will |
| 201 // be the top left corner of the screen and the size will be the content | 204 // be the top left corner of the screen and the size will be the content |
| 202 // size instead of the window size. | 205 // size instead of the window size. |
| 203 rect.width = m_webView->size().width; | 206 rect.width = m_webView->size().width; |
| 204 rect.height = m_webView->size().height; | 207 rect.height = m_webView->size().height; |
| 205 } | 208 } |
| 206 return IntRect(rect); | 209 return IntRect(rect); |
| 207 } | 210 } |
| 208 | 211 |
| 209 IntRect ChromeClientImpl::pageRect() | 212 IntRect ChromeClientImpl::pageRect() |
| 210 { | 213 { |
| 211 // We hide the details of the window's border thickness from the web page by | 214 // We hide the details of the window's border thickness from the web page by |
| 212 // simple re-using the window position here. So, from the point-of-view of | 215 // simple re-using the window position here. So, from the point-of-view of |
| 213 // the web page, the window has no border. | 216 // the web page, the window has no border. |
| 214 return windowRect(); | 217 return rootWindowRect(); |
| 215 } | 218 } |
| 216 | 219 |
| 217 void ChromeClientImpl::focus() | 220 void ChromeClientImpl::focus() |
| 218 { | 221 { |
| 219 if (m_webView->client()) | 222 if (m_webView->client()) |
| 220 m_webView->client()->didFocus(); | 223 m_webView->client()->didFocus(); |
| 221 } | 224 } |
| 222 | 225 |
| 223 bool ChromeClientImpl::canTakeFocus(WebFocusType) | 226 bool ChromeClientImpl::canTakeFocus(WebFocusType) |
| 224 { | 227 { |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1079 { | 1082 { |
| 1080 return wrapUnique(m_webView->scheduler()->createFrameScheduler(blameContext) .release()); | 1083 return wrapUnique(m_webView->scheduler()->createFrameScheduler(blameContext) .release()); |
| 1081 } | 1084 } |
| 1082 | 1085 |
| 1083 double ChromeClientImpl::lastFrameTimeMonotonic() const | 1086 double ChromeClientImpl::lastFrameTimeMonotonic() const |
| 1084 { | 1087 { |
| 1085 return m_webView->lastFrameTimeMonotonic(); | 1088 return m_webView->lastFrameTimeMonotonic(); |
| 1086 } | 1089 } |
| 1087 | 1090 |
| 1088 } // namespace blink | 1091 } // namespace blink |
| OLD | NEW |