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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/extensions/web_auth_flow_window_views.cc
===================================================================
--- chrome/browser/ui/views/extensions/web_auth_flow_window_views.cc (revision 0)
+++ chrome/browser/ui/views/extensions/web_auth_flow_window_views.cc (revision 0)
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 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/views/extensions/web_auth_flow_window_views.h"
+
+#include "ui/views/controls/webview/webview.h"
+#include "ui/views/widget/widget.h"
+
+using content::BrowserContext;
+using content::WebContents;
+using views::View;
+using views::WebView;
+using views::Widget;
+using views::WidgetDelegate;
+
+WebAuthFlowWindowViews::WebAuthFlowWindowViews(
+ Delegate* delegate,
+ BrowserContext* browser_context,
+ WebContents* contents)
+ : WebAuthFlowWindow(delegate, browser_context, contents),
+ web_view_(NULL),
+ widget_(NULL) {
+}
+
+views::View* WebAuthFlowWindowViews::GetContentsView() {
+ DCHECK(web_view_);
+ return web_view_;
+}
+
+views::View* WebAuthFlowWindowViews::GetInitiallyFocusedView() {
+ DCHECK(web_view_);
+ return web_view_;
+}
+
+void WebAuthFlowWindowViews::DeleteDelegate() {
+ if (delegate())
+ delegate()->OnClose();
+}
+
+void WebAuthFlowWindowViews::Show() {
+ web_view_ = new WebView(browser_context());
+ web_view_->SetWebContents(contents());
+ widget_ = Widget::CreateWindow(this);
+ widget_->CenterWindow(gfx::Size(kDefaultWidth, kDefaultHeight));
+ widget_->Show();
+}
+
+WebAuthFlowWindowViews::~WebAuthFlowWindowViews() {
+ if (widget_)
+ widget_->Close(); // This also deletes the widget.
+}
+
+// static
+WebAuthFlowWindow* WebAuthFlowWindow::Create(
+ Delegate* delegate,
+ BrowserContext* browser_context,
+ WebContents* contents) {
+ return new WebAuthFlowWindowViews(delegate, browser_context, contents);
+}
« 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