| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "grit/locale_settings.h" | 59 #include "grit/locale_settings.h" |
| 60 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" | 60 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" |
| 61 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" | 61 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
| 62 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 62 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
| 64 #include "ui/base/l10n/l10n_util.h" | 64 #include "ui/base/l10n/l10n_util.h" |
| 65 #include "ui/base/models/menu_model.h" | 65 #include "ui/base/models/menu_model.h" |
| 66 #include "ui/base/view_prop.h" | 66 #include "ui/base/view_prop.h" |
| 67 #include "ui/views/controls/webview/webview.h" | 67 #include "ui/views/controls/webview/webview.h" |
| 68 #include "ui/views/layout/grid_layout.h" | 68 #include "ui/views/layout/grid_layout.h" |
| 69 #include "ui/views/win/hwnd_message_handler.h" |
| 69 | 70 |
| 70 using content::BrowserThread; | 71 using content::BrowserThread; |
| 71 using content::LoadNotificationDetails; | 72 using content::LoadNotificationDetails; |
| 72 using content::NativeWebKeyboardEvent; | 73 using content::NativeWebKeyboardEvent; |
| 73 using content::NavigationController; | 74 using content::NavigationController; |
| 74 using content::NavigationEntry; | 75 using content::NavigationEntry; |
| 75 using content::OpenURLParams; | 76 using content::OpenURLParams; |
| 76 using content::RenderViewHost; | 77 using content::RenderViewHost; |
| 77 using content::SSLStatus; | 78 using content::SSLStatus; |
| 78 using content::WebContents; | 79 using content::WebContents; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 bool route_all_top_level_navigations) { | 167 bool route_all_top_level_navigations) { |
| 167 if (IsWindow(GetNativeView())) { | 168 if (IsWindow(GetNativeView())) { |
| 168 NOTREACHED(); | 169 NOTREACHED(); |
| 169 return false; | 170 return false; |
| 170 } | 171 } |
| 171 | 172 |
| 172 load_requests_via_automation_ = load_requests_via_automation; | 173 load_requests_via_automation_ = load_requests_via_automation; |
| 173 handle_top_level_requests_ = handle_top_level_requests; | 174 handle_top_level_requests_ = handle_top_level_requests; |
| 174 route_all_top_level_navigations_ = route_all_top_level_navigations; | 175 route_all_top_level_navigations_ = route_all_top_level_navigations; |
| 175 | 176 |
| 176 set_window_style(WS_POPUP | WS_CLIPCHILDREN); | 177 GetMessageHandler()->set_window_style(WS_POPUP | WS_CLIPCHILDREN); |
| 177 | 178 |
| 178 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 179 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 179 params.bounds = bounds; | 180 params.bounds = bounds; |
| 180 params.native_widget = this; | 181 params.native_widget = this; |
| 181 GetWidget()->Init(params); | 182 GetWidget()->Init(params); |
| 182 if (!IsWindow(GetNativeView())) { | 183 if (!IsWindow(GetNativeView())) { |
| 183 NOTREACHED(); | 184 NOTREACHED(); |
| 184 return false; | 185 return false; |
| 185 } | 186 } |
| 186 | 187 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 string16 url_string = CA2W(url.spec().c_str()); | 587 string16 url_string = CA2W(url.spec().c_str()); |
| 587 automation_->Send( | 588 automation_->Send( |
| 588 new AutomationMsg_UpdateTargetUrl(tab_handle_, url_string)); | 589 new AutomationMsg_UpdateTargetUrl(tab_handle_, url_string)); |
| 589 } | 590 } |
| 590 } | 591 } |
| 591 | 592 |
| 592 void ExternalTabContainerWin::ContentsZoomChange(bool zoom_in) { | 593 void ExternalTabContainerWin::ContentsZoomChange(bool zoom_in) { |
| 593 } | 594 } |
| 594 | 595 |
| 595 gfx::NativeWindow ExternalTabContainerWin::GetFrameNativeWindow() { | 596 gfx::NativeWindow ExternalTabContainerWin::GetFrameNativeWindow() { |
| 596 return hwnd(); | 597 return GetNativeView(); |
| 597 } | 598 } |
| 598 | 599 |
| 599 bool ExternalTabContainerWin::TakeFocus(content::WebContents* source, | 600 bool ExternalTabContainerWin::TakeFocus(content::WebContents* source, |
| 600 bool reverse) { | 601 bool reverse) { |
| 601 if (automation_) { | 602 if (automation_) { |
| 602 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, | 603 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, |
| 603 base::win::IsShiftPressed())); | 604 base::win::IsShiftPressed())); |
| 604 } | 605 } |
| 605 | 606 |
| 606 return true; | 607 return true; |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 if (params.disposition == CURRENT_TAB) { | 1262 if (params.disposition == CURRENT_TAB) { |
| 1262 DCHECK(route_all_top_level_navigations_); | 1263 DCHECK(route_all_top_level_navigations_); |
| 1263 forward_params.disposition = NEW_FOREGROUND_TAB; | 1264 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1264 } | 1265 } |
| 1265 WebContents* new_contents = | 1266 WebContents* new_contents = |
| 1266 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); | 1267 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); |
| 1267 // support only one navigation for a dummy tab before it is killed. | 1268 // support only one navigation for a dummy tab before it is killed. |
| 1268 ::DestroyWindow(GetNativeView()); | 1269 ::DestroyWindow(GetNativeView()); |
| 1269 return new_contents; | 1270 return new_contents; |
| 1270 } | 1271 } |
| OLD | NEW |