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

Unified Diff: chrome/browser/ui/views/chrome_constrained_window_views_client.cc

Issue 658383003: Componentize Constrained Window Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase Created 6 years, 2 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
Index: chrome/browser/ui/views/chrome_constrained_window_views_client.cc
diff --git a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..aea31f9736f6b596937eaef9b07a625dbcb1dfea
--- /dev/null
+++ b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
+
+#include "chrome/browser/ui/browser_finder.h"
+#include "components/web_modal/web_contents_modal_dialog_host.h"
+#include "extensions/browser/guest_view/guest_view_base.h"
+
+namespace {
+
+class ChromeConstrainedWindowViewsClient
+ : public ConstrainedWindowViewsClient {
+ public:
+ ChromeConstrainedWindowViewsClient() {}
+ ~ChromeConstrainedWindowViewsClient() override {}
+
+ private:
+ // ConstrainedWindowViewsClient:
+ content::WebContents* GetEmbedderWebContents(
+ content::WebContents* initiator_web_contents) override {
+ extensions::GuestViewBase* guest_view =
+ extensions::GuestViewBase::FromWebContents(initiator_web_contents);
+ return guest_view && guest_view->embedder_web_contents() ?
+ guest_view->embedder_web_contents() : initiator_web_contents;
+ }
+ web_modal::ModalDialogHost* GetModalDialogHost(
+ gfx::NativeWindow parent) override {
+ // Get the browser dialog management and hosting components from |parent|.
+ Browser* browser = chrome::FindBrowserWithWindow(parent);
+ if (browser) {
+ ChromeWebModalDialogManagerDelegate* manager = browser;
+ return manager->GetWebContentsModalDialogHost();
+ }
+ return nullptr;
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeConstrainedWindowViewsClient);
+};
+
+} // namespace
+
+scoped_ptr<ConstrainedWindowViewsClient>
+CreateChromeConstrainedWindowViewsClient() {
+ return make_scoped_ptr(new ChromeConstrainedWindowViewsClient);
+}

Powered by Google App Engine
This is Rietveld 408576698