OLD | NEW |
---|---|
(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() { | |
sky
2012/05/16 23:17:11
Make order match header.
Munjal (Google)
2012/05/16 23:33:44
Done.
Munjal (Google)
2012/05/16 23:33:44
Done.
| |
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_); | |
sky
2012/05/16 23:17:11
Use DCHECK for these.
Munjal (Google)
2012/05/16 23:33:44
Done.
| |
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::Create( | |
56 Delegate* delegate, | |
57 BrowserContext* browser_context, | |
58 WebContents* contents) { | |
59 return new WebAuthFlowWindowViews(delegate, browser_context, contents); | |
60 } | |
OLD | NEW |