| OLD | NEW |
| 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/downloads_ui.h" | 5 #include "chrome/browser/ui/webui/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" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 PrefService* prefs = profile->GetPrefs(); | 87 PrefService* prefs = profile->GetPrefs(); |
| 88 source->AddBoolean("allow_deleting_history", | 88 source->AddBoolean("allow_deleting_history", |
| 89 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory) && | 89 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory) && |
| 90 !profile->IsSupervised()); | 90 !profile->IsSupervised()); |
| 91 | 91 |
| 92 source->SetJsonPath("strings.js"); | 92 source->SetJsonPath("strings.js"); |
| 93 source->AddResourcePath("constants.js", IDR_DOWNLOAD_CONSTANTS_JS); | 93 source->AddResourcePath("constants.js", IDR_DOWNLOAD_CONSTANTS_JS); |
| 94 | 94 |
| 95 if (switches::MdDownloadsEnabled()) { | 95 if (switches::MdDownloadsEnabled()) { |
| 96 source->AddResourcePath("item_view.html", IDR_MD_DOWNLOAD_ITEM_VIEW_HTML); |
| 97 source->AddResourcePath("item_view.js", IDR_MD_DOWNLOAD_ITEM_VIEW_JS); |
| 98 source->AddResourcePath("icon_loader.js", IDR_MD_DOWNLOAD_ICON_LOADER_JS); |
| 96 source->AddResourcePath("manager.js", IDR_MD_DOWNLOAD_MANAGER_JS); | 99 source->AddResourcePath("manager.js", IDR_MD_DOWNLOAD_MANAGER_JS); |
| 97 source->SetDefaultResource(IDR_MD_DOWNLOADS_HTML); | 100 source->SetDefaultResource(IDR_MD_DOWNLOADS_HTML); |
| 98 } else { | 101 } else { |
| 99 source->AddResourcePath("item.js", IDR_DOWNLOAD_ITEM_JS); | 102 source->AddResourcePath("item.js", IDR_DOWNLOAD_ITEM_JS); |
| 100 source->AddResourcePath("item_view.js", IDR_DOWNLOAD_ITEM_VIEW_JS); | 103 source->AddResourcePath("item_view.js", IDR_DOWNLOAD_ITEM_VIEW_JS); |
| 101 source->AddResourcePath("focus_row.js", IDR_DOWNLOAD_FOCUS_ROW_JS); | 104 source->AddResourcePath("focus_row.js", IDR_DOWNLOAD_FOCUS_ROW_JS); |
| 102 source->AddResourcePath("manager.js", IDR_DOWNLOAD_MANAGER_JS); | 105 source->AddResourcePath("manager.js", IDR_DOWNLOAD_MANAGER_JS); |
| 103 source->SetDefaultResource(IDR_DOWNLOADS_HTML); | 106 source->SetDefaultResource(IDR_DOWNLOADS_HTML); |
| 104 } | 107 } |
| 105 | 108 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 129 content::URLDataSource::Add(profile, theme); | 132 content::URLDataSource::Add(profile, theme); |
| 130 #endif | 133 #endif |
| 131 } | 134 } |
| 132 | 135 |
| 133 // static | 136 // static |
| 134 base::RefCountedMemory* DownloadsUI::GetFaviconResourceBytes( | 137 base::RefCountedMemory* DownloadsUI::GetFaviconResourceBytes( |
| 135 ui::ScaleFactor scale_factor) { | 138 ui::ScaleFactor scale_factor) { |
| 136 return ResourceBundle::GetSharedInstance(). | 139 return ResourceBundle::GetSharedInstance(). |
| 137 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); | 140 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); |
| 138 } | 141 } |
| OLD | NEW |