OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implementation of ChromeActiveDocument | 5 // Implementation of ChromeActiveDocument |
6 #include "chrome_frame/chrome_active_document.h" | 6 #include "chrome_frame/chrome_active_document.h" |
7 | 7 |
8 #include <hlink.h> | 8 #include <hlink.h> |
9 #include <htiface.h> | 9 #include <htiface.h> |
10 #include <initguid.h> | 10 #include <initguid.h> |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 url = GetActualUrlFromMoniker(moniker_name, bind_context, | 245 url = GetActualUrlFromMoniker(moniker_name, bind_context, |
246 mgr ? mgr->url(): std::wstring()); | 246 mgr ? mgr->url(): std::wstring()); |
247 } | 247 } |
248 | 248 |
249 ChromeFrameUrl cf_url; | 249 ChromeFrameUrl cf_url; |
250 if (!cf_url.Parse(url)) { | 250 if (!cf_url.Parse(url)) { |
251 DLOG(WARNING) << __FUNCTION__ << " Failed to parse url:" << url; | 251 DLOG(WARNING) << __FUNCTION__ << " Failed to parse url:" << url; |
252 return E_INVALIDARG; | 252 return E_INVALIDARG; |
253 } | 253 } |
254 | 254 |
255 std::string referrer(mgr ? mgr->referrer() : EmptyString()); | 255 std::string referrer(mgr ? mgr->referrer() : std::string()); |
256 RendererType renderer_type = cf_url.is_chrome_protocol() ? | 256 RendererType renderer_type = cf_url.is_chrome_protocol() ? |
257 RENDERER_TYPE_CHROME_GCF_PROTOCOL : RENDERER_TYPE_UNDETERMINED; | 257 RENDERER_TYPE_CHROME_GCF_PROTOCOL : RENDERER_TYPE_UNDETERMINED; |
258 | 258 |
259 // With CTransaction patch we have more robust way to grab the referrer for | 259 // With CTransaction patch we have more robust way to grab the referrer for |
260 // each top-level-switch-to-CF request by peeking at our sniffing data | 260 // each top-level-switch-to-CF request by peeking at our sniffing data |
261 // object that lives inside the bind context. We also remember the reason | 261 // object that lives inside the bind context. We also remember the reason |
262 // we're rendering the document in Chrome. | 262 // we're rendering the document in Chrome. |
263 if (g_patch_helper.state() == PatchHelper::PATCH_PROTOCOL && info) { | 263 if (g_patch_helper.state() == PatchHelper::PATCH_PROTOCOL && info) { |
264 scoped_refptr<ProtData> prot_data = info->get_prot_data(); | 264 scoped_refptr<ProtData> prot_data = info->get_prot_data(); |
265 if (prot_data) { | 265 if (prot_data) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 DWORD bytes_read = 0; | 392 DWORD bytes_read = 0; |
393 stream->Read(url_bstr.AllocateBytes(url_size), url_size, &bytes_read); | 393 stream->Read(url_bstr.AllocateBytes(url_size), url_size, &bytes_read); |
394 std::wstring url(url_bstr); | 394 std::wstring url(url_bstr); |
395 | 395 |
396 ChromeFrameUrl cf_url; | 396 ChromeFrameUrl cf_url; |
397 if (!cf_url.Parse(url)) { | 397 if (!cf_url.Parse(url)) { |
398 DLOG(WARNING) << __FUNCTION__ << " Failed to parse url:" << url; | 398 DLOG(WARNING) << __FUNCTION__ << " Failed to parse url:" << url; |
399 return E_INVALIDARG; | 399 return E_INVALIDARG; |
400 } | 400 } |
401 | 401 |
402 const std::string& referrer = EmptyString(); | 402 if (!LaunchUrl(cf_url, std::string())) { |
403 if (!LaunchUrl(cf_url, referrer)) { | |
404 NOTREACHED() << __FUNCTION__ << " Failed to launch url:" << url; | 403 NOTREACHED() << __FUNCTION__ << " Failed to launch url:" << url; |
405 return E_INVALIDARG; | 404 return E_INVALIDARG; |
406 } | 405 } |
407 return S_OK; | 406 return S_OK; |
408 } | 407 } |
409 | 408 |
410 STDMETHODIMP ChromeActiveDocument::SaveHistory(IStream* stream) { | 409 STDMETHODIMP ChromeActiveDocument::SaveHistory(IStream* stream) { |
411 // TODO(sanjeevr): We need to fetch the entire list of navigation entries | 410 // TODO(sanjeevr): We need to fetch the entire list of navigation entries |
412 // from Chrome and persist it in the stream. And in LoadHistory we need to | 411 // from Chrome and persist it in the stream. And in LoadHistory we need to |
413 // pass this list back to Chrome which will recreate the list. This will allow | 412 // pass this list back to Chrome which will recreate the list. This will allow |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 | 1430 |
1432 return false; | 1431 return false; |
1433 } | 1432 } |
1434 | 1433 |
1435 bool ChromeActiveDocument::IsFirstNavigation( | 1434 bool ChromeActiveDocument::IsFirstNavigation( |
1436 const NavigationInfo& new_navigation_info) const { | 1435 const NavigationInfo& new_navigation_info) const { |
1437 return (navigation_info_->url.is_empty() && | 1436 return (navigation_info_->url.is_empty() && |
1438 new_navigation_info.navigation_type == | 1437 new_navigation_info.navigation_type == |
1439 content::NAVIGATION_TYPE_NEW_PAGE); | 1438 content::NAVIGATION_TYPE_NEW_PAGE); |
1440 } | 1439 } |
OLD | NEW |