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

Side by Side Diff: chrome/browser/ui/views/extensions/web_auth_flow_window_views.cc

Issue 10178020: Start implementing an auth flow for platform apps to be able to do auth (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/views/extensions/web_auth_flow_window_views.h"
6
7 #include "ui/views/controls/webview/webview.h"
8 #include "ui/views/widget/widget.h"
9
10 using content::BrowserContext;
11 using content::WebContents;
12 using views::View;
13 using views::WebView;
14 using views::Widget;
15 using views::WidgetDelegate;
16
17 WebAuthFlowWindowViews::WebAuthFlowWindowViews(
18 Delegate* delegate,
19 BrowserContext* browser_context,
20 WebContents* contents)
21 : WebAuthFlowWindow(delegate, browser_context, contents),
22 web_view_(NULL),
23 widget_(NULL) {
24 }
25
26 views::View* WebAuthFlowWindowViews::GetContentsView() {
27 DCHECK(web_view_);
28 return web_view_;
29 }
30
31 views::View* WebAuthFlowWindowViews::GetInitiallyFocusedView() {
32 DCHECK(web_view_);
33 return web_view_;
34 }
35
36 void WebAuthFlowWindowViews::DeleteDelegate() {
37 if (delegate())
38 delegate()->OnClose();
39 }
40
41 void WebAuthFlowWindowViews::Show() {
42 web_view_ = new WebView(browser_context());
43 web_view_->SetWebContents(contents());
44 widget_ = Widget::CreateWindow(this);
45 widget_->CenterWindow(gfx::Size(kDefaultWidth, kDefaultHeight));
46 widget_->Show();
47 }
48
49 WebAuthFlowWindowViews::~WebAuthFlowWindowViews() {
50 if (widget_)
51 widget_->Close(); // This also deletes the widget.
52 }
53
54 // static
55 WebAuthFlowWindow* WebAuthFlowWindow::Create(
56 Delegate* delegate,
57 BrowserContext* browser_context,
58 WebContents* contents) {
59 return new WebAuthFlowWindowViews(delegate, browser_context, contents);
60 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/web_auth_flow_window_views.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698