Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: services/navigation/view_impl.cc

Issue 2039613002: Add a debug view to the browser that allows various navigation features to be used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/navigation/view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/navigation/view_impl.cc
diff --git a/services/navigation/view_impl.cc b/services/navigation/view_impl.cc
index 83a86a7672f318b94a86ec6e24e9688400847dc7..722faa3179133f63d963be10b239fe4fe57f80cf 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,26 @@
#include "url/gurl.h"
namespace navigation {
+namespace {
+
+class InterstitialPageDelegate : public content::InterstitialPageDelegate {
+ public:
+ explicit InterstitialPageDelegate(const std::string& html) : html_(html) {}
+ ~InterstitialPageDelegate() override {}
+ InterstitialPageDelegate(const InterstitialPageDelegate&) = delete;
+ void operator=(const InterstitialPageDelegate&) = delete;
+
+ private:
+
+ // content::InterstitialPageDelegate:
+ std::string GetHTMLContents() override {
+ return html_;
+ }
+
+ const std::string html_;
+};
+
+} // namespace
ViewImpl::ViewImpl(shell::Connector* connector,
content::BrowserContext* browser_context,
@@ -58,6 +80,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,
« no previous file with comments | « services/navigation/view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698