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

Side by Side Diff: chrome/browser/ui/webui/signin/signin_utils.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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/signin/get_auth_frame.h" 5 #include "chrome/browser/ui/webui/signin/signin_utils.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser_finder.h"
10 #include "components/guest_view/browser/guest_view_manager.h" 12 #include "components/guest_view/browser/guest_view_manager.h"
11 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_ui.h"
12 #include "extensions/browser/guest_view/web_view/web_view_guest.h" 15 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
13 16
14 namespace { 17 namespace {
15 18
16 bool AddWebContentsToSet(std::set<content::WebContents*>* frame_set, 19 bool AddWebContentsToSet(std::set<content::WebContents*>* frame_set,
17 const std::string& web_view_name, 20 const std::string& web_view_name,
18 content::WebContents* web_contents) { 21 content::WebContents* web_contents) {
19 auto* web_view = extensions::WebViewGuest::FromWebContents(web_contents); 22 auto* web_view = extensions::WebViewGuest::FromWebContents(web_contents);
20 if (web_view && web_view->name() == web_view_name) 23 if (web_view && web_view->name() == web_view_name)
21 frame_set->insert(web_contents); 24 frame_set->insert(web_contents);
(...skipping 22 matching lines...) Expand all
44 web_contents, 47 web_contents,
45 base::Bind(&AddWebContentsToSet, &frame_set, parent_frame_name)); 48 base::Bind(&AddWebContentsToSet, &frame_set, parent_frame_name));
46 } 49 }
47 DCHECK_GE(1U, frame_set.size()); 50 DCHECK_GE(1U, frame_set.size());
48 if (!frame_set.empty()) 51 if (!frame_set.empty())
49 return *frame_set.begin(); 52 return *frame_set.begin();
50 53
51 return nullptr; 54 return nullptr;
52 } 55 }
53 56
57 Browser* GetDesktopBrowser(content::WebUI* web_ui) {
58 Browser* browser =
59 chrome::FindBrowserWithWebContents(web_ui->GetWebContents());
60 if (!browser)
61 browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui));
62 return browser;
63 }
64
65 void SetInitializedModalHeight(content::WebUI* web_ui,
66 const base::ListValue* args) {
67 double height;
68 bool success = args->GetDouble(0, &height);
69 DCHECK(success);
70
71 Browser* browser = GetDesktopBrowser(web_ui);
72 DCHECK(browser);
73 browser->signin_view_controller()->SetModalSigninHeight(
74 static_cast<int>(height));
75 }
76
54 } // namespace signin 77 } // namespace signin
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_utils.h ('k') | chrome/browser/ui/webui/signin/sync_confirmation_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698