OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_UI_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_UI_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "chrome/browser/chromeos/arc/arc_auth_fetcher.h" | |
10 #include "ui/web_dialogs/web_dialog_delegate.h" | |
11 | |
12 namespace content { | |
13 class BrowserContext; | |
14 } // namespace content | |
xiyuan
2016/01/27 23:56:05
nit: // namespace xxx could be omitted in header
khmel
2016/01/28 05:22:08
Done.
| |
15 | |
16 namespace views { | |
17 class Widget; | |
18 } // namespace views | |
19 | |
20 namespace arc { | |
21 | |
22 // Shows ARC LSO web view that requires user input. | |
23 class ArcAuthUI : public ui::WebDialogDelegate, | |
24 public ArcAuthFetcher::Delegate { | |
25 public: | |
26 class Delegate { | |
27 public: | |
28 // Called when dialog is closed. | |
29 virtual void OnAuthUIClosed() = 0; | |
30 }; | |
xiyuan
2016/01/27 23:56:05
nit: virtual ~Delegate() {}
khmel
2016/01/28 05:22:08
Done.
| |
31 | |
32 ArcAuthUI(content::BrowserContext* browser_context, Delegate* delegate); | |
33 ~ArcAuthUI() override; | |
34 | |
35 void Close(); | |
36 | |
37 // overrides ui::WebDialogDelegate. | |
38 ui::ModalType GetDialogModalType() const override; | |
39 base::string16 GetDialogTitle() const override; | |
40 GURL GetDialogContentURL() const override; | |
41 void GetWebUIMessageHandlers( | |
42 std::vector<content::WebUIMessageHandler*>* handlers) const override; | |
43 void GetDialogSize(gfx::Size* size) const override; | |
44 std::string GetDialogArgs() const override; | |
45 void OnDialogClosed(const std::string& json_retval) override; | |
46 void OnCloseContents(content::WebContents* source, | |
47 bool* out_close_dialog) override; | |
48 bool ShouldShowDialogTitle() const override; | |
49 bool HandleContextMenu(const content::ContextMenuParams& params) override; | |
50 void OnLoadingStateChanged(content::WebContents* source) override; | |
51 | |
52 // Overrides ArcAuthFetcher::Delegate. | |
53 void OnAuthCodeFetched(const std::string& code) override; | |
54 void OnAuthCodeNeedUI() override; | |
55 void OnAuthCodeFailed() override; | |
56 | |
57 private: | |
58 // Unowned pointers. | |
59 content::BrowserContext* browser_context_; | |
60 Delegate* delegate_; | |
xiyuan
2016/01/27 23:56:05
nit: Delegate* const
khmel
2016/01/28 05:22:08
Done.
| |
61 | |
62 // Owned by view hierarchy. | |
63 views::Widget* widget_; | |
64 | |
65 scoped_ptr<ArcAuthFetcher> auth_fetcher_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(ArcAuthUI); | |
68 }; | |
69 | |
70 } // namespace arc | |
71 | |
72 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_UI_H_ | |
OLD | NEW |