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

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 WebAuthFlowWindowViews::~WebAuthFlowWindowViews() {
27 if (widget_)
28 widget_->Close(); // This also deletes the widget.
29 }
30
31 void WebAuthFlowWindowViews::Show() {
32 web_view_ = new WebView(browser_context_);
33 web_view_->SetWebContents(contents_);
34 widget_ = Widget::CreateWindow(this);
35 widget_->CenterWindow(gfx::Size(kDefaultWidth, kDefaultHeight));
36 widget_->Show();
37 }
38
39 views::View* WebAuthFlowWindowViews::GetContentsView() {
40 CHECK(web_view_);
41 return web_view_;
42 }
43
44 views::View* WebAuthFlowWindowViews::GetInitiallyFocusedView() {
45 CHECK(web_view_);
46 return web_view_;
47 }
48
49 void WebAuthFlowWindowViews::DeleteDelegate() {
50 if (delegate_)
51 delegate_->OnClose();
52 }
53
54 // static
55 WebAuthFlowWindow* WebAuthFlowWindow::CreateWebAuthFlowWindow(
56 Delegate* delegate,
57 BrowserContext* browser_context,
58 WebContents* contents) {
59 return new WebAuthFlowWindowViews(delegate, browser_context, contents);
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698