| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "ui/gfx/rect.h" |
| 16 | 17 |
| 17 class Profile; | 18 class Profile; |
| 18 class TabContents; | 19 class TabContents; |
| 19 class WebAuthFlowTest; | 20 class WebAuthFlowTest; |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 class NotificationDetails; | 23 class NotificationDetails; |
| 23 class NotificationSource; | 24 class NotificationSource; |
| 24 class RenderViewHost; | 25 class RenderViewHost; |
| 25 class WebContents; | 26 class WebContents; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 56 protected: | 57 protected: |
| 57 virtual ~Delegate() {} | 58 virtual ~Delegate() {} |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 // Creates an instance with the given parameters. | 61 // Creates an instance with the given parameters. |
| 61 // Caller owns |delegate|. | 62 // Caller owns |delegate|. |
| 62 WebAuthFlow(Delegate* delegate, | 63 WebAuthFlow(Delegate* delegate, |
| 63 Profile* profile, | 64 Profile* profile, |
| 64 const std::string& extension_id, | 65 const std::string& extension_id, |
| 65 const GURL& provider_url, | 66 const GURL& provider_url, |
| 66 Mode mode); | 67 Mode mode, |
| 68 const gfx::Rect& initial_bounds); |
| 67 virtual ~WebAuthFlow(); | 69 virtual ~WebAuthFlow(); |
| 68 | 70 |
| 69 // Starts the flow. | 71 // Starts the flow. |
| 70 // Delegate will be called when the flow is done. | 72 // Delegate will be called when the flow is done. |
| 71 virtual void Start(); | 73 virtual void Start(); |
| 72 | 74 |
| 73 protected: | 75 protected: |
| 74 virtual content::WebContents* CreateWebContents(); | 76 virtual content::WebContents* CreateWebContents(); |
| 75 virtual void ShowAuthFlowPopup(); | 77 virtual void ShowAuthFlowPopup(); |
| 76 | 78 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 89 void ReportResult(const GURL& url); | 91 void ReportResult(const GURL& url); |
| 90 // Checks if |url| is a valid redirect URL for the extension. | 92 // Checks if |url| is a valid redirect URL for the extension. |
| 91 bool IsValidRedirectUrl(const GURL& url) const; | 93 bool IsValidRedirectUrl(const GURL& url) const; |
| 92 // Helper to initialize valid extensions URLs vector. | 94 // Helper to initialize valid extensions URLs vector. |
| 93 void InitValidRedirectUrlPrefixes(const std::string& extension_id); | 95 void InitValidRedirectUrlPrefixes(const std::string& extension_id); |
| 94 | 96 |
| 95 Delegate* delegate_; | 97 Delegate* delegate_; |
| 96 Profile* profile_; | 98 Profile* profile_; |
| 97 GURL provider_url_; | 99 GURL provider_url_; |
| 98 Mode mode_; | 100 Mode mode_; |
| 101 gfx::Rect initial_bounds_; |
| 99 // List of valid redirect URL prefixes. | 102 // List of valid redirect URL prefixes. |
| 100 std::vector<std::string> valid_prefixes_; | 103 std::vector<std::string> valid_prefixes_; |
| 101 | 104 |
| 102 content::WebContents* contents_; | 105 content::WebContents* contents_; |
| 103 TabContents* tab_contents_; | 106 TabContents* tab_contents_; |
| 104 content::NotificationRegistrar registrar_; | 107 content::NotificationRegistrar registrar_; |
| 105 | 108 |
| 106 DISALLOW_COPY_AND_ASSIGN(WebAuthFlow); | 109 DISALLOW_COPY_AND_ASSIGN(WebAuthFlow); |
| 107 }; | 110 }; |
| 108 | 111 |
| 109 } // namespace extensions | 112 } // namespace extensions |
| 110 | 113 |
| 111 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ | 114 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ |
| OLD | NEW |