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

Side by Side Diff: chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc

Issue 1494253003: MD Downloads: add a use_vulcanize option to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/chrome_browser_ui.gypi » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_downloads/md_downloads_ui.h" 5 #include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h"
6 6
7 #include "base/memory/ref_counted_memory.h" 7 #include "base/memory/ref_counted_memory.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/defaults.h" 13 #include "chrome/browser/defaults.h"
14 #include "chrome/browser/download/download_service.h" 14 #include "chrome/browser/download/download_service.h"
15 #include "chrome/browser/download/download_service_factory.h" 15 #include "chrome/browser/download/download_service_factory.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h" 17 #include "chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h"
18 #include "chrome/browser/ui/webui/theme_source.h" 18 #include "chrome/browser/ui/webui/theme_source.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/features.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "chrome/grit/chromium_strings.h" 23 #include "chrome/grit/chromium_strings.h"
23 #include "chrome/grit/generated_resources.h" 24 #include "chrome/grit/generated_resources.h"
24 #include "content/public/browser/download_manager.h" 25 #include "content/public/browser/download_manager.h"
25 #include "content/public/browser/url_data_source.h" 26 #include "content/public/browser/url_data_source.h"
26 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
27 #include "content/public/browser/web_ui.h" 28 #include "content/public/browser/web_ui.h"
28 #include "content/public/browser/web_ui_data_source.h" 29 #include "content/public/browser/web_ui_data_source.h"
29 #include "grit/browser_resources.h" 30 #include "grit/browser_resources.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 source->AddLocalizedString("inIncognito", IDS_DOWNLOAD_IN_INCOGNITO); 96 source->AddLocalizedString("inIncognito", IDS_DOWNLOAD_IN_INCOGNITO);
96 97
97 source->AddResourcePath("1x/incognito_marker.png", 98 source->AddResourcePath("1x/incognito_marker.png",
98 IDR_MD_DOWNLOADS_1X_INCOGNITO_MARKER_PNG); 99 IDR_MD_DOWNLOADS_1X_INCOGNITO_MARKER_PNG);
99 source->AddResourcePath("2x/incognito_marker.png", 100 source->AddResourcePath("2x/incognito_marker.png",
100 IDR_MD_DOWNLOADS_2X_INCOGNITO_MARKER_PNG); 101 IDR_MD_DOWNLOADS_2X_INCOGNITO_MARKER_PNG);
101 source->AddResourcePath("1x/no_downloads.png", 102 source->AddResourcePath("1x/no_downloads.png",
102 IDR_MD_DOWNLOADS_1X_NO_DOWNLOADS_PNG); 103 IDR_MD_DOWNLOADS_1X_NO_DOWNLOADS_PNG);
103 source->AddResourcePath("2x/no_downloads.png", 104 source->AddResourcePath("2x/no_downloads.png",
104 IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG); 105 IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG);
106
107 #if BUILDFLAG(USE_VULCANIZE)
108 source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS);
109 source->SetDefaultResource(IDR_MD_DOWNLOADS_VULCANIZED_HTML);
110 #else
105 source->AddResourcePath("action_service.html", 111 source->AddResourcePath("action_service.html",
106 IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML); 112 IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML);
107 source->AddResourcePath("action_service.js", 113 source->AddResourcePath("action_service.js",
108 IDR_MD_DOWNLOADS_ACTION_SERVICE_JS); 114 IDR_MD_DOWNLOADS_ACTION_SERVICE_JS);
109 source->AddResourcePath("constants.html", IDR_MD_DOWNLOADS_CONSTANTS_HTML); 115 source->AddResourcePath("constants.html", IDR_MD_DOWNLOADS_CONSTANTS_HTML);
110 source->AddResourcePath("constants.js", IDR_MD_DOWNLOADS_CONSTANTS_JS); 116 source->AddResourcePath("constants.js", IDR_MD_DOWNLOADS_CONSTANTS_JS);
111 source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS);
112 source->AddResourcePath("dev.html", IDR_MD_DOWNLOADS_DOWNLOADS_HTML);
113 source->AddResourcePath("downloads.js", IDR_MD_DOWNLOADS_DOWNLOADS_JS); 117 source->AddResourcePath("downloads.js", IDR_MD_DOWNLOADS_DOWNLOADS_JS);
114 source->AddResourcePath("i18n_setup.html", IDR_MD_DOWNLOADS_I18N_SETUP_HTML); 118 source->AddResourcePath("i18n_setup.html", IDR_MD_DOWNLOADS_I18N_SETUP_HTML);
115 source->AddResourcePath("item.css", IDR_MD_DOWNLOADS_ITEM_CSS); 119 source->AddResourcePath("item.css", IDR_MD_DOWNLOADS_ITEM_CSS);
116 source->AddResourcePath("item.html", IDR_MD_DOWNLOADS_ITEM_HTML); 120 source->AddResourcePath("item.html", IDR_MD_DOWNLOADS_ITEM_HTML);
117 source->AddResourcePath("item.js", IDR_MD_DOWNLOADS_ITEM_JS); 121 source->AddResourcePath("item.js", IDR_MD_DOWNLOADS_ITEM_JS);
118 source->AddResourcePath("manager.css", IDR_MD_DOWNLOADS_MANAGER_CSS); 122 source->AddResourcePath("manager.css", IDR_MD_DOWNLOADS_MANAGER_CSS);
119 source->AddResourcePath("manager.html", IDR_MD_DOWNLOADS_MANAGER_HTML); 123 source->AddResourcePath("manager.html", IDR_MD_DOWNLOADS_MANAGER_HTML);
120 source->AddResourcePath("manager.js", IDR_MD_DOWNLOADS_MANAGER_JS); 124 source->AddResourcePath("manager.js", IDR_MD_DOWNLOADS_MANAGER_JS);
121 source->AddResourcePath("shared_style.css", 125 source->AddResourcePath("shared_style.css",
122 IDR_MD_DOWNLOADS_SHARED_STYLE_CSS); 126 IDR_MD_DOWNLOADS_SHARED_STYLE_CSS);
123 source->AddResourcePath("toolbar.css", IDR_MD_DOWNLOADS_TOOLBAR_CSS); 127 source->AddResourcePath("toolbar.css", IDR_MD_DOWNLOADS_TOOLBAR_CSS);
124 source->AddResourcePath("toolbar.html", IDR_MD_DOWNLOADS_TOOLBAR_HTML); 128 source->AddResourcePath("toolbar.html", IDR_MD_DOWNLOADS_TOOLBAR_HTML);
125 source->AddResourcePath("toolbar.js", IDR_MD_DOWNLOADS_TOOLBAR_JS); 129 source->AddResourcePath("toolbar.js", IDR_MD_DOWNLOADS_TOOLBAR_JS);
130 source->SetDefaultResource(IDR_MD_DOWNLOADS_DOWNLOADS_HTML);
131 #endif
126 132
127 source->SetDefaultResource(IDR_MD_DOWNLOADS_VULCANIZED_HTML);
128 source->SetJsonPath("strings.js"); 133 source->SetJsonPath("strings.js");
129 134
130 return source; 135 return source;
131 } 136 }
132 137
133 } // namespace 138 } // namespace
134 139
135 /////////////////////////////////////////////////////////////////////////////// 140 ///////////////////////////////////////////////////////////////////////////////
136 // 141 //
137 // MdDownloadsUI 142 // MdDownloadsUI
(...skipping 20 matching lines...) Expand all
158 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes( 163 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes(
159 ui::ScaleFactor scale_factor) { 164 ui::ScaleFactor scale_factor) {
160 return ResourceBundle::GetSharedInstance(). 165 return ResourceBundle::GetSharedInstance().
161 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); 166 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor);
162 } 167 }
163 168
164 void MdDownloadsUI::RenderViewReused( 169 void MdDownloadsUI::RenderViewReused(
165 content::RenderViewHost* render_view_host) { 170 content::RenderViewHost* render_view_host) {
166 handler_->RenderViewReused(render_view_host); 171 handler_->RenderViewReused(render_view_host);
167 } 172 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698