| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 | 8 |
| 9 MSVC_PUSH_WARNING_LEVEL(0); | 9 MSVC_PUSH_WARNING_LEVEL(0); |
| 10 #include "AccessibilityObject.h" |
| 11 #include "AXObjectCache.h" |
| 10 #include "Console.h" | 12 #include "Console.h" |
| 11 #include "Cursor.h" | 13 #include "Cursor.h" |
| 14 #include "Document.h" |
| 12 #include "DocumentLoader.h" | 15 #include "DocumentLoader.h" |
| 13 #include "FloatRect.h" | 16 #include "FloatRect.h" |
| 14 #include "FileChooser.h" | 17 #include "FileChooser.h" |
| 15 #include "FrameLoadRequest.h" | 18 #include "FrameLoadRequest.h" |
| 16 #include "FrameView.h" | 19 #include "FrameView.h" |
| 17 #include "HitTestResult.h" | 20 #include "HitTestResult.h" |
| 18 #include "IntRect.h" | 21 #include "IntRect.h" |
| 22 #include "Node.h" |
| 19 #include "Page.h" | 23 #include "Page.h" |
| 20 #include "PopupMenuChromium.h" | 24 #include "PopupMenuChromium.h" |
| 21 #include "ScriptController.h" | 25 #include "ScriptController.h" |
| 22 #include "WindowFeatures.h" | 26 #include "WindowFeatures.h" |
| 23 #if USE(V8) | 27 #if USE(V8) |
| 24 #include "v8_proxy.h" | 28 #include "v8_proxy.h" |
| 25 #endif | 29 #endif |
| 26 MSVC_POP_WARNING(); | 30 MSVC_POP_WARNING(); |
| 27 | 31 |
| 28 #undef LOG | 32 #undef LOG |
| 29 | 33 |
| 30 #include "webkit/glue/chrome_client_impl.h" | 34 #include "webkit/glue/chrome_client_impl.h" |
| 31 | 35 |
| 32 #include "base/logging.h" | |
| 33 #include "base/gfx/rect.h" | 36 #include "base/gfx/rect.h" |
| 34 #include "googleurl/src/gurl.h" | 37 #include "googleurl/src/gurl.h" |
| 35 #include "webkit/api/public/WebInputEvent.h" | 38 #include "webkit/api/public/WebInputEvent.h" |
| 36 #include "webkit/api/public/WebKit.h" | 39 #include "webkit/api/public/WebKit.h" |
| 37 #include "webkit/glue/glue_util.h" | 40 #include "webkit/glue/glue_util.h" |
| 38 #include "webkit/glue/webdevtoolsagent_impl.h" | 41 #include "webkit/glue/webdevtoolsagent_impl.h" |
| 39 #include "webkit/glue/webframe_impl.h" | 42 #include "webkit/glue/webframe_impl.h" |
| 40 #include "webkit/glue/webkit_glue.h" | 43 #include "webkit/glue/webkit_glue.h" |
| 41 #include "webkit/glue/weburlrequest_impl.h" | 44 #include "webkit/glue/weburlrequest_impl.h" |
| 42 #include "webkit/glue/webview_delegate.h" | 45 #include "webkit/glue/webview_delegate.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // so that things drawn in it are scaled just like the web page is. | 137 // so that things drawn in it are scaled just like the web page is. |
| 135 // | 138 // |
| 136 // We don't currently implement scaling, so just return 1.0 (no scaling). | 139 // We don't currently implement scaling, so just return 1.0 (no scaling). |
| 137 return 1.0; | 140 return 1.0; |
| 138 } | 141 } |
| 139 | 142 |
| 140 void ChromeClientImpl::focus() { | 143 void ChromeClientImpl::focus() { |
| 141 WebViewDelegate* delegate = webview_->delegate(); | 144 WebViewDelegate* delegate = webview_->delegate(); |
| 142 if (delegate) | 145 if (delegate) |
| 143 delegate->Focus(webview_); | 146 delegate->Focus(webview_); |
| 147 |
| 148 // If accessibility is enabled, we should notify assistive technology that the |
| 149 // active AccessibilityObject changed. |
| 150 WebCore::Document* doc = webview_->GetFocusedWebCoreFrame()->document(); |
| 151 |
| 152 if (doc && doc->axObjectCache()->accessibilityEnabled()) { |
| 153 WebCore::Node* focused_node = webview_->GetFocusedNode(); |
| 154 |
| 155 if (!focused_node) { |
| 156 // Could not retrieve focused Node. |
| 157 return; |
| 158 } |
| 159 |
| 160 // Retrieve the focused AccessibilityObject. |
| 161 WebCore::AccessibilityObject* focused_acc_obj = |
| 162 doc->axObjectCache()->getOrCreate(focused_node->renderer()); |
| 163 |
| 164 // Alert assistive technology that focus changed. |
| 165 if (focused_acc_obj) { |
| 166 delegate->FocusAccessibilityObject(focused_acc_obj); |
| 167 } |
| 168 } |
| 144 } | 169 } |
| 145 | 170 |
| 146 void ChromeClientImpl::unfocus() { | 171 void ChromeClientImpl::unfocus() { |
| 147 WebViewDelegate* delegate = webview_->delegate(); | 172 WebViewDelegate* delegate = webview_->delegate(); |
| 148 if (delegate) | 173 if (delegate) |
| 149 delegate->Blur(webview_); | 174 delegate->Blur(webview_); |
| 150 } | 175 } |
| 151 | 176 |
| 152 bool ChromeClientImpl::canTakeFocus(WebCore::FocusDirection) { | 177 bool ChromeClientImpl::canTakeFocus(WebCore::FocusDirection) { |
| 153 // For now the browser can always take focus if we're not running layout | 178 // For now the browser can always take focus if we're not running layout |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 219 } |
| 195 | 220 |
| 196 static inline bool CurrentEventShouldCauseBackgroundTab( | 221 static inline bool CurrentEventShouldCauseBackgroundTab( |
| 197 const WebInputEvent* input_event) { | 222 const WebInputEvent* input_event) { |
| 198 if (!input_event) | 223 if (!input_event) |
| 199 return false; | 224 return false; |
| 200 | 225 |
| 201 if (input_event->type != WebInputEvent::MouseUp) | 226 if (input_event->type != WebInputEvent::MouseUp) |
| 202 return false; | 227 return false; |
| 203 | 228 |
| 204 const WebMouseEvent* mouse_event = static_cast<const WebMouseEvent*>(input_eve
nt); | 229 const WebMouseEvent* mouse_event = |
| 230 static_cast<const WebMouseEvent*>(input_event); |
| 205 return (mouse_event->button == WebMouseEvent::ButtonMiddle); | 231 return (mouse_event->button == WebMouseEvent::ButtonMiddle); |
| 206 } | 232 } |
| 207 | 233 |
| 208 void ChromeClientImpl::show() { | 234 void ChromeClientImpl::show() { |
| 209 WebViewDelegate* delegate = webview_->delegate(); | 235 WebViewDelegate* delegate = webview_->delegate(); |
| 210 if (delegate) { | 236 if (delegate) { |
| 211 // If our default configuration was modified by a script or wasn't | 237 // If our default configuration was modified by a script or wasn't |
| 212 // created by a user gesture, then show as a popup. Else, let this | 238 // created by a user gesture, then show as a popup. Else, let this |
| 213 // new window be opened as a toplevel window. | 239 // new window be opened as a toplevel window. |
| 214 // | 240 // |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 const WebCore::String& source_id) { | 313 const WebCore::String& source_id) { |
| 288 WebViewDelegate* delegate = webview_->delegate(); | 314 WebViewDelegate* delegate = webview_->delegate(); |
| 289 if (delegate) { | 315 if (delegate) { |
| 290 std::wstring wstr_message = webkit_glue::StringToStdWString(message); | 316 std::wstring wstr_message = webkit_glue::StringToStdWString(message); |
| 291 std::wstring wstr_source_id = webkit_glue::StringToStdWString(source_id); | 317 std::wstring wstr_source_id = webkit_glue::StringToStdWString(source_id); |
| 292 delegate->AddMessageToConsole(webview_, wstr_message, | 318 delegate->AddMessageToConsole(webview_, wstr_message, |
| 293 line_no, wstr_source_id); | 319 line_no, wstr_source_id); |
| 294 } | 320 } |
| 295 WebDevToolsAgentImpl* devtools_agent = webview_->GetWebDevToolsAgentImpl(); | 321 WebDevToolsAgentImpl* devtools_agent = webview_->GetWebDevToolsAgentImpl(); |
| 296 if (devtools_agent) { | 322 if (devtools_agent) { |
| 297 devtools_agent->AddMessageToConsole(source, level, message, line_no, source_
id); | 323 devtools_agent->AddMessageToConsole(source, level, message, line_no, |
| 324 source_id); |
| 298 } | 325 } |
| 299 } | 326 } |
| 300 | 327 |
| 301 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() { | 328 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() { |
| 302 return webview_->delegate() != NULL; | 329 return webview_->delegate() != NULL; |
| 303 } | 330 } |
| 304 | 331 |
| 305 bool ChromeClientImpl::runBeforeUnloadConfirmPanel( | 332 bool ChromeClientImpl::runBeforeUnloadConfirmPanel( |
| 306 const WebCore::String& message, | 333 const WebCore::String& message, |
| 307 WebCore::Frame* frame) { | 334 WebCore::Frame* frame) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 // EventHandler.cpp and since we don't want that we set a flag indicating | 622 // EventHandler.cpp and since we don't want that we set a flag indicating |
| 596 // that the next SetCursor call is to be ignored. | 623 // that the next SetCursor call is to be ignored. |
| 597 ignore_next_set_cursor_ = true; | 624 ignore_next_set_cursor_ = true; |
| 598 } | 625 } |
| 599 | 626 |
| 600 void ChromeClientImpl::formStateDidChange(const WebCore::Node*) { | 627 void ChromeClientImpl::formStateDidChange(const WebCore::Node*) { |
| 601 WebViewDelegate* delegate = webview_->delegate(); | 628 WebViewDelegate* delegate = webview_->delegate(); |
| 602 if (delegate) | 629 if (delegate) |
| 603 delegate->OnNavStateChanged(webview_); | 630 delegate->OnNavStateChanged(webview_); |
| 604 } | 631 } |
| OLD | NEW |