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 <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlapp.h> | 8 #include <atlapp.h> |
9 #include <atlconv.h> | 9 #include <atlconv.h> |
10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 using content::BrowserThread; | 84 using content::BrowserThread; |
85 using content::LoadNotificationDetails; | 85 using content::LoadNotificationDetails; |
86 using content::NativeWebKeyboardEvent; | 86 using content::NativeWebKeyboardEvent; |
87 using content::NavigationController; | 87 using content::NavigationController; |
88 using content::NavigationEntry; | 88 using content::NavigationEntry; |
89 using content::OpenURLParams; | 89 using content::OpenURLParams; |
90 using content::RenderViewHost; | 90 using content::RenderViewHost; |
91 using content::SSLStatus; | 91 using content::SSLStatus; |
92 using content::WebContents; | 92 using content::WebContents; |
93 using WebKit::WebReferrerPolicy; | 93 using blink::WebReferrerPolicy; |
94 | 94 |
95 namespace { | 95 namespace { |
96 | 96 |
97 static const char kWindowObjectKey[] = "ChromeWindowObject"; | 97 static const char kWindowObjectKey[] = "ChromeWindowObject"; |
98 | 98 |
99 // The following helper functions exist to localize UI toolkit-specific code. | 99 // The following helper functions exist to localize UI toolkit-specific code. |
100 | 100 |
101 void ShowNativeView(gfx::NativeView view) { | 101 void ShowNativeView(gfx::NativeView view) { |
102 #if !defined(USE_AURA) | 102 #if !defined(USE_AURA) |
103 ::ShowWindow(view, SW_SHOWNA); | 103 ::ShowWindow(view, SW_SHOWNA); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 if (!referrer_is_web_url) | 161 if (!referrer_is_web_url) |
162 return true; | 162 return true; |
163 | 163 |
164 if (!referrer_is_secure) | 164 if (!referrer_is_secure) |
165 return false; | 165 return false; |
166 | 166 |
167 return !url.SchemeIsSecure(); | 167 return !url.SchemeIsSecure(); |
168 } | 168 } |
169 | 169 |
170 GURL GenerateReferrer(WebKit::WebReferrerPolicy policy, | 170 GURL GenerateReferrer(blink::WebReferrerPolicy policy, |
171 const GURL& url, | 171 const GURL& url, |
172 const GURL& referrer) { | 172 const GURL& referrer) { |
173 if (referrer.is_empty()) | 173 if (referrer.is_empty()) |
174 return GURL(); | 174 return GURL(); |
175 | 175 |
176 switch (policy) { | 176 switch (policy) { |
177 case WebKit::WebReferrerPolicyNever: | 177 case blink::WebReferrerPolicyNever: |
178 return GURL(); | 178 return GURL(); |
179 case WebKit::WebReferrerPolicyAlways: | 179 case blink::WebReferrerPolicyAlways: |
180 return referrer; | 180 return referrer; |
181 case WebKit::WebReferrerPolicyOrigin: | 181 case blink::WebReferrerPolicyOrigin: |
182 return referrer.GetOrigin(); | 182 return referrer.GetOrigin(); |
183 default: | 183 default: |
184 break; | 184 break; |
185 } | 185 } |
186 | 186 |
187 return ShouldHideReferrer(url, referrer) ? GURL() : referrer; | 187 return ShouldHideReferrer(url, referrer) ? GURL() : referrer; |
188 } | 188 } |
189 | 189 |
190 | 190 |
191 } // namespace | 191 } // namespace |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 | 1308 |
1309 void ExternalTabContainerWin::Navigate(const GURL& url, const GURL& referrer) { | 1309 void ExternalTabContainerWin::Navigate(const GURL& url, const GURL& referrer) { |
1310 if (!web_contents_.get()) { | 1310 if (!web_contents_.get()) { |
1311 NOTREACHED(); | 1311 NOTREACHED(); |
1312 return; | 1312 return; |
1313 } | 1313 } |
1314 | 1314 |
1315 TRACE_EVENT_BEGIN_ETW("ExternalTabContainerWin::Navigate", 0, url.spec()); | 1315 TRACE_EVENT_BEGIN_ETW("ExternalTabContainerWin::Navigate", 0, url.spec()); |
1316 | 1316 |
1317 web_contents_->GetController().LoadURL( | 1317 web_contents_->GetController().LoadURL( |
1318 url, content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), | 1318 url, content::Referrer(referrer, blink::WebReferrerPolicyDefault), |
1319 content::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); | 1319 content::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); |
1320 } | 1320 } |
1321 | 1321 |
1322 bool ExternalTabContainerWin::OnGoToEntryOffset(int offset) { | 1322 bool ExternalTabContainerWin::OnGoToEntryOffset(int offset) { |
1323 if (load_requests_via_automation_) { | 1323 if (load_requests_via_automation_) { |
1324 if (automation_) { | 1324 if (automation_) { |
1325 automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset( | 1325 automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset( |
1326 tab_handle_, offset)); | 1326 tab_handle_, offset)); |
1327 } | 1327 } |
1328 return false; | 1328 return false; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 if (params.disposition == CURRENT_TAB) { | 1482 if (params.disposition == CURRENT_TAB) { |
1483 DCHECK(route_all_top_level_navigations_); | 1483 DCHECK(route_all_top_level_navigations_); |
1484 forward_params.disposition = NEW_FOREGROUND_TAB; | 1484 forward_params.disposition = NEW_FOREGROUND_TAB; |
1485 } | 1485 } |
1486 WebContents* new_contents = | 1486 WebContents* new_contents = |
1487 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); | 1487 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); |
1488 // support only one navigation for a dummy tab before it is killed. | 1488 // support only one navigation for a dummy tab before it is killed. |
1489 widget_->CloseNow(); | 1489 widget_->CloseNow(); |
1490 return new_contents; | 1490 return new_contents; |
1491 } | 1491 } |
OLD | NEW |