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

Unified Diff: chrome/browser/ui/webui/signin/get_auth_frame.cc

Issue 1536553002: Remove InlineLoginHandlerChromeOS and exclude InlineLoginUI from CrOS build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge conflicts resolved. Created 4 years, 11 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/webui/signin/get_auth_frame.cc
diff --git a/chrome/browser/ui/webui/signin/get_auth_frame.cc b/chrome/browser/ui/webui/signin/get_auth_frame.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f5705a299978da8b6e019b339a5c9d7edd28903a
--- /dev/null
+++ b/chrome/browser/ui/webui/signin/get_auth_frame.cc
@@ -0,0 +1,54 @@
+// Copyright 2016 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/webui/signin/get_auth_frame.h"
+
+#include <set>
+
+#include "base/bind.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "content/public/browser/web_contents.h"
+#include "extensions/browser/guest_view/web_view/web_view_guest.h"
+
+namespace {
+
+bool AddWebContentsToSet(std::set<content::WebContents*>* frame_set,
+ const std::string& web_view_name,
+ content::WebContents* web_contents) {
+ auto* web_view = extensions::WebViewGuest::FromWebContents(web_contents);
+ if (web_view && web_view->name() == web_view_name)
+ frame_set->insert(web_contents);
+ return false;
+}
+
+} // namespace
+
+namespace signin {
+
+content::RenderFrameHost* GetAuthFrame(content::WebContents* web_contents,
+ const std::string& parent_frame_name) {
+ content::WebContents* auth_web_contents =
+ GetAuthFrameWebContents(web_contents, parent_frame_name);
+ return auth_web_contents ? auth_web_contents->GetMainFrame() : nullptr;
+}
+
+content::WebContents* GetAuthFrameWebContents(
+ content::WebContents* web_contents,
+ const std::string& parent_frame_name) {
+ std::set<content::WebContents*> frame_set;
+ auto* manager = guest_view::GuestViewManager::FromBrowserContext(
+ web_contents->GetBrowserContext());
+ if (manager) {
+ manager->ForEachGuest(
+ web_contents,
+ base::Bind(&AddWebContentsToSet, &frame_set, parent_frame_name));
+ }
+ DCHECK_GE(1U, frame_set.size());
+ if (!frame_set.empty())
+ return *frame_set.begin();
+
+ return nullptr;
+}
+
+} // namespace signin
« no previous file with comments | « chrome/browser/ui/webui/signin/get_auth_frame.h ('k') | chrome/browser/ui/webui/signin/inline_login_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698