OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/browser_plugin/test_browser_plugin_guest_delegate.h" |
| 6 |
| 7 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/common/referrer.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 TestBrowserPluginGuestDelegate::TestBrowserPluginGuestDelegate( |
| 15 BrowserPluginGuest* guest) : |
| 16 guest_(guest) { |
| 17 } |
| 18 |
| 19 TestBrowserPluginGuestDelegate::~TestBrowserPluginGuestDelegate() { |
| 20 } |
| 21 |
| 22 void TestBrowserPluginGuestDelegate::LoadURLWithParams( |
| 23 const GURL& url, |
| 24 const Referrer& referrer, |
| 25 PageTransition transition_type, |
| 26 WebContents* web_contents) { |
| 27 NavigationController::LoadURLParams load_url_params(url); |
| 28 load_url_params.referrer = referrer; |
| 29 load_url_params.transition_type = transition_type; |
| 30 load_url_params.extra_headers = std::string(); |
| 31 web_contents->GetController().LoadURLWithParams(load_url_params); |
| 32 } |
| 33 |
| 34 void TestBrowserPluginGuestDelegate::Destroy() { |
| 35 if (!destruction_callback_.is_null()) |
| 36 destruction_callback_.Run(guest_->GetWebContents()); |
| 37 delete guest_->GetWebContents(); |
| 38 } |
| 39 |
| 40 void TestBrowserPluginGuestDelegate::NavigateGuest(const std::string& src) { |
| 41 GURL url(src); |
| 42 LoadURLWithParams(url, |
| 43 Referrer(), |
| 44 PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 45 guest_->GetWebContents()); |
| 46 } |
| 47 |
| 48 void TestBrowserPluginGuestDelegate::RegisterDestructionCallback( |
| 49 const DestructionCallback& callback) { |
| 50 destruction_callback_ = callback; |
| 51 } |
| 52 |
| 53 |
| 54 } // namespace content |
OLD | NEW |