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

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

Issue 2224003003: Vulcanize MD History to improve page-load performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/md_history_ui.h" 5 #include "chrome/browser/ui/webui/md_history_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 source->AddBoolean("groupByDomain", group_by_domain); 106 source->AddBoolean("groupByDomain", group_by_domain);
107 107
108 source->AddBoolean("isGuestSession", profile->IsGuestSession()); 108 source->AddBoolean("isGuestSession", profile->IsGuestSession());
109 109
110 SigninManagerBase* signin_manager = 110 SigninManagerBase* signin_manager =
111 SigninManagerFactory::GetForProfile(profile); 111 SigninManagerFactory::GetForProfile(profile);
112 bool is_authenticated = signin_manager != nullptr && 112 bool is_authenticated = signin_manager != nullptr &&
113 signin_manager->IsAuthenticated(); 113 signin_manager->IsAuthenticated();
114 source->AddBoolean("isUserSignedIn", is_authenticated); 114 source->AddBoolean("isUserSignedIn", is_authenticated);
115 115
116 source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML);
117 source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS);
118 source->AddResourcePath("images/100/sign_in_promo.png",
119 IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_PNG);
120 source->AddResourcePath("images/200/sign_in_promo.png",
121 IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_PNG);
122 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS);
123
124 #if BUILDFLAG(USE_VULCANIZE)
125 source->AddResourcePath("app.html",
126 IDR_MD_HISTORY_APP_VULCANIZED_HTML);
127 source->AddResourcePath("app.crisper.js",
128 IDR_MD_HISTORY_APP_CRISPER_JS);
129 #else
116 source->AddResourcePath("app.html", IDR_MD_HISTORY_APP_HTML); 130 source->AddResourcePath("app.html", IDR_MD_HISTORY_APP_HTML);
117 source->AddResourcePath("app.js", IDR_MD_HISTORY_APP_JS); 131 source->AddResourcePath("app.js", IDR_MD_HISTORY_APP_JS);
118 source->AddResourcePath("browser_service.html", 132 source->AddResourcePath("browser_service.html",
119 IDR_MD_HISTORY_BROWSER_SERVICE_HTML); 133 IDR_MD_HISTORY_BROWSER_SERVICE_HTML);
120 source->AddResourcePath("browser_service.js", 134 source->AddResourcePath("browser_service.js",
121 IDR_MD_HISTORY_BROWSER_SERVICE_JS); 135 IDR_MD_HISTORY_BROWSER_SERVICE_JS);
122 source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML);
123 source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS);
124 source->AddResourcePath("grouped_list.html", 136 source->AddResourcePath("grouped_list.html",
125 IDR_MD_HISTORY_GROUPED_LIST_HTML); 137 IDR_MD_HISTORY_GROUPED_LIST_HTML);
126 source->AddResourcePath("grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS); 138 source->AddResourcePath("grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS);
127 source->AddResourcePath("history_item.html", 139 source->AddResourcePath("history_item.html",
128 IDR_MD_HISTORY_HISTORY_ITEM_HTML); 140 IDR_MD_HISTORY_HISTORY_ITEM_HTML);
129 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); 141 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS);
130 source->AddResourcePath("history_list.html", 142 source->AddResourcePath("history_list.html",
131 IDR_MD_HISTORY_HISTORY_LIST_HTML); 143 IDR_MD_HISTORY_HISTORY_LIST_HTML);
132 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS); 144 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS);
133 source->AddResourcePath("history_list_behavior.html", 145 source->AddResourcePath("history_list_behavior.html",
134 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML); 146 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML);
135 source->AddResourcePath("history_list_behavior.js", 147 source->AddResourcePath("history_list_behavior.js",
136 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS); 148 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS);
137 source->AddResourcePath("history_toolbar.html", 149 source->AddResourcePath("history_toolbar.html",
138 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); 150 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML);
139 source->AddResourcePath("history_toolbar.js", 151 source->AddResourcePath("history_toolbar.js",
140 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); 152 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS);
141 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS);
142 source->AddResourcePath("icons.html", IDR_MD_HISTORY_ICONS_HTML); 153 source->AddResourcePath("icons.html", IDR_MD_HISTORY_ICONS_HTML);
143 source->AddResourcePath("images/100/sign_in_promo.png",
144 IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_PNG);
145 source->AddResourcePath("images/200/sign_in_promo.png",
146 IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_PNG);
147 source->AddResourcePath("lazy_render.html", 154 source->AddResourcePath("lazy_render.html",
148 IDR_MD_HISTORY_LAZY_RENDER_HTML); 155 IDR_MD_HISTORY_LAZY_RENDER_HTML);
149 source->AddResourcePath("lazy_render.js", 156 source->AddResourcePath("lazy_render.js",
150 IDR_MD_HISTORY_LAZY_RENDER_JS); 157 IDR_MD_HISTORY_LAZY_RENDER_JS);
151 source->AddResourcePath("list_container.html", 158 source->AddResourcePath("list_container.html",
152 IDR_MD_HISTORY_LIST_CONTAINER_HTML); 159 IDR_MD_HISTORY_LIST_CONTAINER_HTML);
153 source->AddResourcePath("list_container.js", 160 source->AddResourcePath("list_container.js",
154 IDR_MD_HISTORY_LIST_CONTAINER_JS); 161 IDR_MD_HISTORY_LIST_CONTAINER_JS);
155 source->AddResourcePath("searched_label.html", 162 source->AddResourcePath("searched_label.html",
156 IDR_MD_HISTORY_SEARCHED_LABEL_HTML); 163 IDR_MD_HISTORY_SEARCHED_LABEL_HTML);
157 source->AddResourcePath("searched_label.js", 164 source->AddResourcePath("searched_label.js",
158 IDR_MD_HISTORY_SEARCHED_LABEL_JS); 165 IDR_MD_HISTORY_SEARCHED_LABEL_JS);
159 source->AddResourcePath("shared_style.html", 166 source->AddResourcePath("shared_style.html",
160 IDR_MD_HISTORY_SHARED_STYLE_HTML); 167 IDR_MD_HISTORY_SHARED_STYLE_HTML);
161 source->AddResourcePath("side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML); 168 source->AddResourcePath("side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML);
162 source->AddResourcePath("side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS); 169 source->AddResourcePath("side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS);
163 source->AddResourcePath("synced_device_card.html", 170 source->AddResourcePath("synced_device_card.html",
164 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML); 171 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML);
165 source->AddResourcePath("synced_device_card.js", 172 source->AddResourcePath("synced_device_card.js",
166 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS); 173 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS);
167 source->AddResourcePath("synced_device_manager.html", 174 source->AddResourcePath("synced_device_manager.html",
168 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML); 175 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML);
169 source->AddResourcePath("synced_device_manager.js", 176 source->AddResourcePath("synced_device_manager.js",
170 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS); 177 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS);
178 #endif // BUILDFLAG(USE_VULCANIZE)
171 179
172 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); 180 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML);
173 source->SetJsonPath("strings.js"); 181 source->SetJsonPath("strings.js");
174 182
175 return source; 183 return source;
176 } 184 }
177 185
178 } // namespace 186 } // namespace
179 187
180 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { 188 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
(...skipping 27 matching lines...) Expand all
208 base::FeatureList::ClearInstanceForTesting(); 216 base::FeatureList::ClearInstanceForTesting();
209 base::FeatureList::SetInstance(std::move(feature_list)); 217 base::FeatureList::SetInstance(std::move(feature_list));
210 } 218 }
211 219
212 // static 220 // static
213 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( 221 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes(
214 ui::ScaleFactor scale_factor) { 222 ui::ScaleFactor scale_factor) {
215 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 223 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
216 IDR_HISTORY_FAVICON, scale_factor); 224 IDR_HISTORY_FAVICON, scale_factor);
217 } 225 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/vulcanize.py ('k') | chrome/test/data/webui/md_history/history_toolbar_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698