Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc

Issue 10196004: Changed ChromeURLDataManager to a ProfileKeyedService and made a Factory for it. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made ChromeURLDataManager's destructor virtual Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } // namespace 105 } // namespace
106 106
107 SyncPromoUI::SyncPromoUI(content::WebUI* web_ui) : WebUIController(web_ui) { 107 SyncPromoUI::SyncPromoUI(content::WebUI* web_ui) : WebUIController(web_ui) {
108 SyncPromoHandler* handler = new SyncPromoHandler( 108 SyncPromoHandler* handler = new SyncPromoHandler(
109 g_browser_process->profile_manager()); 109 g_browser_process->profile_manager());
110 web_ui->AddMessageHandler(handler); 110 web_ui->AddMessageHandler(handler);
111 111
112 // Set up the chrome://theme/ source. 112 // Set up the chrome://theme/ source.
113 Profile* profile = Profile::FromWebUI(web_ui); 113 Profile* profile = Profile::FromWebUI(web_ui);
114 ThemeSource* theme = new ThemeSource(profile); 114 ThemeSource* theme = new ThemeSource(profile);
115 profile->GetChromeURLDataManager()->AddDataSource(theme); 115 ChromeURLDataManager::AddDataSource(profile, theme);
116 116
117 // Set up the sync promo source. 117 // Set up the sync promo source.
118 SyncPromoUIHTMLSource* html_source = new SyncPromoUIHTMLSource(web_ui); 118 SyncPromoUIHTMLSource* html_source = new SyncPromoUIHTMLSource(web_ui);
119 html_source->set_json_path(kStringsJsFile); 119 html_source->set_json_path(kStringsJsFile);
120 html_source->add_resource_path(kSyncPromoJsFile, IDR_SYNC_PROMO_JS); 120 html_source->add_resource_path(kSyncPromoJsFile, IDR_SYNC_PROMO_JS);
121 html_source->set_default_resource(IDR_SYNC_PROMO_HTML); 121 html_source->set_default_resource(IDR_SYNC_PROMO_HTML);
122 profile->GetChromeURLDataManager()->AddDataSource(html_source); 122 ChromeURLDataManager::AddDataSource(profile, html_source);
123 123
124 sync_promo_trial::RecordUserShownPromo(web_ui); 124 sync_promo_trial::RecordUserShownPromo(web_ui);
125 } 125 }
126 126
127 // static 127 // static
128 bool SyncPromoUI::HasShownPromoAtStartup(Profile* profile) { 128 bool SyncPromoUI::HasShownPromoAtStartup(Profile* profile) {
129 return profile->GetPrefs()->HasPrefPath(prefs::kSyncPromoStartupCount); 129 return profile->GetPrefs()->HasPrefPath(prefs::kSyncPromoStartupCount);
130 } 130 }
131 131
132 // static 132 // static
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 std::string value; 262 std::string value;
263 if (GetValueForKeyInQuery(url, kSyncPromoQueryKeySource, &value)) { 263 if (GetValueForKeyInQuery(url, kSyncPromoQueryKeySource, &value)) {
264 int source = 0; 264 int source = 0;
265 if (base::StringToInt(value, &source) && source >= SOURCE_START_PAGE && 265 if (base::StringToInt(value, &source) && source >= SOURCE_START_PAGE &&
266 source < SOURCE_UNKNOWN) { 266 source < SOURCE_UNKNOWN) {
267 return static_cast<Source>(source); 267 return static_cast<Source>(source);
268 } 268 }
269 } 269 }
270 return SOURCE_UNKNOWN; 270 return SOURCE_UNKNOWN;
271 } 271 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_internals_ui.cc ('k') | chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698