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

Side by Side Diff: chrome/browser/ui/webui/welcome_ui.cc

Issue 2487553002: Moving new First Run to use per-profile value, rather than simply checking IsChromeFirstRun. (Closed)
Patch Set: Addressing pkasting feedback Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/startup/startup_tab_provider_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/welcome_ui.h" 5 #include "chrome/browser/ui/webui/welcome_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/welcome_handler.h" 8 #include "chrome/browser/ui/webui/welcome_handler.h"
9 #include "chrome/common/pref_names.h"
9 #include "chrome/grit/browser_resources.h" 10 #include "chrome/grit/browser_resources.h"
10 #include "chrome/grit/chrome_unscaled_resources.h" 11 #include "chrome/grit/chrome_unscaled_resources.h"
11 #include "chrome/grit/chromium_strings.h" 12 #include "chrome/grit/chromium_strings.h"
12 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "components/prefs/pref_service.h"
13 #include "content/public/browser/web_ui_data_source.h" 15 #include "content/public/browser/web_ui_data_source.h"
14 #include "net/base/url_util.h" 16 #include "net/base/url_util.h"
15 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/resources/grit/webui_resources.h" 18 #include "ui/resources/grit/webui_resources.h"
17 19
18 WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url) 20 WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
19 : content::WebUIController(web_ui) { 21 : content::WebUIController(web_ui) {
20 Profile* profile = Profile::FromWebUI(web_ui); 22 Profile* profile = Profile::FromWebUI(web_ui);
21 23
22 // This page is not shown to incognito or guest profiles. If one should end up 24 // This page is not shown to incognito or guest profiles. If one should end up
23 // here, we return, causing a 404-like page. 25 // here, we return, causing a 404-like page.
24 if (!profile || 26 if (!profile ||
25 profile->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE) { 27 profile->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE) {
26 return; 28 return;
27 } 29 }
28 30
31 // Store that this profile has been shown the Welcome page.
32 profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, true);
33
29 web_ui->AddMessageHandler(new WelcomeHandler(web_ui)); 34 web_ui->AddMessageHandler(new WelcomeHandler(web_ui));
30 35
31 content::WebUIDataSource* html_source = 36 content::WebUIDataSource* html_source =
32 content::WebUIDataSource::Create(url.host()); 37 content::WebUIDataSource::Create(url.host());
33 38
34 // Check URL for variations. 39 // Check URL for variations.
35 std::string value; 40 std::string value;
36 bool is_everywhere_variant = 41 bool is_everywhere_variant =
37 (net::GetValueForKeyInQuery(url, "variant", &value) && 42 (net::GetValueForKeyInQuery(url, "variant", &value) &&
38 value == "everywhere"); 43 value == "everywhere");
(...skipping 19 matching lines...) Expand all
58 html_source->AddResourcePath("welcome.css", IDR_WELCOME_CSS); 63 html_source->AddResourcePath("welcome.css", IDR_WELCOME_CSS);
59 html_source->AddResourcePath("logo.png", IDR_PRODUCT_LOGO_128); 64 html_source->AddResourcePath("logo.png", IDR_PRODUCT_LOGO_128);
60 html_source->AddResourcePath("logo2x.png", IDR_PRODUCT_LOGO_256); 65 html_source->AddResourcePath("logo2x.png", IDR_PRODUCT_LOGO_256);
61 html_source->AddResourcePath("watermark.svg", IDR_WEBUI_IMAGES_GOOGLE_LOGO); 66 html_source->AddResourcePath("watermark.svg", IDR_WEBUI_IMAGES_GOOGLE_LOGO);
62 html_source->SetDefaultResource(IDR_WELCOME_HTML); 67 html_source->SetDefaultResource(IDR_WELCOME_HTML);
63 68
64 content::WebUIDataSource::Add(profile, html_source); 69 content::WebUIDataSource::Add(profile, html_source);
65 } 70 }
66 71
67 WelcomeUI::~WelcomeUI() {} 72 WelcomeUI::~WelcomeUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_tab_provider_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698