| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 IDS_DOWNLOAD_LINK_REMOVE); | 83 IDS_DOWNLOAD_LINK_REMOVE); |
| 84 source->AddLocalizedString("control_by_extension", | 84 source->AddLocalizedString("control_by_extension", |
| 85 IDS_DOWNLOAD_BY_EXTENSION); | 85 IDS_DOWNLOAD_BY_EXTENSION); |
| 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.html", IDR_DOWNLOADS_CONSTANTS_HTML); |
| 94 source->AddResourcePath("constants.js", IDR_DOWNLOADS_CONSTANTS_JS); |
| 94 source->AddResourcePath("throttled_icon_loader.html", | 95 source->AddResourcePath("throttled_icon_loader.html", |
| 95 IDR_DOWNLOAD_THROTTLED_ICON_LOADER_HTML); | 96 IDR_DOWNLOADS_THROTTLED_ICON_LOADER_HTML); |
| 96 source->AddResourcePath("throttled_icon_loader.js", | 97 source->AddResourcePath("throttled_icon_loader.js", |
| 97 IDR_DOWNLOAD_THROTTLED_ICON_LOADER_JS); | 98 IDR_DOWNLOADS_THROTTLED_ICON_LOADER_JS); |
| 98 | 99 |
| 99 if (switches::MdDownloadsEnabled()) { | 100 if (switches::MdDownloadsEnabled()) { |
| 100 source->AddResourcePath("manager.js", IDR_MD_DOWNLOAD_MANAGER_JS); | 101 source->AddResourcePath("downloads.css", IDR_MD_DOWNLOADS_DOWNLOADS_CSS); |
| 101 source->SetDefaultResource(IDR_MD_DOWNLOADS_HTML); | 102 source->AddResourcePath("item_view.html", IDR_MD_DOWNLOADS_ITEM_VIEW_HTML); |
| 103 source->AddResourcePath("item_view.js", IDR_MD_DOWNLOADS_ITEM_VIEW_JS); |
| 104 source->AddResourcePath("manager.html", IDR_MD_DOWNLOADS_MANAGER_HTML); |
| 105 source->AddResourcePath("manager.js", IDR_MD_DOWNLOADS_MANAGER_JS); |
| 106 source->AddResourcePath("strings.html", IDR_MD_DOWNLOADS_STRINGS_HTML); |
| 107 source->SetDefaultResource(IDR_MD_DOWNLOADS_DOWNLOADS_HTML); |
| 102 } else { | 108 } else { |
| 103 source->AddResourcePath("item_view.js", IDR_DOWNLOAD_ITEM_VIEW_JS); | 109 source->AddResourcePath("item_view.js", IDR_DOWNLOADS_ITEM_VIEW_JS); |
| 104 source->AddResourcePath("focus_row.js", IDR_DOWNLOAD_FOCUS_ROW_JS); | 110 source->AddResourcePath("focus_row.js", IDR_DOWNLOADS_FOCUS_ROW_JS); |
| 105 source->AddResourcePath("manager.js", IDR_DOWNLOAD_MANAGER_JS); | 111 source->AddResourcePath("manager.js", IDR_DOWNLOADS_MANAGER_JS); |
| 106 source->SetDefaultResource(IDR_DOWNLOADS_HTML); | 112 source->SetDefaultResource(IDR_DOWNLOADS_DOWNLOADS_HTML); |
| 107 } | 113 } |
| 108 | 114 |
| 109 return source; | 115 return source; |
| 110 } | 116 } |
| 111 | 117 |
| 112 } // namespace | 118 } // namespace |
| 113 | 119 |
| 114 /////////////////////////////////////////////////////////////////////////////// | 120 /////////////////////////////////////////////////////////////////////////////// |
| 115 // | 121 // |
| 116 // DownloadsUI | 122 // DownloadsUI |
| (...skipping 15 matching lines...) Expand all Loading... |
| 132 content::URLDataSource::Add(profile, theme); | 138 content::URLDataSource::Add(profile, theme); |
| 133 #endif | 139 #endif |
| 134 } | 140 } |
| 135 | 141 |
| 136 // static | 142 // static |
| 137 base::RefCountedMemory* DownloadsUI::GetFaviconResourceBytes( | 143 base::RefCountedMemory* DownloadsUI::GetFaviconResourceBytes( |
| 138 ui::ScaleFactor scale_factor) { | 144 ui::ScaleFactor scale_factor) { |
| 139 return ResourceBundle::GetSharedInstance(). | 145 return ResourceBundle::GetSharedInstance(). |
| 140 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); | 146 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); |
| 141 } | 147 } |
| OLD | NEW |