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

Side by Side Diff: chrome/browser/ui/webui/signin/get_auth_frame.cc

Issue 2275883003: [Signin Error Dialog] (2/3) Added handlers and UI constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@error-modal-web
Patch Set: Final nit from tommycli Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 "chrome/browser/ui/webui/signin/get_auth_frame.h"
6
7 #include <set>
8
9 #include "base/bind.h"
10 #include "components/guest_view/browser/guest_view_manager.h"
11 #include "content/public/browser/web_contents.h"
12 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
13
14 namespace {
15
16 bool AddWebContentsToSet(std::set<content::WebContents*>* frame_set,
17 const std::string& web_view_name,
18 content::WebContents* web_contents) {
19 auto* web_view = extensions::WebViewGuest::FromWebContents(web_contents);
20 if (web_view && web_view->name() == web_view_name)
21 frame_set->insert(web_contents);
22 return false;
23 }
24
25 } // namespace
26
27 namespace signin {
28
29 content::RenderFrameHost* GetAuthFrame(content::WebContents* web_contents,
30 const std::string& parent_frame_name) {
31 content::WebContents* auth_web_contents =
32 GetAuthFrameWebContents(web_contents, parent_frame_name);
33 return auth_web_contents ? auth_web_contents->GetMainFrame() : nullptr;
34 }
35
36 content::WebContents* GetAuthFrameWebContents(
37 content::WebContents* web_contents,
38 const std::string& parent_frame_name) {
39 std::set<content::WebContents*> frame_set;
40 auto* manager = guest_view::GuestViewManager::FromBrowserContext(
41 web_contents->GetBrowserContext());
42 if (manager) {
43 manager->ForEachGuest(
44 web_contents,
45 base::Bind(&AddWebContentsToSet, &frame_set, parent_frame_name));
46 }
47 DCHECK_GE(1U, frame_set.size());
48 if (!frame_set.empty())
49 return *frame_set.begin();
50
51 return nullptr;
52 }
53
54 } // namespace signin
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/get_auth_frame.h ('k') | chrome/browser/ui/webui/signin/inline_login_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698