OLD | NEW |
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 source->AddBoolean("groupByDomain", group_by_domain); | 107 source->AddBoolean("groupByDomain", group_by_domain); |
108 | 108 |
109 source->AddBoolean("isGuestSession", profile->IsGuestSession()); | 109 source->AddBoolean("isGuestSession", profile->IsGuestSession()); |
110 | 110 |
111 SigninManagerBase* signin_manager = | 111 SigninManagerBase* signin_manager = |
112 SigninManagerFactory::GetForProfile(profile); | 112 SigninManagerFactory::GetForProfile(profile); |
113 bool is_authenticated = signin_manager != nullptr && | 113 bool is_authenticated = signin_manager != nullptr && |
114 signin_manager->IsAuthenticated(); | 114 signin_manager->IsAuthenticated(); |
115 source->AddBoolean("isUserSignedIn", is_authenticated); | 115 source->AddBoolean("isUserSignedIn", is_authenticated); |
116 | 116 |
| 117 source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML); |
| 118 source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS); |
| 119 source->AddResourcePath("images/100/sign_in_promo.png", |
| 120 IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_PNG); |
| 121 source->AddResourcePath("images/200/sign_in_promo.png", |
| 122 IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_PNG); |
| 123 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS); |
| 124 |
| 125 #if BUILDFLAG(USE_VULCANIZE) |
| 126 source->AddResourcePath("app.html", |
| 127 IDR_MD_HISTORY_APP_VULCANIZED_HTML); |
| 128 source->AddResourcePath("app.crisper.js", |
| 129 IDR_MD_HISTORY_APP_CRISPER_JS); |
| 130 #else |
117 source->AddResourcePath("app.html", IDR_MD_HISTORY_APP_HTML); | 131 source->AddResourcePath("app.html", IDR_MD_HISTORY_APP_HTML); |
118 source->AddResourcePath("app.js", IDR_MD_HISTORY_APP_JS); | 132 source->AddResourcePath("app.js", IDR_MD_HISTORY_APP_JS); |
119 source->AddResourcePath("browser_service.html", | 133 source->AddResourcePath("browser_service.html", |
120 IDR_MD_HISTORY_BROWSER_SERVICE_HTML); | 134 IDR_MD_HISTORY_BROWSER_SERVICE_HTML); |
121 source->AddResourcePath("browser_service.js", | 135 source->AddResourcePath("browser_service.js", |
122 IDR_MD_HISTORY_BROWSER_SERVICE_JS); | 136 IDR_MD_HISTORY_BROWSER_SERVICE_JS); |
123 source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML); | |
124 source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS); | |
125 source->AddResourcePath("grouped_list.html", | 137 source->AddResourcePath("grouped_list.html", |
126 IDR_MD_HISTORY_GROUPED_LIST_HTML); | 138 IDR_MD_HISTORY_GROUPED_LIST_HTML); |
127 source->AddResourcePath("grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS); | 139 source->AddResourcePath("grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS); |
128 source->AddResourcePath("history_item.html", | 140 source->AddResourcePath("history_item.html", |
129 IDR_MD_HISTORY_HISTORY_ITEM_HTML); | 141 IDR_MD_HISTORY_HISTORY_ITEM_HTML); |
130 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); | 142 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); |
131 source->AddResourcePath("history_list.html", | 143 source->AddResourcePath("history_list.html", |
132 IDR_MD_HISTORY_HISTORY_LIST_HTML); | 144 IDR_MD_HISTORY_HISTORY_LIST_HTML); |
133 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS); | 145 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS); |
134 source->AddResourcePath("history_list_behavior.html", | 146 source->AddResourcePath("history_list_behavior.html", |
135 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML); | 147 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML); |
136 source->AddResourcePath("history_list_behavior.js", | 148 source->AddResourcePath("history_list_behavior.js", |
137 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS); | 149 IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS); |
138 source->AddResourcePath("history_toolbar.html", | 150 source->AddResourcePath("history_toolbar.html", |
139 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); | 151 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); |
140 source->AddResourcePath("history_toolbar.js", | 152 source->AddResourcePath("history_toolbar.js", |
141 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); | 153 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); |
142 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS); | |
143 source->AddResourcePath("icons.html", IDR_MD_HISTORY_ICONS_HTML); | 154 source->AddResourcePath("icons.html", IDR_MD_HISTORY_ICONS_HTML); |
144 source->AddResourcePath("images/100/sign_in_promo.png", | |
145 IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_PNG); | |
146 source->AddResourcePath("images/200/sign_in_promo.png", | |
147 IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_PNG); | |
148 source->AddResourcePath("list_container.html", | 155 source->AddResourcePath("list_container.html", |
149 IDR_MD_HISTORY_LIST_CONTAINER_HTML); | 156 IDR_MD_HISTORY_LIST_CONTAINER_HTML); |
150 source->AddResourcePath("list_container.js", | 157 source->AddResourcePath("list_container.js", |
151 IDR_MD_HISTORY_LIST_CONTAINER_JS); | 158 IDR_MD_HISTORY_LIST_CONTAINER_JS); |
152 source->AddResourcePath("searched_label.html", | 159 source->AddResourcePath("searched_label.html", |
153 IDR_MD_HISTORY_SEARCHED_LABEL_HTML); | 160 IDR_MD_HISTORY_SEARCHED_LABEL_HTML); |
154 source->AddResourcePath("searched_label.js", | 161 source->AddResourcePath("searched_label.js", |
155 IDR_MD_HISTORY_SEARCHED_LABEL_JS); | 162 IDR_MD_HISTORY_SEARCHED_LABEL_JS); |
156 source->AddResourcePath("shared_style.html", | 163 source->AddResourcePath("shared_style.html", |
157 IDR_MD_HISTORY_SHARED_STYLE_HTML); | 164 IDR_MD_HISTORY_SHARED_STYLE_HTML); |
158 source->AddResourcePath("side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML); | 165 source->AddResourcePath("side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML); |
159 source->AddResourcePath("side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS); | 166 source->AddResourcePath("side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS); |
160 source->AddResourcePath("synced_device_card.html", | 167 source->AddResourcePath("synced_device_card.html", |
161 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML); | 168 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML); |
162 source->AddResourcePath("synced_device_card.js", | 169 source->AddResourcePath("synced_device_card.js", |
163 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS); | 170 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS); |
164 source->AddResourcePath("synced_device_manager.html", | 171 source->AddResourcePath("synced_device_manager.html", |
165 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML); | 172 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML); |
166 source->AddResourcePath("synced_device_manager.js", | 173 source->AddResourcePath("synced_device_manager.js", |
167 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS); | 174 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS); |
| 175 #endif // BUILDFLAG(USE_VULCANIZE) |
168 | 176 |
169 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); | 177 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); |
170 source->SetJsonPath("strings.js"); | 178 source->SetJsonPath("strings.js"); |
171 | 179 |
172 return source; | 180 return source; |
173 } | 181 } |
174 | 182 |
175 } // namespace | 183 } // namespace |
176 | 184 |
177 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 185 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
(...skipping 29 matching lines...) Expand all Loading... |
207 base::FeatureList::ClearInstanceForTesting(); | 215 base::FeatureList::ClearInstanceForTesting(); |
208 base::FeatureList::SetInstance(std::move(feature_list)); | 216 base::FeatureList::SetInstance(std::move(feature_list)); |
209 } | 217 } |
210 | 218 |
211 // static | 219 // static |
212 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( | 220 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( |
213 ui::ScaleFactor scale_factor) { | 221 ui::ScaleFactor scale_factor) { |
214 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 222 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
215 IDR_HISTORY_FAVICON, scale_factor); | 223 IDR_HISTORY_FAVICON, scale_factor); |
216 } | 224 } |
OLD | NEW |