diff options
| author | dbeam <dbeam@chromium.org> | 2015-10-27 19:45:15 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2015-10-28 02:45:48 +0000 |
| commit | a5c39fafab189f3f2228a4f8a34c7a91a32549c7 (patch) | |
| tree | 379c7a6fe2f965ad247c306b6d596c088bcd7279 | |
| parent | c55e4aae37839cfcf09e80af1eb6acdbe02ce1c3 (diff) | |
| download | chromium_src-a5c39fafab189f3f2228a4f8a34c7a91a32549c7.zip chromium_src-a5c39fafab189f3f2228a4f8a34c7a91a32549c7.tar.gz chromium_src-a5c39fafab189f3f2228a4f8a34c7a91a32549c7.tar.bz2 | |
Downloads resources/closure compilation cleanup
This CL:
1) moves ThrottledIconLoader to pre-Polymer downloads
2) copies externs/constants to both versions
3) removes unused focus references from Polymer version
R=michaelpg@chromium.org
BUG=none
Review URL: https://codereview.chromium.org/1413223010
Cr-Commit-Position: refs/heads/master@{#356500}
13 files changed, 114 insertions, 37 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 869b587..a1b5098 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -118,8 +118,8 @@ <include name="IDR_DOWNLOADS_FOCUS_ROW_JS" file="resources\downloads\focus_row.js" type="BINDATA" /> <include name="IDR_DOWNLOADS_ITEM_VIEW_JS" file="resources\downloads\item_view.js" type="BINDATA" /> <include name="IDR_DOWNLOADS_MANAGER_JS" file="resources\downloads\manager.js" type="BINDATA" /> - <include name="IDR_DOWNLOADS_THROTTLED_ICON_LOADER_HTML" file="resources\md_downloads\throttled_icon_loader.html" type="BINDATA" /> - <include name="IDR_DOWNLOADS_THROTTLED_ICON_LOADER_JS" file="resources\md_downloads\throttled_icon_loader.js" type="BINDATA" /> + <include name="IDR_DOWNLOADS_THROTTLED_ICON_LOADER_HTML" file="resources\downloads\throttled_icon_loader.html" type="BINDATA" /> + <include name="IDR_DOWNLOADS_THROTTLED_ICON_LOADER_JS" file="resources\downloads\throttled_icon_loader.js" type="BINDATA" /> <include name="IDR_MD_DOWNLOADS_1X_INCOGNITO_MARKER_PNG" file="resources\md_downloads\1x\incognito_marker.png" type="BINDATA" /> <include name="IDR_MD_DOWNLOADS_2X_INCOGNITO_MARKER_PNG" file="resources\md_downloads\2x\incognito_marker.png" type="BINDATA" /> <include name="IDR_MD_DOWNLOADS_1X_NO_DOWNLOADS_PNG" file="resources\md_downloads\1x\no_downloads.png" type="BINDATA" /> @@ -127,8 +127,6 @@ <include name="IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML" file="resources\md_downloads\action_service.html" type="BINDATA" /> <include name="IDR_MD_DOWNLOADS_ACTION_SERVICE_JS" file="resources\md_downloads\action_service.js" type="BINDATA" /> <include name="IDR_MD_DOWNLOADS_CRISPER_JS" file="resources\md_downloads\crisper.js" flattenhtml="true" type="BINDATA" /> - <include name="IDR_MD_DOWNLOADS_FOCUS_ROW_HTML" file="resources\md_downloads\focus_row.html" type="BINDATA" /> - <include name="IDR_MD_DOWNLOADS_FOCUS_ROW_JS" file="resources\md_downloads\focus_row.js" type="BINDATA" /> <include name="IDR_MD_DOWNLOADS_ITEM_CSS" file="resources\md_downloads\item.css" type="BINDATA" flattenhtml="true" /> <include name="IDR_MD_DOWNLOADS_ITEM_HTML" file="resources\md_downloads\item.html" type="BINDATA" /> <include name="IDR_MD_DOWNLOADS_ITEM_JS" file="resources\md_downloads\item.js" type="BINDATA" /> diff --git a/chrome/browser/resources/downloads/compiled_resources.gyp b/chrome/browser/resources/downloads/compiled_resources.gyp index 23d9432..25184bd 100644 --- a/chrome/browser/resources/downloads/compiled_resources.gyp +++ b/chrome/browser/resources/downloads/compiled_resources.gyp @@ -17,8 +17,8 @@ '../../../../ui/webui/resources/js/cr/ui/focus_row.js', '../../../../ui/webui/resources/js/event_tracker.js', '../../../../ui/webui/resources/js/util.js', - '../md_downloads/constants.js', - '../md_downloads/throttled_icon_loader.js', + 'constants.js', + 'throttled_icon_loader.js', 'item_view.js', 'focus_row.js', ], diff --git a/chrome/browser/resources/downloads/compiled_resources2.gyp b/chrome/browser/resources/downloads/compiled_resources2.gyp index f5793ee..4777352 100644 --- a/chrome/browser/resources/downloads/compiled_resources2.gyp +++ b/chrome/browser/resources/downloads/compiled_resources2.gyp @@ -4,6 +4,11 @@ { 'targets': [ { + 'target_name': 'constants', + 'dependencies': ['<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr'], + 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], + }, + { 'target_name': 'externs', 'includes': ['../../../../third_party/closure_compiler/externs_js.gypi'], }, @@ -13,8 +18,8 @@ '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util', - '../md_downloads/compiled_resources2.gyp:constants', - '../md_downloads/compiled_resources2.gyp:throttled_icon_loader', + 'constants', + 'throttled_icon_loader', 'externs', ], 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], @@ -40,8 +45,8 @@ '<(DEPTH)/ui/webui/resources/js/cr/compiled_resources2.gyp:ui', '<(DEPTH)/ui/webui/resources/js/cr/ui/compiled_resources2.gyp:command', '<(DEPTH)/ui/webui/resources/js/cr/ui/compiled_resources2.gyp:focus_grid', - '../md_downloads/copmiled_resources2.gyp:constants', - '../md_downloads/compiled_resources2.gyp:throttled_icon_loader', + 'constants', + 'throttled_icon_loader', 'item_view', 'focus_row', '<(EXTERNS_GYP):chrome_send', @@ -49,5 +54,10 @@ ], 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], }, + { + 'target_name': 'throttled_icon_loader', + 'dependencies': ['<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr'], + 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], + }, ], } diff --git a/chrome/browser/resources/downloads/constants.js b/chrome/browser/resources/downloads/constants.js new file mode 100644 index 0000000..b123be0 --- /dev/null +++ b/chrome/browser/resources/downloads/constants.js @@ -0,0 +1,38 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +cr.define('downloads', function() { + /** + * Explains why a download is in DANGEROUS state. + * @enum {string} + */ + var DangerType = { + NOT_DANGEROUS: 'NOT_DANGEROUS', + DANGEROUS_FILE: 'DANGEROUS_FILE', + DANGEROUS_URL: 'DANGEROUS_URL', + DANGEROUS_CONTENT: 'DANGEROUS_CONTENT', + UNCOMMON_CONTENT: 'UNCOMMON_CONTENT', + DANGEROUS_HOST: 'DANGEROUS_HOST', + POTENTIALLY_UNWANTED: 'POTENTIALLY_UNWANTED', + }; + + /** + * The states a download can be in. These correspond to states defined in + * DownloadsDOMHandler::CreateDownloadItemValue + * @enum {string} + */ + var States = { + IN_PROGRESS: 'IN_PROGRESS', + CANCELLED: 'CANCELLED', + COMPLETE: 'COMPLETE', + PAUSED: 'PAUSED', + DANGEROUS: 'DANGEROUS', + INTERRUPTED: 'INTERRUPTED', + }; + + return { + DangerType: DangerType, + States: States, + }; +}); diff --git a/chrome/browser/resources/md_downloads/throttled_icon_loader.html b/chrome/browser/resources/downloads/throttled_icon_loader.html index 4cbd4eb..4cbd4eb 100644 --- a/chrome/browser/resources/md_downloads/throttled_icon_loader.html +++ b/chrome/browser/resources/downloads/throttled_icon_loader.html diff --git a/chrome/browser/resources/md_downloads/throttled_icon_loader.js b/chrome/browser/resources/downloads/throttled_icon_loader.js index 5a10024..5a10024 100644 --- a/chrome/browser/resources/md_downloads/throttled_icon_loader.js +++ b/chrome/browser/resources/downloads/throttled_icon_loader.js diff --git a/chrome/browser/resources/md_downloads/compiled_resources.gyp b/chrome/browser/resources/md_downloads/compiled_resources.gyp index 9f37099..89a982f 100644 --- a/chrome/browser/resources/md_downloads/compiled_resources.gyp +++ b/chrome/browser/resources/md_downloads/compiled_resources.gyp @@ -15,8 +15,6 @@ '../../../../ui/webui/resources/js/event_tracker.js', '../../../../ui/webui/resources/js/cr/ui.js', '../../../../ui/webui/resources/js/cr/ui/command.js', - '../../../../ui/webui/resources/js/cr/ui/focus_row.js', - '../../../../ui/webui/resources/js/cr/ui/focus_grid.js', '../../../../ui/webui/resources/js/util.js', '../../../../third_party/polymer/v1_0/components-chromium/iron-a11y-keys-behavior/iron-a11y-keys-behavior-extracted.js', '../../../../third_party/polymer/v1_0/components-chromium/iron-behaviors/iron-button-state-extracted.js', @@ -28,14 +26,12 @@ '../../../../third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js', 'action_service.js', 'constants.js', - 'throttled_icon_loader.js', - 'focus_row.js', 'item.js', 'toolbar.js', ], 'externs': [ '<(EXTERNS_DIR)/chrome_send.js', - '../downloads/externs.js', + 'externs.js', ], }, 'includes': ['../../../../third_party/closure_compiler/compile_js.gypi'], diff --git a/chrome/browser/resources/md_downloads/compiled_resources2.gyp b/chrome/browser/resources/md_downloads/compiled_resources2.gyp index 78f2cbc..bc280d8 100644 --- a/chrome/browser/resources/md_downloads/compiled_resources2.gyp +++ b/chrome/browser/resources/md_downloads/compiled_resources2.gyp @@ -18,22 +18,18 @@ 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], }, { - 'target_name': 'focus_row', - 'dependencies': [ - '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr', - '<(DEPTH)/ui/webui/resources/js/cr/ui/compiled_resources2.gyp:focus_row', - ], - 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], + 'target_name': 'externs', + 'includes': ['../../../../third_party/closure_compiler/externs_js.gypi'], }, { 'target_name': 'item', 'dependencies': [ + # TODO(dbeam): create compiled_resources2.gyp files for Polymer. '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data', - '../downloads/compiled_resources2.gyp:constants', - '../downloads/compiled_resources2.gyp:throttled_icon_loader', - '../downloads/compiled_resources2.gyp:externs', + 'constants', 'action_service', + 'externs', ], 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], }, @@ -45,9 +41,7 @@ '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util', '<(DEPTH)/ui/webui/resources/js/cr/compiled_resources2.gyp:ui', '<(DEPTH)/ui/webui/resources/js/cr/ui/compiled_resources2.gyp:command', - '<(DEPTH)/ui/webui/resources/js/cr/ui/compiled_resources2.gyp:focus_grid', 'action_service', - 'focus_row', 'item', 'toolbar', '<(EXTERNS_GYP):chrome_send', @@ -56,14 +50,11 @@ 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], }, { - 'target_name': 'throttled_icon_loader', - 'dependencies': ['<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr'], - 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], - }, - { 'target_name': 'toolbar', 'dependencies': [ '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr', + '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util', + '<(DEPTH)/ui/webui/resources/cr_elements/cr_search_field/compiled_resources2.gyp:cr_search_field', 'action_service', ], 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], diff --git a/chrome/browser/resources/md_downloads/externs.js b/chrome/browser/resources/md_downloads/externs.js new file mode 100644 index 0000000..65efb05 --- /dev/null +++ b/chrome/browser/resources/md_downloads/externs.js @@ -0,0 +1,36 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview Externs for objects sent from C++ to JS for chrome://downloads. + * @externs + */ + +var downloads = {}; + +/** + * The type of the download object. The definition is based on + * chrome/browser/ui/webui/downloads_dom_handler.cc:CreateDownloadItemValue() + * @typedef {{by_ext_id: string, + * by_ext_name: string, + * danger_type: string, + * date_string: string, + * file_externally_removed: boolean, + * file_name: string, + * file_path: string, + * file_url: string, + * id: string, + * last_reason_text: string, + * otr: boolean, + * percent: number, + * progress_status_text: string, + * resume: boolean, + * retry: boolean, + * since_string: string, + * started: number, + * state: string, + * total: number, + * url: string}} + */ +downloads.Data; diff --git a/chrome/browser/resources/md_downloads/focus_row.html b/chrome/browser/resources/md_downloads/focus_row.html deleted file mode 100644 index 955ef28..0000000 --- a/chrome/browser/resources/md_downloads/focus_row.html +++ /dev/null @@ -1,2 +0,0 @@ -<link rel="import" href="chrome://resources/html/cr/ui/focus_row.html"> -<script src="chrome://downloads/focus_row.js"></script> diff --git a/chrome/browser/resources/md_downloads/manager.html b/chrome/browser/resources/md_downloads/manager.html index 628f0ea..3c36dd0 100644 --- a/chrome/browser/resources/md_downloads/manager.html +++ b/chrome/browser/resources/md_downloads/manager.html @@ -2,14 +2,12 @@ <link rel="import" href="chrome://resources/html/load_time_data.html"> <link rel="import" href="chrome://resources/html/cr/ui.html"> <link rel="import" href="chrome://resources/html/cr/ui/command.html"> -<link rel="import" href="chrome://resources/html/cr/ui/focus_grid.html"> <link rel="import" href="chrome://resources/html/util.html"> <link rel="import" href="chrome://resources/polymer/v1_0/polymer/polymer.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-header-panel/paper-header-panel.html"> <link rel="import" href="chrome://downloads/action_service.html"> <link rel="import" href="chrome://downloads/constants.html"> -<link rel="import" href="chrome://downloads/focus_row.html"> <link rel="import" href="chrome://downloads/item.html"> <link rel="import" href="chrome://downloads/toolbar.html"> diff --git a/chrome/browser/ui/webui/downloads_ui.cc b/chrome/browser/ui/webui/downloads_ui.cc index 23abd9c..b23bf33 100644 --- a/chrome/browser/ui/webui/downloads_ui.cc +++ b/chrome/browser/ui/webui/downloads_ui.cc @@ -116,8 +116,6 @@ content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) { IDR_MD_DOWNLOADS_ACTION_SERVICE_JS); source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS); source->AddResourcePath("dev.html", IDR_MD_DOWNLOADS_DOWNLOADS_HTML); - source->AddResourcePath("focus_row.html", IDR_MD_DOWNLOADS_FOCUS_ROW_HTML); - source->AddResourcePath("focus_row.js", IDR_MD_DOWNLOADS_FOCUS_ROW_JS); source->AddResourcePath("item.css", IDR_MD_DOWNLOADS_ITEM_CSS); source->AddResourcePath("item.html", IDR_MD_DOWNLOADS_ITEM_HTML); source->AddResourcePath("item.js", IDR_MD_DOWNLOADS_ITEM_JS); diff --git a/ui/webui/resources/cr_elements/cr_search_field/compiled_resources2.gyp b/ui/webui/resources/cr_elements/cr_search_field/compiled_resources2.gyp new file mode 100644 index 0000000..77b9eea --- /dev/null +++ b/ui/webui/resources/cr_elements/cr_search_field/compiled_resources2.gyp @@ -0,0 +1,14 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'cr_search_field', + 'dependencies': [ + '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert', + ], + 'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'], + }, + ], +} |
