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 class Profile; |
| 13 |
| 14 namespace views { |
| 15 class Widget; |
| 16 } // namespace views |
| 17 |
| 18 namespace arc { |
| 19 |
| 20 // Shows ARC LSO web view that requires user input. |
| 21 class ArcAuthUI : public ui::WebDialogDelegate, |
| 22 public ArcAuthFetcher::Delegate { |
| 23 public: |
| 24 class Delegate { |
| 25 public: |
| 26 // Called when dialog is closed. |
| 27 virtual void OnAuthUIClosed() = 0; |
| 28 }; |
| 29 |
| 30 ArcAuthUI(Profile* profile, Delegate* delegate); |
| 31 ~ArcAuthUI() override; |
| 32 |
| 33 void Close(); |
| 34 |
| 35 // overrides ui::WebDialogDelegate. |
| 36 ui::ModalType GetDialogModalType() const override; |
| 37 base::string16 GetDialogTitle() const override; |
| 38 GURL GetDialogContentURL() const override; |
| 39 void GetWebUIMessageHandlers( |
| 40 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
| 41 void GetDialogSize(gfx::Size* size) const override; |
| 42 std::string GetDialogArgs() const override; |
| 43 void OnDialogClosed(const std::string& json_retval) override; |
| 44 void OnCloseContents(content::WebContents* source, |
| 45 bool* out_close_dialog) override; |
| 46 bool ShouldShowDialogTitle() const override; |
| 47 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 48 void OnLoadingStateChanged(content::WebContents* source) override; |
| 49 |
| 50 // Overrides ArcAuthFetcher::Delegate. |
| 51 void OnAuthCodeFetched(const std::string& code) override; |
| 52 void OnAuthCodeNeedUI() override; |
| 53 void OnAuthCodeFailed() override; |
| 54 |
| 55 private: |
| 56 // Unowned pointers. |
| 57 Profile* profile_; |
| 58 Delegate* delegate_; |
| 59 |
| 60 // Owned by view hierarchy. |
| 61 views::Widget* widget_; |
| 62 |
| 63 scoped_ptr<ArcAuthFetcher> auth_fetcher_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(ArcAuthUI); |
| 66 }; |
| 67 |
| 68 } // namespace arc |
| 69 |
| 70 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_UI_H_ |
OLD | NEW |