| 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 "chrome/browser/ui/views/external_tab_container_win.h" | 5 #include "chrome/browser/ui/views/external_tab_container_win.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "chrome/common/render_messages.h" | 44 #include "chrome/common/render_messages.h" |
| 45 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
| 46 #include "content/public/browser/load_notification_details.h" | 46 #include "content/public/browser/load_notification_details.h" |
| 47 #include "content/public/browser/native_web_keyboard_event.h" | 47 #include "content/public/browser/native_web_keyboard_event.h" |
| 48 #include "content/public/browser/navigation_details.h" | 48 #include "content/public/browser/navigation_details.h" |
| 49 #include "content/public/browser/navigation_entry.h" | 49 #include "content/public/browser/navigation_entry.h" |
| 50 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
| 51 #include "content/public/browser/render_process_host.h" | 51 #include "content/public/browser/render_process_host.h" |
| 52 #include "content/public/browser/render_view_host.h" | 52 #include "content/public/browser/render_view_host.h" |
| 53 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
| 54 #include "content/public/browser/web_contents_view.h" |
| 54 #include "content/public/common/bindings_policy.h" | 55 #include "content/public/common/bindings_policy.h" |
| 55 #include "content/public/common/frame_navigate_params.h" | 56 #include "content/public/common/frame_navigate_params.h" |
| 56 #include "content/public/common/page_transition_types.h" | 57 #include "content/public/common/page_transition_types.h" |
| 57 #include "content/public/common/page_zoom.h" | 58 #include "content/public/common/page_zoom.h" |
| 58 #include "content/public/common/renderer_preferences.h" | 59 #include "content/public/common/renderer_preferences.h" |
| 59 #include "content/public/common/ssl_status.h" | 60 #include "content/public/common/ssl_status.h" |
| 60 #include "grit/generated_resources.h" | 61 #include "grit/generated_resources.h" |
| 61 #include "grit/locale_settings.h" | 62 #include "grit/locale_settings.h" |
| 62 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" | 63 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" |
| 63 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" | 64 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // during the SetParent call we will otherwise get a WA_ACTIVATE call | 244 // during the SetParent call we will otherwise get a WA_ACTIVATE call |
| 244 // that causes us to steal the current focus. | 245 // that causes us to steal the current focus. |
| 245 SetWindowLong( | 246 SetWindowLong( |
| 246 GetNativeView(), GWL_STYLE, | 247 GetNativeView(), GWL_STYLE, |
| 247 (GetWindowLong(GetNativeView(), GWL_STYLE) & ~WS_POPUP) | style); | 248 (GetWindowLong(GetNativeView(), GWL_STYLE) & ~WS_POPUP) | style); |
| 248 | 249 |
| 249 // Now apply the parenting and style | 250 // Now apply the parenting and style |
| 250 if (parent) | 251 if (parent) |
| 251 SetParent(GetNativeView(), parent); | 252 SetParent(GetNativeView(), parent); |
| 252 | 253 |
| 253 ::ShowWindow(existing_contents->GetNativeView(), SW_SHOWNA); | 254 ::ShowWindow(existing_contents->GetView()->GetNativeView(), SW_SHOWNA); |
| 254 | 255 |
| 255 LoadAccelerators(); | 256 LoadAccelerators(); |
| 256 SetupExternalTabView(); | 257 SetupExternalTabView(); |
| 257 BlockedContentTabHelper::FromWebContents(existing_contents)-> | 258 BlockedContentTabHelper::FromWebContents(existing_contents)-> |
| 258 set_delegate(this); | 259 set_delegate(this); |
| 259 return true; | 260 return true; |
| 260 } | 261 } |
| 261 | 262 |
| 262 void ExternalTabContainerWin::Uninitialize() { | 263 void ExternalTabContainerWin::Uninitialize() { |
| 263 registrar_.RemoveAll(); | 264 registrar_.RemoveAll(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 NativeWebKeyboardEvent keyboard_event(msg); | 392 NativeWebKeyboardEvent keyboard_event(msg); |
| 392 unhandled_keyboard_event_handler_.HandleKeyboardEvent(keyboard_event, | 393 unhandled_keyboard_event_handler_.HandleKeyboardEvent(keyboard_event, |
| 393 focus_manager_); | 394 focus_manager_); |
| 394 } | 395 } |
| 395 | 396 |
| 396 void ExternalTabContainerWin::FocusThroughTabTraversal( | 397 void ExternalTabContainerWin::FocusThroughTabTraversal( |
| 397 bool reverse, | 398 bool reverse, |
| 398 bool restore_focus_to_view) { | 399 bool restore_focus_to_view) { |
| 399 DCHECK(web_contents_.get()); | 400 DCHECK(web_contents_.get()); |
| 400 if (web_contents_.get()) | 401 if (web_contents_.get()) |
| 401 web_contents_->Focus(); | 402 web_contents_->GetView()->Focus(); |
| 402 | 403 |
| 403 // The web_contents_ member can get destroyed in the context of the call to | 404 // The web_contents_ member can get destroyed in the context of the call to |
| 404 // WebContentsViewViews::Focus() above. This method eventually calls SetFocus | 405 // WebContentsViewViews::Focus() above. This method eventually calls SetFocus |
| 405 // on the native window, which could end up dispatching messages like | 406 // on the native window, which could end up dispatching messages like |
| 406 // WM_DESTROY for the external tab. | 407 // WM_DESTROY for the external tab. |
| 407 if (web_contents_.get() && restore_focus_to_view) | 408 if (web_contents_.get() && restore_focus_to_view) |
| 408 web_contents_->FocusThroughTabTraversal(reverse); | 409 web_contents_->FocusThroughTabTraversal(reverse); |
| 409 } | 410 } |
| 410 | 411 |
| 411 // static | 412 // static |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 if (params.disposition == CURRENT_TAB) { | 1279 if (params.disposition == CURRENT_TAB) { |
| 1279 DCHECK(route_all_top_level_navigations_); | 1280 DCHECK(route_all_top_level_navigations_); |
| 1280 forward_params.disposition = NEW_FOREGROUND_TAB; | 1281 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1281 } | 1282 } |
| 1282 WebContents* new_contents = | 1283 WebContents* new_contents = |
| 1283 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); | 1284 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); |
| 1284 // support only one navigation for a dummy tab before it is killed. | 1285 // support only one navigation for a dummy tab before it is killed. |
| 1285 ::DestroyWindow(GetNativeView()); | 1286 ::DestroyWindow(GetNativeView()); |
| 1286 return new_contents; | 1287 return new_contents; |
| 1287 } | 1288 } |
| OLD | NEW |