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 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 if (brand.empty()) | 64 if (brand.empty()) |
65 return true; | 65 return true; |
66 | 66 |
67 if (google_util::IsInternetCafeBrandCode(brand)) | 67 if (google_util::IsInternetCafeBrandCode(brand)) |
68 return false; | 68 return false; |
69 | 69 |
70 // Enable for both organic and distribution. | 70 // Enable for both organic and distribution. |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 bool UseWebBasedSigninFlow() { | |
75 const bool use_web_based_singin_flow = | |
76 CommandLine::ForCurrentProcess()->HasSwitch( | |
77 switches::kUseWebBasedSigninFlow); | |
78 return use_web_based_singin_flow; | |
79 } | |
80 | |
81 // The Web UI data source for the sync promo page. | 74 // The Web UI data source for the sync promo page. |
82 class SyncPromoUIHTMLSource : public ChromeWebUIDataSource { | 75 class SyncPromoUIHTMLSource : public ChromeWebUIDataSource { |
83 public: | 76 public: |
84 explicit SyncPromoUIHTMLSource(content::WebUI* web_ui); | 77 explicit SyncPromoUIHTMLSource(content::WebUI* web_ui); |
85 | 78 |
86 private: | 79 private: |
87 ~SyncPromoUIHTMLSource() {} | 80 ~SyncPromoUIHTMLSource() {} |
88 DISALLOW_COPY_AND_ASSIGN(SyncPromoUIHTMLSource); | 81 DISALLOW_COPY_AND_ASSIGN(SyncPromoUIHTMLSource); |
89 }; | 82 }; |
90 | 83 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 bool SyncPromoUI::GetAutoCloseForSyncPromoURL(const GURL& url) { | 289 bool SyncPromoUI::GetAutoCloseForSyncPromoURL(const GURL& url) { |
297 std::string value; | 290 std::string value; |
298 if (chrome_common_net::GetValueForKeyInQuery( | 291 if (chrome_common_net::GetValueForKeyInQuery( |
299 url, kSyncPromoQueryKeyAutoClose, &value)) { | 292 url, kSyncPromoQueryKeyAutoClose, &value)) { |
300 int source = 0; | 293 int source = 0; |
301 base::StringToInt(value, &source); | 294 base::StringToInt(value, &source); |
302 return (source == 1); | 295 return (source == 1); |
303 } | 296 } |
304 return false; | 297 return false; |
305 } | 298 } |
| 299 |
| 300 // static |
| 301 bool SyncPromoUI::UseWebBasedSigninFlow() { |
| 302 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 303 return !CommandLine::ForCurrentProcess()->HasSwitch( |
| 304 switches::kUseClientLoginSigninFlow); |
| 305 #else |
| 306 return false; |
| 307 #endif |
| 308 } |
OLD | NEW |