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/welcome_win10_ui.cc

Issue 2513953004: Adding metrics on the usefulness of the Win10 version of the Welcome Page (Closed)
Patch Set: 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
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_win10_ui.h" 5 #include "chrome/browser/ui/webui/welcome_win10_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/feature_list.h" 9 #include "base/feature_list.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 IDS_WIN10_WELCOME_PIN_LABEL); 82 IDS_WIN10_WELCOME_PIN_LABEL);
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 86
87 WelcomeWin10UI::WelcomeWin10UI(content::WebUI* web_ui, const GURL& url) 87 WelcomeWin10UI::WelcomeWin10UI(content::WebUI* web_ui, const GURL& url)
88 : content::WebUIController(web_ui) { 88 : content::WebUIController(web_ui) {
89 static const char kCssFilePath[] = "welcome.css"; 89 static const char kCssFilePath[] = "welcome.css";
90 static const char kJsFilePath[] = "welcome.js"; 90 static const char kJsFilePath[] = "welcome.js";
91 91
92 web_ui->AddMessageHandler(new WelcomeWin10Handler());
93
94 content::WebUIDataSource* html_source =
95 content::WebUIDataSource::Create(url.host());
96
97 // Determine which variation to show. 92 // Determine which variation to show.
98 bool is_first_run = !UrlContainsKeyValueInQuery(url, "text", "faster"); 93 bool is_first_run = !UrlContainsKeyValueInQuery(url, "text", "faster");
99 bool is_inline_style = ShouldShowInlineStyleVariant(url); 94 bool is_inline_style = ShouldShowInlineStyleVariant(url);
100 95
96 web_ui->AddMessageHandler(new WelcomeWin10Handler(is_inline_style));
97
98 content::WebUIDataSource* html_source =
99 content::WebUIDataSource::Create(url.host());
100
101 AddLocalizedStrings(html_source, is_first_run); 101 AddLocalizedStrings(html_source, is_first_run);
102 102
103 if (is_inline_style) { 103 if (is_inline_style) {
104 html_source->AddResourcePath(kCssFilePath, IDR_WELCOME_WIN10_INLINE_CSS); 104 html_source->AddResourcePath(kCssFilePath, IDR_WELCOME_WIN10_INLINE_CSS);
105 html_source->AddResourcePath(kJsFilePath, IDR_WELCOME_WIN10_INLINE_JS); 105 html_source->AddResourcePath(kJsFilePath, IDR_WELCOME_WIN10_INLINE_JS);
106 html_source->SetDefaultResource(IDR_WELCOME_WIN10_INLINE_HTML); 106 html_source->SetDefaultResource(IDR_WELCOME_WIN10_INLINE_HTML);
107 } else { 107 } else {
108 html_source->AddResourcePath(kCssFilePath, IDR_WELCOME_WIN10_SECTIONED_CSS); 108 html_source->AddResourcePath(kCssFilePath, IDR_WELCOME_WIN10_SECTIONED_CSS);
109 html_source->AddResourcePath(kJsFilePath, IDR_WELCOME_WIN10_SECTIONED_JS); 109 html_source->AddResourcePath(kJsFilePath, IDR_WELCOME_WIN10_SECTIONED_JS);
110 html_source->SetDefaultResource(IDR_WELCOME_WIN10_SECTIONED_HTML); 110 html_source->SetDefaultResource(IDR_WELCOME_WIN10_SECTIONED_HTML);
111 } 111 }
112 112
113 // Logo images of all scales. 113 // Logo images of all scales.
114 html_source->AddResourcePath("logo-small.png", IDR_PRODUCT_LOGO_32); 114 html_source->AddResourcePath("logo-small.png", IDR_PRODUCT_LOGO_32);
115 html_source->AddResourcePath("logo-small2x.png", IDR_PRODUCT_LOGO_64); 115 html_source->AddResourcePath("logo-small2x.png", IDR_PRODUCT_LOGO_64);
116 html_source->AddResourcePath("logo-large.png", IDR_PRODUCT_LOGO_64); 116 html_source->AddResourcePath("logo-large.png", IDR_PRODUCT_LOGO_64);
117 html_source->AddResourcePath("logo-large2x.png", IDR_PRODUCT_LOGO_128); 117 html_source->AddResourcePath("logo-large2x.png", IDR_PRODUCT_LOGO_128);
118 118
119 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 119 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
120 } 120 }
121 121
122 WelcomeWin10UI::~WelcomeWin10UI() = default; 122 WelcomeWin10UI::~WelcomeWin10UI() = default;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698