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

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

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/first_run/first_run.h" 10 #include "chrome/browser/first_run/first_run.h"
11 #include "chrome/browser/google/google_util.h" 11 #include "chrome/browser/google/google_util.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 14 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
16 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 16 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
17 #include "chrome/browser/ui/webui/options/core_options_handler.h" 17 #include "chrome/browser/ui/webui/options/core_options_handler.h"
18 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h" 18 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h"
19 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" 19 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h"
20 #include "chrome/browser/ui/webui/theme_source.h" 20 #include "chrome/browser/ui/webui/theme_source.h"
21 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
24 #include "content/browser/tab_contents/tab_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "googleurl/src/url_util.h" 25 #include "googleurl/src/url_util.h"
26 #include "grit/browser_resources.h" 26 #include "grit/browser_resources.h"
27 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
28 #include "grit/theme_resources.h" 28 #include "grit/theme_resources.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 30
31 using content::WebContents;
32
31 namespace { 33 namespace {
32 34
33 const char kStringsJsFile[] = "strings.js"; 35 const char kStringsJsFile[] = "strings.js";
34 const char kSyncPromoJsFile[] = "sync_promo.js"; 36 const char kSyncPromoJsFile[] = "sync_promo.js";
35 37
36 const char kSyncPromoQueryKeyIsLaunchPage[] = "is_launch_page"; 38 const char kSyncPromoQueryKeyIsLaunchPage[] = "is_launch_page";
37 const char kSyncPromoQueryKeyNextPage[] = "next_page"; 39 const char kSyncPromoQueryKeyNextPage[] = "next_page";
38 40
39 // The maximum number of times we want to show the sync promo at startup. 41 // The maximum number of times we want to show the sync promo at startup.
40 const int kSyncPromoShowAtStartupMaximum = 10; 42 const int kSyncPromoShowAtStartupMaximum = 10;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 *out_value = ""; 98 *out_value = "";
97 return true; 99 return true;
98 } 100 }
99 } 101 }
100 } 102 }
101 return false; 103 return false;
102 } 104 }
103 105
104 } // namespace 106 } // namespace
105 107
106 SyncPromoUI::SyncPromoUI(TabContents* contents) : ChromeWebUI(contents) { 108 SyncPromoUI::SyncPromoUI(WebContents* contents) : ChromeWebUI(contents) {
107 should_hide_url_ = true; 109 should_hide_url_ = true;
108 110
109 SyncPromoHandler* handler = new SyncPromoHandler( 111 SyncPromoHandler* handler = new SyncPromoHandler(
110 g_browser_process->profile_manager()); 112 g_browser_process->profile_manager());
111 AddMessageHandler(handler); 113 AddMessageHandler(handler);
112 114
113 // Set up the chrome://theme/ source. 115 // Set up the chrome://theme/ source.
114 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 116 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
115 ThemeSource* theme = new ThemeSource(profile); 117 ThemeSource* theme = new ThemeSource(profile);
116 profile->GetChromeURLDataManager()->AddDataSource(theme); 118 profile->GetChromeURLDataManager()->AddDataSource(theme);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 UTF16ToUTF8(output.data(), output.length(), &url); 268 UTF16ToUTF8(output.data(), output.length(), &url);
267 return GURL(url); 269 return GURL(url);
268 } 270 }
269 return GURL(); 271 return GURL();
270 } 272 }
271 273
272 // static 274 // static
273 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) { 275 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) {
274 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0; 276 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0;
275 } 277 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_promo/sync_promo_ui.h ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698