| Index: chrome/browser/extensions/api/identity/web_auth_flow.h
|
| ===================================================================
|
| --- chrome/browser/extensions/api/identity/web_auth_flow.h (revision 149223)
|
| +++ chrome/browser/extensions/api/identity/web_auth_flow.h (working copy)
|
| @@ -10,14 +10,18 @@
|
|
|
| #include "base/compiler_specific.h"
|
| #include "base/gtest_prod_util.h"
|
| -#include "chrome/browser/ui/extensions/web_auth_flow_window.h"
|
| -#include "content/public/browser/web_contents_delegate.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| #include "googleurl/src/gurl.h"
|
|
|
| +class Profile;
|
| +class TabContents;
|
| class WebAuthFlowTest;
|
|
|
| namespace content {
|
| -class BrowserContext;
|
| +class NotificationDetails;
|
| +class NotificationSource;
|
| +class RenderViewHost;
|
| class WebContents;
|
| }
|
|
|
| @@ -31,8 +35,7 @@
|
| // The provider can show any UI to the user if needed before redirecting
|
| // to an appropriate URL.
|
| // TODO(munjal): Add link to the design doc here.
|
| -class WebAuthFlow : public content::WebContentsDelegate,
|
| - public WebAuthFlowWindow::Delegate {
|
| +class WebAuthFlow : public content::NotificationObserver {
|
| public:
|
| enum Mode {
|
| INTERACTIVE, // Show UI to the user if necessary.
|
| @@ -57,7 +60,7 @@
|
| // Creates an instance with the given parameters.
|
| // Caller owns |delegate|.
|
| WebAuthFlow(Delegate* delegate,
|
| - content::BrowserContext* browser_context,
|
| + Profile* profile,
|
| const std::string& extension_id,
|
| const GURL& provider_url,
|
| Mode mode);
|
| @@ -69,36 +72,36 @@
|
|
|
| protected:
|
| virtual content::WebContents* CreateWebContents();
|
| - virtual WebAuthFlowWindow* CreateAuthWindow();
|
| + virtual void ShowAuthFlowPopup();
|
|
|
| private:
|
| friend class ::WebAuthFlowTest;
|
|
|
| - // WebContentsDelegate implementation.
|
| - virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE;
|
| - virtual void NavigationStateChanged(
|
| - const content::WebContents* source, unsigned changed_flags) OVERRIDE;
|
| + // NotificationObserver implementation.
|
| + virtual void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) OVERRIDE;
|
|
|
| - // WebAuthFlowWindow::Delegate implementation.
|
| - virtual void OnClose() OVERRIDE;
|
| + bool BeforeUrlLoaded(const GURL& url);
|
| + void AfterUrlLoaded();
|
|
|
| - void OnUrlLoaded();
|
| // Reports the results back to the delegate.
|
| - void ReportResult(const GURL& result);
|
| + void ReportResult(const GURL& url);
|
| + // Checks if |url| is a valid redirect URL for the extension.
|
| + bool IsValidRedirectUrl(const GURL& url) const;
|
| // Helper to initialize valid extensions URLs vector.
|
| void InitValidRedirectUrlPrefixes(const std::string& extension_id);
|
| - // Checks if |url| is a valid redirect URL for the extension.
|
| - bool IsValidRedirectUrl(const GURL& url) const;
|
|
|
| Delegate* delegate_;
|
| - content::BrowserContext* browser_context_;
|
| + Profile* profile_;
|
| GURL provider_url_;
|
| Mode mode_;
|
| // List of valid redirect URL prefixes.
|
| std::vector<std::string> valid_prefixes_;
|
|
|
| content::WebContents* contents_;
|
| - WebAuthFlowWindow* window_;
|
| + TabContents* tab_contents_;
|
| + content::NotificationRegistrar registrar_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebAuthFlow);
|
| };
|
|
|