| 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Set up the chrome://theme/ source. | 90 // Set up the chrome://theme/ source. |
| 91 Profile* profile = Profile::FromWebUI(web_ui); | 91 Profile* profile = Profile::FromWebUI(web_ui); |
| 92 ThemeSource* theme = new ThemeSource(profile); | 92 ThemeSource* theme = new ThemeSource(profile); |
| 93 ChromeURLDataManager::AddDataSource(profile, theme); | 93 ChromeURLDataManager::AddDataSource(profile, theme); |
| 94 | 94 |
| 95 // Set up the sync promo source. | 95 // Set up the sync promo source. |
| 96 SyncPromoUIHTMLSource* html_source = new SyncPromoUIHTMLSource(web_ui); | 96 SyncPromoUIHTMLSource* html_source = new SyncPromoUIHTMLSource(web_ui); |
| 97 html_source->set_json_path(kStringsJsFile); | 97 html_source->set_json_path(kStringsJsFile); |
| 98 html_source->add_resource_path(kSyncPromoJsFile, IDR_SYNC_PROMO_JS); | 98 html_source->add_resource_path(kSyncPromoJsFile, IDR_SYNC_PROMO_JS); |
| 99 html_source->set_default_resource(IDR_SYNC_PROMO_HTML); | 99 html_source->set_default_resource(IDR_SYNC_PROMO_HTML); |
| 100 html_source->set_use_json_js_format_v2(); |
| 100 ChromeURLDataManager::AddDataSource(profile, html_source); | 101 ChromeURLDataManager::AddDataSource(profile, html_source); |
| 101 | 102 |
| 102 sync_promo_trial::RecordUserShownPromo(web_ui); | 103 sync_promo_trial::RecordUserShownPromo(web_ui); |
| 103 } | 104 } |
| 104 | 105 |
| 105 // static | 106 // static |
| 106 bool SyncPromoUI::HasShownPromoAtStartup(Profile* profile) { | 107 bool SyncPromoUI::HasShownPromoAtStartup(Profile* profile) { |
| 107 return profile->GetPrefs()->HasPrefPath(prefs::kSyncPromoStartupCount); | 108 return profile->GetPrefs()->HasPrefPath(prefs::kSyncPromoStartupCount); |
| 108 } | 109 } |
| 109 | 110 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 if (chrome_common_net::GetValueForKeyInQuery( | 239 if (chrome_common_net::GetValueForKeyInQuery( |
| 239 url, kSyncPromoQueryKeySource, &value)) { | 240 url, kSyncPromoQueryKeySource, &value)) { |
| 240 int source = 0; | 241 int source = 0; |
| 241 if (base::StringToInt(value, &source) && source >= SOURCE_START_PAGE && | 242 if (base::StringToInt(value, &source) && source >= SOURCE_START_PAGE && |
| 242 source < SOURCE_UNKNOWN) { | 243 source < SOURCE_UNKNOWN) { |
| 243 return static_cast<Source>(source); | 244 return static_cast<Source>(source); |
| 244 } | 245 } |
| 245 } | 246 } |
| 246 return SOURCE_UNKNOWN; | 247 return SOURCE_UNKNOWN; |
| 247 } | 248 } |
| OLD | NEW |