| 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_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_ui_controller.h" | 8 #include "content/public/browser/web_ui_controller.h" |
| 9 | 9 |
| 10 class Profile; | 10 class Profile; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 SOURCE_SETTINGS, | 21 SOURCE_SETTINGS, |
| 22 SOURCE_EXTENSION_INSTALL_BUBBLE, | 22 SOURCE_EXTENSION_INSTALL_BUBBLE, |
| 23 SOURCE_WEBSTORE_INSTALL, | 23 SOURCE_WEBSTORE_INSTALL, |
| 24 SOURCE_APP_LAUNCHER, | 24 SOURCE_APP_LAUNCHER, |
| 25 SOURCE_UNKNOWN, // This must be last. | 25 SOURCE_UNKNOWN, // This must be last. |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // Constructs a SyncPromoUI. | 28 // Constructs a SyncPromoUI. |
| 29 explicit SyncPromoUI(content::WebUI* web_ui); | 29 explicit SyncPromoUI(content::WebUI* web_ui); |
| 30 | 30 |
| 31 // This is used to distinguish URLs belonging to the special web signin flow |
| 32 // running in the special signin process from other URLs on the same domain. |
| 33 // We do not grant WebUI privilieges / bindings to this process or to URLs of |
| 34 // this scheme; enforcement of privileges is handled separately by |
| 35 // OneClickSigninHelper. |
| 36 static const char* kChromeSigninEffectiveURL; |
| 37 |
| 31 // Returns true if the sync promo should be visible. | 38 // Returns true if the sync promo should be visible. |
| 32 // |profile| is the profile of the tab the promo would be shown on. | 39 // |profile| is the profile of the tab the promo would be shown on. |
| 33 static bool ShouldShowSyncPromo(Profile* profile); | 40 static bool ShouldShowSyncPromo(Profile* profile); |
| 34 | 41 |
| 35 // Returns true if we should show the sync promo at startup. | 42 // Returns true if we should show the sync promo at startup. |
| 36 static bool ShouldShowSyncPromoAtStartup(Profile* profile, | 43 static bool ShouldShowSyncPromoAtStartup(Profile* profile, |
| 37 bool is_new_profile); | 44 bool is_new_profile); |
| 38 | 45 |
| 39 // Called when the sync promo has been shown so that we can keep track | 46 // Called when the sync promo has been shown so that we can keep track |
| 40 // of the number of times we've displayed it. | 47 // of the number of times we've displayed it. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static bool GetAutoCloseForSyncPromoURL(const GURL& url); | 79 static bool GetAutoCloseForSyncPromoURL(const GURL& url); |
| 73 | 80 |
| 74 // Returns true if chrome should use the web-based sign in flow, false if | 81 // Returns true if chrome should use the web-based sign in flow, false if |
| 75 // chrome should use the ClientLogin flow. This function will return true | 82 // chrome should use the ClientLogin flow. This function will return true |
| 76 // only for platforms where |ENABLE_ONE_CLICK_SIGNIN| is defined. | 83 // only for platforms where |ENABLE_ONE_CLICK_SIGNIN| is defined. |
| 77 static bool UseWebBasedSigninFlow(); | 84 static bool UseWebBasedSigninFlow(); |
| 78 | 85 |
| 79 // Forces UseWebBasedSigninFlow() to return true when set; used in tests only. | 86 // Forces UseWebBasedSigninFlow() to return true when set; used in tests only. |
| 80 static void ForceWebBasedSigninFlowForTesting(bool force); | 87 static void ForceWebBasedSigninFlowForTesting(bool force); |
| 81 | 88 |
| 89 // Returns true if |url| is a web signin URL and should be hosted in an |
| 90 // isolated, privileged signin process. |
| 91 static bool IsWebBasedSigninFlowURL(const GURL& url); |
| 92 |
| 82 private: | 93 private: |
| 83 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); | 94 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); |
| 84 }; | 95 }; |
| 85 | 96 |
| 86 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ | 97 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
| OLD | NEW |