| 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 "AccessibilityObject.h" | 7 #include "AccessibilityObject.h" |
| 8 #include "AXObjectCache.h" | 8 #include "AXObjectCache.h" |
| 9 #include "CharacterNames.h" | 9 #include "CharacterNames.h" |
| 10 #include "Console.h" | 10 #include "Console.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "webkit/api/public/WebURLRequest.h" | 41 #include "webkit/api/public/WebURLRequest.h" |
| 42 #include "webkit/api/public/WebViewClient.h" | 42 #include "webkit/api/public/WebViewClient.h" |
| 43 #include "webkit/api/src/NotificationPresenterImpl.h" | 43 #include "webkit/api/src/NotificationPresenterImpl.h" |
| 44 #include "webkit/api/src/WebFileChooserCompletionImpl.h" | 44 #include "webkit/api/src/WebFileChooserCompletionImpl.h" |
| 45 #include "webkit/api/src/WrappedResourceRequest.h" | 45 #include "webkit/api/src/WrappedResourceRequest.h" |
| 46 #include "webkit/glue/chrome_client_impl.h" | 46 #include "webkit/glue/chrome_client_impl.h" |
| 47 #include "webkit/glue/glue_util.h" | 47 #include "webkit/glue/glue_util.h" |
| 48 #include "webkit/glue/webframe_impl.h" | 48 #include "webkit/glue/webframe_impl.h" |
| 49 #include "webkit/glue/webkit_glue.h" | 49 #include "webkit/glue/webkit_glue.h" |
| 50 #include "webkit/glue/webpopupmenu_impl.h" | 50 #include "webkit/glue/webpopupmenu_impl.h" |
| 51 #include "webkit/glue/webview_delegate.h" | |
| 52 #include "webkit/glue/webview_impl.h" | 51 #include "webkit/glue/webview_impl.h" |
| 53 | 52 |
| 54 using WebCore::PopupContainer; | 53 using WebCore::PopupContainer; |
| 55 using WebCore::PopupItem; | 54 using WebCore::PopupItem; |
| 56 | 55 |
| 57 using WebKit::WebAccessibilityObject; | 56 using WebKit::WebAccessibilityObject; |
| 58 using WebKit::WebConsoleMessage; | 57 using WebKit::WebConsoleMessage; |
| 59 using WebKit::WebCursorInfo; | 58 using WebKit::WebCursorInfo; |
| 60 using WebKit::WebFileChooserCompletionImpl; | 59 using WebKit::WebFileChooserCompletionImpl; |
| 61 using WebKit::WebInputEvent; | 60 using WebKit::WebInputEvent; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 bool meta = mouse_event->modifiers & WebMouseEvent::MetaKey; | 237 bool meta = mouse_event->modifiers & WebMouseEvent::MetaKey; |
| 239 | 238 |
| 240 if (!WebViewImpl::NavigationPolicyFromMouseEvent(button_number, ctrl, | 239 if (!WebViewImpl::NavigationPolicyFromMouseEvent(button_number, ctrl, |
| 241 shift, alt, meta, &policy)) | 240 shift, alt, meta, &policy)) |
| 242 return false; | 241 return false; |
| 243 | 242 |
| 244 return policy == WebKit::WebNavigationPolicyNewBackgroundTab; | 243 return policy == WebKit::WebNavigationPolicyNewBackgroundTab; |
| 245 } | 244 } |
| 246 | 245 |
| 247 void ChromeClientImpl::show() { | 246 void ChromeClientImpl::show() { |
| 248 WebViewDelegate* delegate = webview_->delegate(); | 247 if (!webview_->client()) |
| 249 if (delegate) { | 248 return; |
| 250 // If our default configuration was modified by a script or wasn't | |
| 251 // created by a user gesture, then show as a popup. Else, let this | |
| 252 // new window be opened as a toplevel window. | |
| 253 // | |
| 254 bool as_popup = | |
| 255 !toolbars_visible_ || | |
| 256 !statusbar_visible_ || | |
| 257 !scrollbars_visible_ || | |
| 258 !menubar_visible_ || | |
| 259 !resizable_; | |
| 260 | 249 |
| 261 WebNavigationPolicy policy = WebKit::WebNavigationPolicyNewForegroundTab; | 250 // If our default configuration was modified by a script or wasn't |
| 262 if (as_popup) | 251 // created by a user gesture, then show as a popup. Else, let this |
| 263 policy = WebKit::WebNavigationPolicyNewPopup; | 252 // new window be opened as a toplevel window. |
| 264 if (CurrentEventShouldCauseBackgroundTab( | 253 bool as_popup = |
| 265 WebViewImpl::current_input_event())) | 254 !toolbars_visible_ || |
| 266 policy = WebKit::WebNavigationPolicyNewBackgroundTab; | 255 !statusbar_visible_ || |
| 256 !scrollbars_visible_ || |
| 257 !menubar_visible_ || |
| 258 !resizable_; |
| 267 | 259 |
| 268 delegate->show(policy); | 260 WebNavigationPolicy policy = WebKit::WebNavigationPolicyNewForegroundTab; |
| 269 } | 261 if (as_popup) |
| 262 policy = WebKit::WebNavigationPolicyNewPopup; |
| 263 if (CurrentEventShouldCauseBackgroundTab( |
| 264 WebViewImpl::current_input_event())) |
| 265 policy = WebKit::WebNavigationPolicyNewBackgroundTab; |
| 266 |
| 267 webview_->client()->show(policy); |
| 270 } | 268 } |
| 271 | 269 |
| 272 bool ChromeClientImpl::canRunModal() { | 270 bool ChromeClientImpl::canRunModal() { |
| 273 return webview_->client() != NULL; | 271 return webview_->client() != NULL; |
| 274 } | 272 } |
| 275 | 273 |
| 276 void ChromeClientImpl::runModal() { | 274 void ChromeClientImpl::runModal() { |
| 277 if (webview_->client()) | 275 if (webview_->client()) |
| 278 webview_->client()->runModal(); | 276 webview_->client()->runModal(); |
| 279 } | 277 } |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 info->itemHeight = popup_container->menuItemHeight(); | 618 info->itemHeight = popup_container->menuItemHeight(); |
| 621 info->selectedIndex = popup_container->selectedIndex(); | 619 info->selectedIndex = popup_container->selectedIndex(); |
| 622 info->items.swap(output_items); | 620 info->items.swap(output_items); |
| 623 } | 621 } |
| 624 | 622 |
| 625 #if ENABLE(NOTIFICATIONS) | 623 #if ENABLE(NOTIFICATIONS) |
| 626 WebCore::NotificationPresenter* ChromeClientImpl::notificationPresenter() const
{ | 624 WebCore::NotificationPresenter* ChromeClientImpl::notificationPresenter() const
{ |
| 627 return webview_->GetNotificationPresenter(); | 625 return webview_->GetNotificationPresenter(); |
| 628 } | 626 } |
| 629 #endif | 627 #endif |
| OLD | NEW |