Chromium Code Reviews| Index: services/navigation/view_impl.cc |
| diff --git a/services/navigation/view_impl.cc b/services/navigation/view_impl.cc |
| index 83a86a7672f318b94a86ec6e24e9688400847dc7..4846b38f94e8e3d24733c9a05f33de1cbf331920 100644 |
| --- a/services/navigation/view_impl.cc |
| +++ b/services/navigation/view_impl.cc |
| @@ -6,6 +6,8 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "components/mus/public/cpp/window_tree_client.h" |
| +#include "content/public/browser/interstitial_page.h" |
| +#include "content/public/browser/interstitial_page_delegate.h" |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/web_contents.h" |
| #include "ui/views/controls/webview/webview.h" |
| @@ -14,6 +16,25 @@ |
| #include "url/gurl.h" |
| namespace navigation { |
| +namespace { |
| + |
| +class InterstitialPageDelegate : public content::InterstitialPageDelegate { |
| + public: |
| + explicit InterstitialPageDelegate(const std::string& html) : html_(html) {} |
| + ~InterstitialPageDelegate() override {} |
| + |
| + private: |
| + InterstitialPageDelegate(const InterstitialPageDelegate&) = delete; |
| + void operator=(const InterstitialPageDelegate&) = delete; |
| + |
| + std::string GetHTMLContents() override { |
|
sky
2016/06/03 22:24:51
// content::InterstitialPageDelegate: ?
|
| + return html_; |
| + } |
| + |
| + const std::string html_; |
| +}; |
| + |
| +} // namespace |
| ViewImpl::ViewImpl(shell::Connector* connector, |
| content::BrowserContext* browser_context, |
| @@ -58,6 +79,21 @@ void ViewImpl::GetWindowTreeClient( |
| new mus::WindowTreeClient(this, nullptr, std::move(request)); |
| } |
| +void ViewImpl::ShowInterstitial(const mojo::String& html) { |
| + content::InterstitialPage* interstitial = |
| + content::InterstitialPage::Create(web_view_->GetWebContents(), |
| + false, |
| + GURL(), |
| + new InterstitialPageDelegate(html)); |
| + interstitial->Show(); |
| +} |
| + |
| +void ViewImpl::HideInterstitial() { |
| + // TODO(beng): this is not quite right. |
| + if (web_view_->GetWebContents()->ShowingInterstitialPage()) |
| + web_view_->GetWebContents()->GetInterstitialPage()->Proceed(); |
| +} |
| + |
| void ViewImpl::AddNewContents(content::WebContents* source, |
| content::WebContents* new_contents, |
| WindowOpenDisposition disposition, |